Skip to content

Instantly share code, notes, and snippets.

@TvdW
Last active August 26, 2019 13:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TvdW/4d12fc00f91175e379b15a079319d000 to your computer and use it in GitHub Desktop.
Save TvdW/4d12fc00f91175e379b15a079319d000 to your computer and use it in GitHub Desktop.
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