(t *testing.T)
| 484 | } |
| 485 | |
| 486 | func TestHTTPFallbackPortError(t *testing.T) { |
| 487 | // This test only checks the isPortError since testing the whole http fallback would |
| 488 | // require listening on 80 and making sure nothing is listening on 443. |
| 489 | |
| 490 | l, err := net.Listen("tcp", "127.0.0.1:0") |
| 491 | if err != nil { |
| 492 | t.Fatal(err) |
| 493 | } |
| 494 | host := l.Addr().String() |
| 495 | err = l.Close() |
| 496 | if err != nil { |
| 497 | t.Fatal(err) |
| 498 | } |
| 499 | |
| 500 | _, err = net.Dial("tcp", host) |
| 501 | if err == nil { |
| 502 | t.Fatal("Dial should fail after close") |
| 503 | } |
| 504 | |
| 505 | if isPortError(err, host) { |
| 506 | t.Fatalf("Expected no port error for %s with %v", host, err) |
| 507 | } |
| 508 | if !isPortError(err, "127.0.0.1") { |
| 509 | t.Fatalf("Expected port error for 127.0.0.1 with %v", err) |
| 510 | } |
| 511 | |
| 512 | } |
| 513 | |
| 514 | func TestResolveProxy(t *testing.T) { |
| 515 | var ( |
nothing calls this directly
no test coverage detected
searching dependent graphs…