func (s *Server) Stop() {
	s.srv.grpc.GracefulStop()
}
Stop stops the server gracefully.
package server
import (
	"bytes"
	"io"
	"net/http"
	"github.com/utrack/clay/v3/transport"
	"github.com/pkg/errors"
)
type Server struct {
	opts      *serverOpts
	listeners *listenerSet
	srv       *serverSet
}
func NewServer(rpcPort int, opts ...Option) *Server {
	serverOpts := defaultServerOpts(rpcPort)
	for _, opt := range opts {
		opt(serverOpts)
	}
	return &Server{opts: serverOpts}
}
func (s *Server) Run(svc transport.Service) error {
	desc := svc.GetDescription()
	var err error
	s.listeners, err = newListenerSet(s.opts)
	if err != nil {
		return errors.Wrap(err, "couldn't create listeners")
	}
	s.srv = newServerSet(s.listeners, s.opts)
	s.srv.http.HandleFunc("/swagger.json", func(w http.ResponseWriter, req *http.Request) {
		io.Copy(w, bytes.NewReader(desc.SwaggerDef()))
	})
	if d, ok := desc.(transport.ConfigurableServiceDesc); ok {
		d.Apply(transport.WithUnaryInterceptor(s.opts.GRPCUnaryInterceptor))
	}
	desc.RegisterHTTP(s.srv.http)
	desc.RegisterGRPC(s.srv.grpc)
	return s.run()
}
func (s *Server) run() error {
	errChan := make(chan error, 5)
	if s.listeners.mainListener != nil {
		go func() {
			err := s.listeners.mainListener.Serve()
			errChan <- err
		}()
	}
	go func() {
		err := http.Serve(s.listeners.HTTP, s.srv.http)
		errChan <- err
	}()
	go func() {
		err := s.srv.grpc.Serve(s.listeners.GRPC)
		errChan <- err
	}()
	return <-errChan
}