func NewServer(cfg Config, e *sqle.Engine, sb SessionBuilder) (*Server, error) {
	var tracer opentracing.Tracer
	if cfg.Tracer != nil {
		tracer = cfg.Tracer
	} else {
		tracer = opentracing.NoopTracer{}
	}
	if cfg.ConnReadTimeout < 0 {
		cfg.ConnReadTimeout = 0
	}
	if cfg.ConnWriteTimeout < 0 {
		cfg.ConnWriteTimeout = 0
	}
	handler := NewHandler(e,
		NewSessionManager(
			sb, tracer,
			e.Catalog.MemoryManager,
			cfg.Address),
		cfg.ConnReadTimeout)
	a := cfg.Auth.Mysql()
	l, err := NewListener(cfg.Protocol, cfg.Address, handler)
	if err != nil {
		return nil, err
	}
	vtListnr, err := mysql.NewFromListener(l, a, handler, cfg.ConnReadTimeout, cfg.ConnWriteTimeout)
	if err != nil {
		return nil, err
	}
	return &Server{Listener: vtListnr, h: handler}, nil
}
NewServer creates a server with the given protocol, address, authentication
details given a SQLe engine and a session builder.
package server
import (
	"time"
	"github.com/opentracing/opentracing-go"
	sqle "github.com/src-d/go-mysql-server"
	"github.com/src-d/go-mysql-server/auth"
	"vitess.io/vitess/go/mysql"
)
type Server struct {
	Listener *mysql.Listener
	h        *Handler
}
type Config struct {
	Protocol string
	Address string
	Auth auth.Auth
	Tracer opentracing.Tracer
	ConnReadTimeout  time.Duration
	ConnWriteTimeout time.Duration
}
func NewDefaultServer(cfg Config, e *sqle.Engine) (*Server, error) {
	return NewServer(cfg, e, DefaultSessionBuilder)
}