MCPcopy Create free account
hub / github.com/dank/rlapi / TestPsyNetRPC_IsConnected

Function TestPsyNetRPC_IsConnected

psynetrpc_test.go:575–599  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

573}
574
575func TestPsyNetRPC_IsConnected(t *testing.T) {
576 mockServer := NewMockWSServer()
577 defer mockServer.Close()
578
579 psyNet := NewPsyNet()
580 rpc, err := psyNet.establishSocket(mockServer.URL(), "test-token", "test-session", "test-player")
581 if err != nil {
582 t.Fatalf("Failed to establish socket: %v", err)
583 }
584
585 defer rpc.Close()
586
587 // Should be connected initially
588 if !rpc.IsConnected() {
589 t.Error("Expected connection to be active initially")
590 }
591
592 // Close connection
593 rpc.Close()
594
595 // Should not be connected after close
596 if rpc.IsConnected() {
597 t.Error("Expected connection to be inactive after close")
598 }
599}
600
601func TestPsyNetRPC_PingPongHandling(t *testing.T) {
602 mockServer := NewMockWSServer()

Callers

nothing calls this directly

Calls 7

CloseMethod · 0.95
establishSocketMethod · 0.95
URLMethod · 0.95
NewMockWSServerFunction · 0.85
NewPsyNetFunction · 0.85
IsConnectedMethod · 0.80
ErrorMethod · 0.80

Tested by

no test coverage detected