data_sender_go/data_sender_test.go

27 lines
402 B
Go
Raw Normal View History

2017-04-26 06:47:40 +00:00
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())
}