diff --git a/client_server_test.go b/client_server_test.go index 5a2113f..2dbd7e6 100644 --- a/client_server_test.go +++ b/client_server_test.go @@ -109,17 +109,16 @@ func (s *cstProxyServer) ServeHTTP(w http.ResponseWriter, req *http.Request) { _, _ = fmt.Fprintf(conn, "HTTP/1.1 200 Connection established\r\n\r\n") - wg := sync.WaitGroup{} - wg.Add(2) + done := make(chan struct{}, 2) go func() { - defer wg.Done() _, _ = io.Copy(upstream, conn) + done <- struct{}{} }() go func() { - defer wg.Done() _, _ = io.Copy(conn, upstream) + done <- struct{}{} }() - wg.Wait() + <-done } func newProxyServer() *httptest.Server {