diff options
Diffstat (limited to 'libgo/go/net/http/transport_test.go')
-rw-r--r-- | libgo/go/net/http/transport_test.go | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/libgo/go/net/http/transport_test.go b/libgo/go/net/http/transport_test.go index d0202c0..cae5464 100644 --- a/libgo/go/net/http/transport_test.go +++ b/libgo/go/net/http/transport_test.go @@ -30,7 +30,7 @@ import ( "net/http/httptest" "net/http/httptrace" "net/http/httputil" - "net/http/internal" + "net/http/internal/testcert" "net/textproto" "net/url" "os" @@ -626,12 +626,15 @@ func TestTransportMaxConnsPerHost(t *testing.T) { t.Fatalf("ExportHttp2ConfigureTransport: %v", err) } - connCh := make(chan net.Conn, 1) + mu := sync.Mutex{} + var conns []net.Conn var dialCnt, gotConnCnt, tlsHandshakeCnt int32 tr.Dial = func(network, addr string) (net.Conn, error) { atomic.AddInt32(&dialCnt, 1) c, err := net.Dial(network, addr) - connCh <- c + mu.Lock() + defer mu.Unlock() + conns = append(conns, c) return c, err } @@ -685,7 +688,12 @@ func TestTransportMaxConnsPerHost(t *testing.T) { t.FailNow() } - (<-connCh).Close() + mu.Lock() + for _, c := range conns { + c.Close() + } + conns = nil + mu.Unlock() tr.CloseIdleConnections() doReq() @@ -3738,7 +3746,7 @@ func TestTransportDialTLSContext(t *testing.T) { if err != nil { return nil, err } - return c, c.Handshake() + return c, c.HandshakeContext(ctx) } req, err := NewRequest("GET", ts.URL, nil) @@ -4295,7 +4303,7 @@ func TestTransportReuseConnEmptyResponseBody(t *testing.T) { // Issue 13839 func TestNoCrashReturningTransportAltConn(t *testing.T) { - cert, err := tls.X509KeyPair(internal.LocalhostCert, internal.LocalhostKey) + cert, err := tls.X509KeyPair(testcert.LocalhostCert, testcert.LocalhostKey) if err != nil { t.Fatal(err) } |