require header match
This commit is contained in:
@@ -23,23 +23,24 @@ func TestCartTcpHelpers(t *testing.T) {
|
||||
return nil
|
||||
})
|
||||
server.HandleCall(666, func(id CartId, data []byte) (CartMessage, []byte, error) {
|
||||
log.Printf("Received call: %s\n", string(data))
|
||||
log.Printf("Received 666 call: %s\n", string(data))
|
||||
return 3, []byte("Hello, client!"), fmt.Errorf("Det blev fel")
|
||||
})
|
||||
server.HandleCall(2, func(id CartId, data []byte) (CartMessage, []byte, error) {
|
||||
log.Printf("Received call: %s\n", string(data))
|
||||
return 3, []byte("Hello, client!"), nil
|
||||
log.Printf("Received 2 call: %s\n", string(data))
|
||||
return 4, []byte("Hello, client!"), nil
|
||||
})
|
||||
// server.HandleCall(Ping, func(id CartId, data []byte) (CartMessage, []byte, error) {
|
||||
// return Pong, nil, nil
|
||||
// })
|
||||
id := ToCartId("kalle")
|
||||
client.SendPacket(1, id, []byte("Hello, world!"))
|
||||
answer, err := client.Call(2, id, 3, []byte("Hello, server!"))
|
||||
answer, err := client.Call(2, id, 4, []byte("Hello, server!"))
|
||||
if err != nil {
|
||||
t.Errorf("Error calling: %v\n", err)
|
||||
}
|
||||
s, err := client.Call(666, id, 3, []byte("Hello, server!"))
|
||||
client.Close()
|
||||
if err != nil {
|
||||
t.Errorf("Error calling: %v\n", err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user