aboutsummaryrefslogtreecommitdiffstats
path: root/p2p/peer_test.go
diff options
context:
space:
mode:
authorFelix Lange <fjl@twurst.com>2014-11-25 23:01:39 +0800
committerFelix Lange <fjl@twurst.com>2014-11-25 23:01:39 +0800
commit9b85002b700500d421ba7e13ac2062a6b8090a83 (patch)
tree1cfa335fe194c391b946f9efb9760417729330ef /p2p/peer_test.go
parentf816fdcb692d64cd5196b08c678550060e7e7df7 (diff)
downloaddexon-9b85002b700500d421ba7e13ac2062a6b8090a83.tar
dexon-9b85002b700500d421ba7e13ac2062a6b8090a83.tar.gz
dexon-9b85002b700500d421ba7e13ac2062a6b8090a83.tar.bz2
dexon-9b85002b700500d421ba7e13ac2062a6b8090a83.tar.lz
dexon-9b85002b700500d421ba7e13ac2062a6b8090a83.tar.xz
dexon-9b85002b700500d421ba7e13ac2062a6b8090a83.tar.zst
dexon-9b85002b700500d421ba7e13ac2062a6b8090a83.zip
p2p: remove Msg.Value and MsgLoop
Diffstat (limited to 'p2p/peer_test.go')
-rw-r--r--p2p/peer_test.go14
1 files changed, 8 insertions, 6 deletions
diff --git a/p2p/peer_test.go b/p2p/peer_test.go
index 629475421..0994683a2 100644
--- a/p2p/peer_test.go
+++ b/p2p/peer_test.go
@@ -2,8 +2,10 @@ package p2p
import (
"bufio"
+ "bytes"
+ "encoding/hex"
+ "io/ioutil"
"net"
- "reflect"
"testing"
"time"
)
@@ -53,13 +55,13 @@ func TestPeerProtoReadMsg(t *testing.T) {
if msg.Code != 2 {
t.Errorf("incorrect msg code %d relayed to protocol", msg.Code)
}
- data, err := msg.Value()
+ data, err := ioutil.ReadAll(msg.Payload)
if err != nil {
- t.Errorf("data decoding error: %v", err)
+ t.Errorf("payload read error: %v", err)
}
- expdata := []interface{}{[]byte{0x01}, []byte{0x30, 0x30, 0x30}}
- if !reflect.DeepEqual(data.Slice(), expdata) {
- t.Errorf("incorrect msg data %#v", data.Slice())
+ expdata, _ := hex.DecodeString("0183303030")
+ if !bytes.Equal(expdata, data) {
+ t.Errorf("incorrect msg data %x", data)
}
close(done)
return nil