use correct packages
All checks were successful
Build and Publish / BuildAndDeploy (push) Successful in 1m51s

This commit is contained in:
matst80
2024-11-10 21:58:43 +01:00
parent c70c5cd930
commit ab0e708d00
5 changed files with 65 additions and 11 deletions

View File

@@ -25,12 +25,19 @@ func TestTcpHelpers(t *testing.T) {
log.Printf("Received call: %s\n", string(data))
return 3, []byte("Hello, client!"), nil
})
server.HandleCall(Ping, func(data []byte) (uint32, []byte, error) {
return Pong, nil, nil
})
client.SendPacket(1, []byte("Hello, world!"))
answer, err := client.Call(2, 3, []byte("Hello, server!"))
if err != nil {
t.Errorf("Error calling: %v\n", err)
}
_, err = client.Call(Ping, Pong, nil)
if err != nil {
t.Errorf("Error calling: %v\n", err)
}
if string(answer) != "Hello, client!" {
t.Errorf("Expected answer 'Hello, client!', got %s\n", string(answer))
}