Commit 96f968df authored by Brad Fitzpatrick's avatar Brad Fitzpatrick

http: add a (disabled) test for TLS handshake timeouts

It's currently broken and disabled, pending a fix
for Issue 2281.

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/5092045
parent 1262f6bd
......@@ -535,6 +535,30 @@ func TestHeadResponses(t *testing.T) {
}
}
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)
}
}
func TestTLSServer(t *testing.T) {
ts := httptest.NewTLSServer(HandlerFunc(func(w ResponseWriter, r *Request) {
if r.TLS != nil {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment