(t *testing.T, addr string)
| 488 | } |
| 489 | |
| 490 | func tryTCPDial(t *testing.T, addr string) net.Conn { |
| 491 | attempts := 10 |
| 492 | var ( |
| 493 | conn net.Conn |
| 494 | err error |
| 495 | ) |
| 496 | for i := 0; i < attempts; i++ { |
| 497 | conn, err = net.Dial("tcp", addr) |
| 498 | if err != nil { |
| 499 | time.Sleep(100 * time.Millisecond) |
| 500 | continue |
| 501 | } |
| 502 | // Give the socket some time to finish the connection. |
| 503 | time.Sleep(100 * time.Millisecond) |
| 504 | return conn |
| 505 | } |
| 506 | |
| 507 | t.Fatalf("failed to dial in %v attempts: %v", attempts, err) |
| 508 | return nil |
| 509 | } |
| 510 | |
| 511 | func TestClientCloseWaitsForActiveConnections(t *testing.T) { |
| 512 | in := &proxy.Config{ |
no test coverage detected