diff options
Diffstat (limited to 'libgo/go/net/http/npn_test.go')
-rw-r--r-- | libgo/go/net/http/npn_test.go | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/libgo/go/net/http/npn_test.go b/libgo/go/net/http/npn_test.go index 4c1f6b573df..618bdbe54a6 100644 --- a/libgo/go/net/http/npn_test.go +++ b/libgo/go/net/http/npn_test.go @@ -8,6 +8,7 @@ import ( "bufio" "bytes" "crypto/tls" + "crypto/x509" "fmt" "io" "io/ioutil" @@ -43,10 +44,7 @@ func TestNextProtoUpgrade(t *testing.T) { // Normal request, without NPN. { - tr := newTLSTransport(t, ts) - defer tr.CloseIdleConnections() - c := &Client{Transport: tr} - + c := ts.Client() res, err := c.Get(ts.URL) if err != nil { t.Fatal(err) @@ -63,11 +61,18 @@ func TestNextProtoUpgrade(t *testing.T) { // Request to an advertised but unhandled NPN protocol. // Server will hang up. { - tr := newTLSTransport(t, ts) - tr.TLSClientConfig.NextProtos = []string{"unhandled-proto"} + certPool := x509.NewCertPool() + certPool.AddCert(ts.Certificate()) + tr := &Transport{ + TLSClientConfig: &tls.Config{ + RootCAs: certPool, + NextProtos: []string{"unhandled-proto"}, + }, + } defer tr.CloseIdleConnections() - c := &Client{Transport: tr} - + c := &Client{ + Transport: tr, + } res, err := c.Get(ts.URL) if err == nil { defer res.Body.Close() @@ -80,7 +85,8 @@ func TestNextProtoUpgrade(t *testing.T) { // Request using the "tls-0.9" protocol, which we register here. // It is HTTP/0.9 over TLS. { - tlsConfig := newTLSTransport(t, ts).TLSClientConfig + c := ts.Client() + tlsConfig := c.Transport.(*Transport).TLSClientConfig tlsConfig.NextProtos = []string{"tls-0.9"} conn, err := tls.Dial("tcp", ts.Listener.Addr().String(), tlsConfig) if err != nil { |