use of io.dropwizard.jetty.HttpConnectorFactory in project dropwizard by dropwizard.
the class SimpleServerFactoryTest method testGetPort.
@Test
public void testGetPort() {
final HttpConnectorFactory connector = (HttpConnectorFactory) http.getConnector();
assertThat(connector.getPort()).isEqualTo(0);
}
use of io.dropwizard.jetty.HttpConnectorFactory in project helios by spotify.
the class ServiceUtil method createServerFactory.
public static DefaultServerFactory createServerFactory(final InetSocketAddress httpEndpoint, final InetSocketAddress adminEndpoint, final boolean noHttp) {
final DefaultServerFactory serverFactory = new DefaultServerFactory();
if (noHttp) {
serverFactory.setApplicationConnectors(Collections.<ConnectorFactory>emptyList());
serverFactory.setAdminConnectors(Collections.<ConnectorFactory>emptyList());
} else {
final HttpConnectorFactory serviceConnector = new HttpConnectorFactory();
serviceConnector.setPort(httpEndpoint.getPort());
serviceConnector.setBindHost(httpEndpoint.getHostString());
serverFactory.setApplicationConnectors(ImmutableList.<ConnectorFactory>of(serviceConnector));
final HttpConnectorFactory adminConnector = new HttpConnectorFactory();
adminConnector.setPort(adminEndpoint.getPort());
adminConnector.setBindHost(adminEndpoint.getHostString());
serverFactory.setAdminConnectors(ImmutableList.<ConnectorFactory>of(adminConnector));
}
return serverFactory;
}
Aggregations