Skip to content

Instantly share code, notes, and snippets.

@TvdW TvdW/test.go
Last active Aug 26, 2019

Embed
What would you like to do?
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
You can’t perform that action at this time.