Skip to content

Commit

Permalink
fix http test timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
p4gefau1t committed Jun 17, 2020
1 parent dd1294b commit 66514cb
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions tunnel/http/http_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,13 @@ func TestHTTP(t *testing.T) {
conn.Close()
}

req, err := http.NewRequest("CONNECT", "https://google.com:443", nil)
req, err := http.NewRequest(http.MethodConnect, "https://google.com:443", nil)
common.Must(err)
conn1, err := net.Dial("tcp", fmt.Sprintf("127.0.0.1:%d", port))
common.Must(err)
req.Write(conn1)
go func() {
common.Must(req.Write(conn1))
}()

conn2, err := s.AcceptConn(nil)
common.Must(err)
Expand All @@ -64,7 +66,8 @@ func TestHTTP(t *testing.T) {

connResp := "HTTP/1.1 200 Connection established\r\n\r\n"
buf := make([]byte, len(connResp))
conn1.Read(buf)
_, err = conn1.Read(buf)
common.Must(err)
if string(buf) != connResp {
t.Fail()
}
Expand Down

0 comments on commit 66514cb

Please sign in to comment.