code: func (s *Server) serve(ctx context.Context, l net.Listener, wg *sync.WaitGroup, secret string) error {
  	mux := http.NewServeMux()
  
  	mux.Handle("/gsutil/authorization", &handler{ctx, wg, func(rw http.ResponseWriter, r *http.Request) {
  		// Authorization URI is normally used during interactive login to eventually
  		// generate a refresh token. Since we pass the refresh token in .boto
  		// already, it must never be called.
  		rw.WriteHeader(http.StatusNotImplemented)
  	}})
  
  	mux.Handle("/gsutil/token", &handler{ctx, wg, func(rw http.ResponseWriter, r *http.Request) {
  		err := s.handleTokenRequest(rw, r, secret)
  
  		code := 0
  		msg := ""
  		if transient.Tag.In(err) {
  			code = http.StatusInternalServerError
  			msg = fmt.Sprintf("Transient error - %s", err)
  		} else if err != nil {
  			code = http.StatusBadRequest
  			msg = fmt.Sprintf("Bad request - %s", err)
  		}
  
  		if code != 0 {
  			logging.Errorf(ctx, "%s", msg)
  			http.Error(rw, msg, code)
  		}
  	}})
  
  	srv := http.Server{Handler: mux}
  	return srv.Serve(l)
  }
docs: // serve runs the serving loop.