Search in sources :

Example 1 with HttpConnectorFactory

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);
}
Also used : HttpConnectorFactory(io.dropwizard.jetty.HttpConnectorFactory) Test(org.junit.Test)

Example 2 with HttpConnectorFactory

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;
}
Also used : HttpConnectorFactory(io.dropwizard.jetty.HttpConnectorFactory) DefaultServerFactory(io.dropwizard.server.DefaultServerFactory)

Aggregations

HttpConnectorFactory (io.dropwizard.jetty.HttpConnectorFactory)2 DefaultServerFactory (io.dropwizard.server.DefaultServerFactory)1 Test (org.junit.Test)1