(t testing.TB, dialOpts *websocket.DialOptions, acceptOpts *websocket.AcceptOptions)
| 499 | } |
| 500 | |
| 501 | func newConnTest(t testing.TB, dialOpts *websocket.DialOptions, acceptOpts *websocket.AcceptOptions) (tt *connTest, c1, c2 *websocket.Conn) { |
| 502 | if t, ok := t.(*testing.T); ok { |
| 503 | t.Parallel() |
| 504 | } |
| 505 | t.Helper() |
| 506 | |
| 507 | ctx, cancel := context.WithTimeout(context.Background(), time.Second*30) |
| 508 | tt = &connTest{t: t, ctx: ctx} |
| 509 | t.Cleanup(cancel) |
| 510 | |
| 511 | c1, c2 = wstest.Pipe(dialOpts, acceptOpts) |
| 512 | if xrand.Bool() { |
| 513 | c1, c2 = c2, c1 |
| 514 | } |
| 515 | t.Cleanup(func() { |
| 516 | c2.CloseNow() |
| 517 | c1.CloseNow() |
| 518 | }) |
| 519 | |
| 520 | return tt, c1, c2 |
| 521 | } |
| 522 | |
| 523 | func (tt *connTest) goEchoLoop(c *websocket.Conn) { |
| 524 | ctx, cancel := context.WithCancel(tt.ctx) |
no test coverage detected
searching dependent graphs…