File tree Expand file tree Collapse file tree 1 file changed +14
-5
lines changed Expand file tree Collapse file tree 1 file changed +14
-5
lines changed Original file line number Diff line number Diff line change @@ -37,13 +37,18 @@ func TestProxy(t *testing.T) {
3737
3838 mux := http .NewServeMux ()
3939 mux .Handle ("/proxy" , proxy )
40+ errChan := make (chan error )
4041 go func () {
41- if err := http .ListenAndServe (":7777 " , mux ); err != nil {
42- t . Fatal ( "ListenAndServe: " , err )
42+ if err := http .ListenAndServe (":443 " , mux ); err != nil {
43+ errChan <- err
4344 }
4445 }()
4546
46- time .Sleep (time .Millisecond * 100 )
47+ select {
48+ case err := <- errChan :
49+ t .Fatal ("ListenAndServe: " , err )
50+ case <- time .After (time .Second ):
51+ }
4752
4853 // backend echo server
4954 go func () {
@@ -73,11 +78,15 @@ func TestProxy(t *testing.T) {
7378
7479 err := http .ListenAndServe (":8888" , mux2 )
7580 if err != nil {
76- t . Fatal ( "ListenAndServe: " , err )
81+ errChan <- err
7782 }
7883 }()
7984
80- time .Sleep (time .Millisecond * 100 )
85+ select {
86+ case err := <- errChan :
87+ t .Fatal ("ListenAndServe: " , err )
88+ case <- time .After (time .Second ):
89+ }
8190
8291 // let's us define two subprotocols, only one is supported by the server
8392 clientSubProtocols := []string {"test-protocol" , "test-notsupported" }
You can’t perform that action at this time.
0 commit comments