### Question:
JettyHTTPServerEngine implements ServerEngine { public void setConnector(Connector c) { connector = c; } JettyHTTPServerEngine(
        Container.Listener mBeanContainer,
        String host,
        int port);  JettyHTTPServerEngine(); void setThreadPool(ThreadPool p); void setPort(int p); void setHost(String host); void setContinuationsEnabled(boolean enabled); boolean getContinuationsEnabled(); String getProtocol(); int getPort(); String getHost(); void shutdown(); Server getServer(); void setServer(Server s); void setConnector(Connector c); void setHandlers(List<Handler> h); void setSessionSupport(boolean support); boolean isSessionSupport(); List<Handler> getHandlers(); Connector getConnector(); boolean isReuseAddress(); void setReuseAddress(boolean reuse); int getMaxIdleTime(); void setMaxIdleTime(int maxIdle); synchronized void addServant(URL url, JettyHTTPHandler handler); synchronized void removeServant(URL url); synchronized Handler getServant(URL url); synchronized ContextHandler getContextHandler(URL url); @PostConstruct void finalizeConfig(); void setTlsServerParameters(TLSServerParameters params); TLSServerParameters getTlsServerParameters(); void setThreadingParameters(ThreadingParameters params); boolean isSetThreadingParameters(); ThreadingParameters getThreadingParameters(); void setSendServerVersion(Boolean sendServerVersion); Boolean getSendServerVersion(); int getSessionTimeout(); void setSessionTimeout(int sessionTimeout); static final String DO_NOT_CHECK_URL_PROP; }### Answer:
@Test public void testSetConnector() throws Exception { URL url = new URL("http: JettyHTTPTestHandler handler1 = new JettyHTTPTestHandler("string1", true); JettyHTTPTestHandler handler2 = new JettyHTTPTestHandler("string2", true); JettyHTTPServerEngine engine = new JettyHTTPServerEngine(); engine.setPort(PORT4); Server server = new Server(); ServerConnector connector = new ServerConnector(server); connector.setPort(PORT4); HttpConfiguration httpConfig = new HttpConfiguration(); httpConfig.addCustomizer(new org.eclipse.jetty.server.ForwardedRequestCustomizer()); HttpConnectionFactory httpFactory = new HttpConnectionFactory(httpConfig); Collection<ConnectionFactory> connectionFactories = new ArrayList<>(); connectionFactories.add(httpFactory); connector.setConnectionFactories(connectionFactories); engine.setConnector(connector); List<Handler> handlers = new ArrayList<>(); handlers.add(handler1); engine.setHandlers(handlers); engine.finalizeConfig(); engine.addServant(url, handler2); String response = null; try { response = getResponse(url.toString()); assertEquals("the jetty http handler1 did not take effect", response, "string1string2"); } catch (Exception ex) { fail("Can't get the reponse from the server " + ex); } engine.stop(); JettyHTTPServerEngineFactory.destroyForPort(PORT4); }