27 lines
402 B
Go
27 lines
402 B
Go
|
package data_sender_go
|
||
|
|
||
|
import (
|
||
|
"testing"
|
||
|
"loafle.com/overflow/crawler_go/grpc"
|
||
|
"time"
|
||
|
"bytes"
|
||
|
"encoding/binary"
|
||
|
"fmt"
|
||
|
)
|
||
|
|
||
|
func TestSend(t *testing.T) {
|
||
|
result := &grpc.Output{
|
||
|
StartDate:time.Now().UnixNano(),
|
||
|
EndDate:time.Now().UnixNano(),
|
||
|
Data:[]byte{'a','b','c'},
|
||
|
}
|
||
|
|
||
|
var buf bytes.Buffer
|
||
|
binary.Write(&buf, binary.BigEndian, result)
|
||
|
|
||
|
fmt.Println(buf.Bytes())
|
||
|
Send(buf.Bytes())
|
||
|
|
||
|
}
|
||
|
|