MCPcopy
hub / github.com/gorilla/websocket / TestHandshakeTimeoutInContext

Function TestHandshakeTimeoutInContext

client_server_test.go:389–408  ·  client_server_test.go::TestHandshakeTimeoutInContext
(t *testing.T)

Source from the content-addressed store, hash-verified

387}
388
389func TestHandshakeTimeoutInContext(t *testing.T) {
390 s := newServer(t)
391 defer s.Close()
392
393 d := cstDialer
394 d.HandshakeTimeout = 0
395 d.NetDialContext = func(ctx context.Context, n, a string) (net.Conn, error) {
396 netDialer := &net.Dialer{}
397 c, err := netDialer.DialContext(ctx, n, a)
398 return &requireDeadlineNetConn{c: c, t: t}, err
399 }
400
401 ctx, cancel := context.WithDeadline(context.Background(), time.Now().Add(30*time.Second))
402 defer cancel()
403 ws, _, err := d.DialContext(ctx, s.URL, nil)
404 if err != nil {
405 t.Fatal("Dial:", err)
406 }
407 ws.Close()
408}
409
410func TestDialBadScheme(t *testing.T) {
411 s := newServer(t)

Callers

nothing calls this directly

Calls 3

DialContextMethod · 0.95
newServerFunction · 0.85
CloseMethod · 0.45

Tested by

no test coverage detected