func TestTLSHandshakeTimeout(t *testing.T) { ts := httptest.NewUnstartedServer(HandlerFunc(func(w ResponseWriter, r *Request) {})) ts.Config.ReadTimeout = 250e6 ts.StartTLS() defer ts.Close() conn, err := net.Dial("tcp", ts.Listener.Addr().String()) if err != nil { t.Fatalf("Dial: %v", err) } defer conn.Close() goTimeout(t, 10e9, func() { var buf [1]byte n, err := conn.Read(buf[:]) if err == nil || n != 0 { t.Errorf("Read = %d, %v; want an error and no bytes", n, err) } }) }
func TestTLSHandshakeTimeout(t *testing.T) { if true { t.Logf("Skipping broken test; issue 2281") return } ts := httptest.NewUnstartedServer(HandlerFunc(func(w ResponseWriter, r *Request) {})) ts.Config.ReadTimeout = 250e6 ts.StartTLS() defer ts.Close() conn, err := net.Dial("tcp", ts.Listener.Addr().String()) if err != nil { t.Fatalf("Dial: %v", err) } defer conn.Close() timer := time.AfterFunc(10e9, func() { t.Fatalf("Timeout") }) defer timer.Stop() var buf [1]byte n, err := conn.Read(buf[:]) if err == nil || n != 0 { t.Errorf("Read = %d, %v; want an error and no bytes", n, err) } }