ConnectorFactory { public ServerConnector createConnector(final Metric metric, final Server server) { ServerConnector connector = new JDiscServerConnector( connectorConfig, metric, server, createConnectionFactories(metric).toArray(ConnectionFactory[]::new)); connector.setPort(connectorConfig.listenPort()); connector.setName(connectorConfig.name()); connector.setAcceptQueueSize(connectorConfig.acceptQueueSize()); connector.setReuseAddress(connectorConfig.reuseAddress()); connector.setIdleTimeout((long)(connectorConfig.idleTimeout() * 1000.0)); return connector; } @Inject  ConnectorFactory(ConnectorConfig connectorConfig,
                            SslContextFactoryProvider sslContextFactoryProvider); ConnectorConfig getConnectorConfig(); ServerConnector createConnector(final Metric metric, final Server server);  }
@Test public void requireThatServerCanBindChannel() throws Exception { Server server = new Server(); try { ConnectorConfig config = new ConnectorConfig(new ConnectorConfig.Builder()); ConnectorFactory factory = createConnectorFactory(config); JDiscServerConnector connector = (JDiscServerConnector)factory.createConnector(new DummyMetric(), server); server.addConnector(connector); server.setHandler(new HelloWorldHandler()); server.start(); SimpleHttpClient client = new SimpleHttpClient(null, connector.getLocalPort(), false); SimpleHttpClient.RequestExecutor ex = client.newGet("/blaasdfnb"); SimpleHttpClient.ResponseValidator val = ex.execute(); val.expectContent(equalTo("Hello world")); } finally { try { server.stop(); } catch (Exception e) { } } }