code: func (s *Server) StartTLS() {
  	if s.URL != "" {
  		panic("Server already started")
  	}
  	if s.client == nil {
  		s.client = &http.Client{Transport: &http.Transport{}}
  	}
  	cert, err := tls.X509KeyPair(LocalhostCert, LocalhostKey)
  	if err != nil {
  		panic(fmt.Sprintf("httptest: NewTLSServer: %v", err))
  	}
  
  	existingConfig := s.TLS
  	if existingConfig != nil {
  		s.TLS = existingConfig.Clone()
  	} else {
  		s.TLS = new(tls.Config)
  	}
  	if s.TLS.NextProtos == nil {
  		s.TLS.NextProtos = []string{"http/1.1"}
  	}
  	if len(s.TLS.Certificates) == 0 {
  		s.TLS.Certificates = []tls.Certificate{cert}
  	}
  	s.certificate, err = x509.ParseCertificate(s.TLS.Certificates[0].Certificate[0])
  	if err != nil {
  		panic(fmt.Sprintf("httptest: NewTLSServer: %v", err))
  	}
  	certpool := x509.NewCertPool()
  	certpool.AddCert(s.certificate)
  	s.client.Transport = &http.Transport{
  		TLSClientConfig: &tls.Config{
  			RootCAs: certpool,
  		},
  	}
  	s.Listener = tls.NewListener(s.Listener, s.TLS)
  	s.URL = "https://" + s.Listener.Addr().String()
  	s.wrap()
  	s.goServe()
  }
docs: // StartTLS starts TLS on a server from NewUnstartedServer.