From 2d1e4548da234d9cb742cc3628556fef86aafbac Mon Sep 17 00:00:00 2001 From: Gary Burd Date: Mon, 12 Sep 2016 08:30:41 -0700 Subject: [PATCH] Simplify dial TLS test There's no need to fake the connection to example.com because 127.0.0.1 is a host in the net/http/httptest certificate. --- client_server_test.go | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/client_server_test.go b/client_server_test.go index 3f7345d..1cb9b64 100644 --- a/client_server_test.go +++ b/client_server_test.go @@ -10,7 +10,6 @@ import ( "encoding/base64" "io" "io/ioutil" - "net" "net/http" "net/http/httptest" "net/url" @@ -243,11 +242,9 @@ func TestDialTLS(t *testing.T) { } } - u, _ := url.Parse(s.URL) d := cstDialer - d.NetDial = func(network, addr string) (net.Conn, error) { return net.Dial(network, u.Host) } d.TLSClientConfig = &tls.Config{RootCAs: certs} - ws, _, err := d.Dial("wss://example.com"+cstRequestURI, nil) + ws, _, err := d.Dial(s.URL, nil) if err != nil { t.Fatalf("Dial: %v", err) } @@ -267,7 +264,7 @@ func xTestDialTLSBadCert(t *testing.T) { } } -func xTestDialTLSNoVerify(t *testing.T) { +func TestDialTLSNoVerify(t *testing.T) { s := newTLSServer(t) defer s.Close()