MCPcopy Create free account
hub / github.com/dan-v/lambda-nat-proxy / TestPongMessage

Function TestPongMessage

pkg/shared/control_test.go:42–63  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

40}
41
42func TestPongMessage(t *testing.T) {
43 var buf bytes.Buffer
44 testNonce := uint64(12345)
45
46 // Write pong
47 if err := WritePong(&buf, testNonce); err != nil {
48 t.Fatalf("WritePong failed: %v", err)
49 }
50
51 // Read it back
52 opcode, nonce, err := ReadControlMessage(&buf)
53 if err != nil {
54 t.Fatalf("ReadControlMessage failed: %v", err)
55 }
56
57 if opcode != OpPong {
58 t.Errorf("Expected OpPong (0x%02x), got 0x%02x", OpPong, opcode)
59 }
60 if nonce != testNonce {
61 t.Errorf("Expected nonce %d, got %d", testNonce, nonce)
62 }
63}
64
65func TestShutdownMessage(t *testing.T) {
66 var buf bytes.Buffer

Callers

nothing calls this directly

Calls 2

WritePongFunction · 0.85
ReadControlMessageFunction · 0.85

Tested by

no test coverage detected