Last active
August 26, 2019 13:40
-
-
Save TvdW/4d12fc00f91175e379b15a079319d000 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"context" | |
"log" | |
"net/http" | |
"time" | |
) | |
func main() { | |
srv := &http.Server{Addr: ":443", Handler: http.HandlerFunc(handle)} | |
go func() { | |
srv.ListenAndServeTLS("chain.pem", "key.pem") | |
}() | |
time.Sleep(2000 * time.Millisecond) | |
srv.Shutdown(context.Background()) | |
} | |
func handle(w http.ResponseWriter, r *http.Request) { | |
log.Printf("Got connection: %s", r.Proto) | |
time.Sleep(5000 * time.Millisecond) | |
w.WriteHeader(200) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment