@@ -131,6 +131,7 @@ func handleProxyConn(t *testing.T, clientConn net.Conn, onConnect func(http.Resp
131131 done <- struct {}{}
132132 }()
133133 <- done
134+ <- done
134135}
135136
136137// simpleResponseWriter is a minimal http.ResponseWriter that writes directly to
@@ -475,9 +476,9 @@ func TestHTTPConnectDialer_DefaultPort_HTTPS(t *testing.T) {
475476// This test exercises cancellation during the forward-dial phase (before the
476477// TCP connection to the proxy is established).
477478func TestHTTPConnectDialer_ContextCancelled (t * testing.T ) {
478- // Use a forward dialer that blocks until the context is done.
479+ // Use a forward dialer that blocks until the test context is done.
479480 blocking := & recordingDialer {dial : func (network , addr string ) (net.Conn , error ) {
480- time . Sleep ( 5 * time . Second )
481+ <- t . Context (). Done ( )
481482 return nil , fmt .Errorf ("should not reach here" )
482483 }}
483484
@@ -700,7 +701,7 @@ func TestHTTPConnectDialer_TLSForHTTPSProxy(t *testing.T) {
700701 t .Fatalf ("Write: %v" , err )
701702 }
702703 buf := make ([]byte , len (msg ))
703- if _ , err := io .ReadFull (conn , buf ); err != nil && ! errors . Is ( err , io . ErrUnexpectedEOF ) {
704+ if _ , err := io .ReadFull (conn , buf ); err != nil {
704705 t .Fatalf ("Read: %v" , err )
705706 }
706707 if got := string (buf ); got != msg {
0 commit comments