code: func NewServer(config Config, runtime Runtime) (Server, error) {
  	s := &server{
  		config:  config,
  		runtime: &criAdapter{runtime},
  		cache:   newRequestCache(),
  	}
  
  	if s.config.BaseURL == nil {
  		s.config.BaseURL = &url.URL{
  			Scheme: "http",
  			Host:   s.config.Addr,
  		}
  		if s.config.TLSConfig != nil {
  			s.config.BaseURL.Scheme = "https"
  		}
  	}
  
  	ws := &restful.WebService{}
  	endpoints := []struct {
  		path    string
  		handler restful.RouteFunction
  	}{
  		{"/exec/{token}", s.serveExec},
  		{"/attach/{token}", s.serveAttach},
  		{"/portforward/{token}", s.servePortForward},
  	}
  	// If serving relative to a base path, set that here.
  	pathPrefix := path.Dir(s.config.BaseURL.Path)
  	for _, e := range endpoints {
  		for _, method := range []string{"GET", "POST"} {
  			ws.Route(ws.
  				Method(method).
  				Path(path.Join(pathPrefix, e.path)).
  				To(e.handler))
  		}
  	}
  	handler := restful.NewContainer()
  	handler.Add(ws)
  	s.handler = handler
  	s.server = &http.Server{
  		Addr:      s.config.Addr,
  		Handler:   s.handler,
  		TLSConfig: s.config.TLSConfig,
  	}
  
  	return s, nil
  }
docs: // NewServer creates a new Server for stream requests.
  // TODO(tallclair): Add auth(n/z) interface & handling.