MCPcopy
hub / github.com/olahol/melody / TestPingPong

Function TestPingPong

melody_test.go:410–429  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

408}
409
410func TestPingPong(t *testing.T) {
411 done := make(chan bool)
412
413 ws := NewTestServer()
414 ws.m.Config.PingPeriod = time.Millisecond
415
416 ws.m.HandlePong(func(s *Session) {
417 close(done)
418 })
419
420 server := httptest.NewServer(ws)
421 defer server.Close()
422
423 conn := MustNewDialer(server.URL)
424 defer conn.Close()
425
426 go conn.NextReader()
427
428 <-done
429}
430
431func TestHandleClose(t *testing.T) {
432 done := make(chan bool)

Callers

nothing calls this directly

Calls 4

NewTestServerFunction · 0.85
MustNewDialerFunction · 0.85
HandlePongMethod · 0.80
CloseMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…