File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed
Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -481,7 +481,23 @@ func TestRequestWithBodyReplyEndToEndWithTLS(t *testing.T) {
481481 }()
482482
483483 server .Handler = r
484- go server .ListenAndServeTLS (publicKeyFile .Name (), privateKeyFile .Name ())
484+ go func () {
485+ if err := server .ListenAndServeTLS (publicKeyFile .Name (), privateKeyFile .Name ()); err != nil && err != http .ErrServerClosed {
486+ log .Fatalf ("ListenAndServeTLS(): %v" , err )
487+ }
488+ }()
489+
490+ // Wait for the server to be ready
491+ for {
492+ conn , err := tls .Dial ("tcp" , server .Addr , & tls.Config {
493+ InsecureSkipVerify : true ,
494+ })
495+ if err == nil {
496+ conn .Close ()
497+ break
498+ }
499+ time .Sleep (10 * time .Millisecond )
500+ }
485501
486502 // Build a TLS config for the client and set on the subscription object
487503 cert , err := tls .LoadX509KeyPair (publicKeyFile .Name (), privateKeyFile .Name ())
You can’t perform that action at this time.
0 commit comments