l, err := net.Listen("tcp", ":8443")
if err != nil {
panic(err)
}
l = tls.NewListener(l, &tls.Config{NextProtos: []string{http2.NextProtoTLS}, Certificates: []tls.Certificate{rootTLSCert}})
var srv http2.Server
opts := http2.ServeConnOpts{Handler: http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
w.Write([]byte("hello world"))
})}
for {
c, err := l.Accept()
// TODO: Handle temporary errors.
if err != nil {
panic(err)
}
go srv.ServeConn(c, &opts)
}