func (s *Server) ListenAndServe() error {
	addr := s.s.Addr
	if addr == "" {
		addr = ":http"
	}
	var err error
	l, err := net.Listen("tcp", addr)
	if err != nil {
		return err
	}
	return s.Serve(l)
}
ListenAndServe works like net/http.Server.ListenAndServe except
that it gracefully shuts down when Close() is called. When that
occurs, no new connections will be allowed and existing connections
will be allowed to finish. This will not return until all existing
connections have closed.
package graceful
import (
	"crypto/tls"
	"net"
	"net/http"
	"sync"
)
var DefaultServer *Server
func ListenAndServe(addr string, handler http.Handler) error {
	h := handler
	if h == nil {
		h = http.DefaultServeMux
	}
	if DefaultServer == nil {
		DefaultServer = NewServer(&http.Server{Addr: addr, Handler: h})
	}
	return DefaultServer.ListenAndServe()
}
func ListenAndServeTLS(addr, certFile, keyFile string, handler http.Handler) error {
	h := handler
	if h == nil {
		h = http.DefaultServeMux
	}
	if DefaultServer == nil {
		DefaultServer = NewServer(&http.Server{Addr: addr, Handler: h})
	}
	return DefaultServer.ListenAndServeTLS(certFile, keyFile)
}
func Close() error {
	return DefaultServer.Close()
}
type Server struct {
	s  *http.Server
	wg sync.WaitGroup
	l  net.Listener
}
func NewServer(srv *http.Server) *Server {
	return &Server{
		s: srv,
	}
}