diff --git a/internal/proxy/passthrough_test.go b/internal/proxy/passthrough_test.go index 66caee7..c788d1f 100644 --- a/internal/proxy/passthrough_test.go +++ b/internal/proxy/passthrough_test.go @@ -5,7 +5,6 @@ import ( "bytes" "errors" "io" - "net" "net/http" "slices" "strings" @@ -354,15 +353,8 @@ func TestRefusesHeadersOver32KiB(t *testing.T) { func TestAnswers502WhenTheAppCannotBeReached(t *testing.T) { t.Parallel() - listener, err := (&net.ListenConfig{}).Listen(t.Context(), "tcp", localhost+":0") - if err != nil { - t.Fatalf("listen: %v", err) - } - - closedAddr := listener.Addr().String() - _ = listener.Close() - - addr, out := startProxy(t, "http://"+closedAddr, nil) + // No test can listen on port 1: listening on port 0 gets one from 32768 up. + addr, out := startProxy(t, "http://"+localhost+":1", nil) wantStatus(t, get(t, addr, "/"), http.StatusBadGateway) wantLine(t, out.requestLine(t), http.StatusBadGateway,