package peer import ( "bytes" "testing" ) func TestHandshake(t *testing.T) { h := Handshake{ Proto: Proto, PeerID: NewIDFixed(), } b := &bytes.Buffer{} h.Encode(b) t.Log(b.Bytes()) if len(b.Bytes()) != len(Proto)+49 { t.Error("expexted X+49 len") } r := bytes.NewReader(b.Bytes()) hh, ok := DecodeHandshake(r) if !ok { t.Error("not ok") } t.Log(hh) }