func (s *GracefulServer) ListenAndServeTLS(certFile, keyFile string) error {
	addr := s.Addr
	if addr == "" {
		addr = ":https"
	}
	config := &tls.Config{}
	if s.TLSConfig != nil {
		*config = *s.TLSConfig
	}
	if config.NextProtos == nil {
		config.NextProtos = []string{"http/1.1"}
	}
	var err error
	config.Certificates = make([]tls.Certificate, 1)
	config.Certificates[0], err = tls.LoadX509KeyPair(certFile, keyFile)
	if err != nil {
		return err
	}
	return s.ListenAndServeTLSWithConfig(config)
}
ListenAndServeTLS provides a graceful equivalent of net/http.Serve.ListenAndServeTLS.
package manners
import (
	"crypto/tls"
	"net"
	"net/http"
	"os"
	"sync"
	"sync/atomic"
)
type StateHandler func(net.Conn, http.ConnState, http.ConnState)
type Options struct {
	Server       *http.Server
	StateHandler StateHandler
	Listener     net.Listener
}
type GracefulServer struct {
	*http.Server
	shutdown         chan bool
	shutdownFinished chan bool
	wg               waitGroup
	listener         *GracefulListener
	stateHandler     StateHandler
	up chan net.Listener  
}
func NewServer() *GracefulServer {
	return NewWithServer(new(http.Server))
}
func NewWithServer(s *http.Server) *GracefulServer {
	return &GracefulServer{
		Server:           s,
		shutdown:         make(chan bool),
		shutdownFinished: make(chan bool, 1),
		wg:               new(sync.WaitGroup),
	}
}
func NewWithOptions(o Options) *GracefulServer {
	var listener *GracefulListener
	if o.Listener != nil {
		g, ok := o.Listener.(*GracefulListener)
		if !ok {
			listener = NewListener(o.Listener)
		} else {
			listener = g
		}
	}
	return &GracefulServer{
		listener:         listener,
		Server:           o.Server,
		stateHandler:     o.StateHandler,
		shutdown:         make(chan bool),
		shutdownFinished: make(chan bool, 1),
		wg:               new(sync.WaitGroup),
	}
}
func (s *GracefulServer) Close() bool {
	return <-s.shutdown
}
func (s *GracefulServer) BlockingClose() bool {
	result := s.Close()
	<-s.shutdownFinished
	return result
}
func (s *GracefulServer) ListenAndServe() error {
	if s.listener == nil {
		oldListener, err := net.Listen("tcp", s.Addr)
		if err != nil {
			return err
		}
		s.listener = NewListener(oldListener.(*net.TCPListener))
	}
	return s.Serve(s.listener)
}