HttpServer implements FilterContainer { public void stop() throws Exception { MultiException exception = null; try { listener.close(); } catch (Exception e) { LOG.error("Error while stopping listener for webapp" + webAppContext.getDisplayName(), e); exception = addMultiException(exception, e); } try { if (sslFactory != null) { sslFactory.destroy(); } } catch (Exception e) { LOG.error("Error while destroying the SSLFactory" + webAppContext.getDisplayName(), e); exception = addMultiException(exception, e); } try { webAppContext.clearAttributes(); webAppContext.stop(); } catch (Exception e) { LOG.error("Error while stopping web app context for webapp " + webAppContext.getDisplayName(), e); exception = addMultiException(exception, e); } try { webServer.stop(); } catch (Exception e) { LOG.error("Error while stopping web server for webapp " + webAppContext.getDisplayName(), e); exception = addMultiException(exception, e); } if (exception != null) { exception.ifExceptionThrow(); } } HttpServer(String name, String bindAddress, int port, boolean findPort
      );  HttpServer(String name, String bindAddress, int port,
      boolean findPort, Configuration conf, Connector connector);  HttpServer(String name, String bindAddress, int port,
      boolean findPort, Configuration conf, String[] pathSpecs);  HttpServer(String name, String bindAddress, int port,
      boolean findPort, Configuration conf);  HttpServer(String name, String bindAddress, int port,
      boolean findPort, Configuration conf, AccessControlList adminsAcl);  HttpServer(String name, String bindAddress, int port,
      boolean findPort, Configuration conf, AccessControlList adminsAcl, 
      Connector connector);  HttpServer(String name, String bindAddress, int port,
      boolean findPort, Configuration conf, AccessControlList adminsAcl, 
      Connector connector, String[] pathSpecs); Connector createBaseListener(Configuration conf); @InterfaceAudience.Private static Connector createDefaultChannelConnector(); void addContext(Context ctxt, boolean isFiltered); void setAttribute(String name, Object value); void addJerseyResourcePackage(final String packageName,
      final String pathSpec); void addServlet(String name, String pathSpec,
      Class<? extends HttpServlet> clazz); void addInternalServlet(String name, String pathSpec,
      Class<? extends HttpServlet> clazz); void addInternalServlet(String name, String pathSpec, 
      Class<? extends HttpServlet> clazz, boolean requireAuth); @Override void addFilter(String name, String classname,
      Map<String, String> parameters); @Override void addGlobalFilter(String name, String classname,
      Map<String, String> parameters); void defineFilter(Context ctx, String name,
      String classname, Map<String,String> parameters, String[] urls); Object getAttribute(String name); WebAppContext getWebAppContext(); int getPort(); void setThreads(int min, int max); @Deprecated void addSslListener(InetSocketAddress addr, String keystore,
      String storPass, String keyPass); void addSslListener(InetSocketAddress addr, Configuration sslConf,
      boolean needCertsAuth); void start(); InetSocketAddress getListenerAddress(); void stop(); void join(); boolean isAlive(); @Override String toString(); static boolean isInstrumentationAccessAllowed(
    ServletContext servletContext, HttpServletRequest request,
    HttpServletResponse response); static boolean hasAdministratorAccess(
      ServletContext servletContext, HttpServletRequest request,
      HttpServletResponse response); static boolean userHasAdministratorAccess(ServletContext servletContext,
      String remoteUser); static final Log LOG; static final String CONF_CONTEXT_ATTRIBUTE; static final String ADMINS_ACL; static final String SPNEGO_FILTER; static final String NO_CACHE_FILTER; static final String BIND_ADDRESS; }
@Test public void testHttpServerBuilderWithExternalConnector() throws Exception { Connector c = mock(Connector.class); doReturn("localhost").when(c).getHost(); HttpServer2 s = new HttpServer2.Builder().setName("test").setConnector(c) .build(); s.stop(); }