use of com.hotels.styx.server.netty.NettyServerBuilder in project styx by ExpediaGroup.
the class AdminServerBuilder method build.
public InetServer build() {
LOG.debug("event bus that will be used is {}", environment.eventBus());
StyxConfig styxConfig = environment.configuration();
AdminServerConfig adminServerConfig = styxConfig.adminServerConfig();
NettyExecutor bossExecutor = NettyExecutor.create("Admin-Boss", adminServerConfig.bossThreadsCount());
NettyExecutor workerExecutor = NettyExecutor.create("Admin-Worker", adminServerConfig.workerThreadsCount());
NettyServerBuilder builder = NettyServerBuilder.newBuilder().setMetricsRegistry(environment.metricRegistry()).bossExecutor(bossExecutor).workerExecutor(workerExecutor).handler(adminEndpoints(styxConfig, startupConfig)).shutdownAction(() -> {
bossExecutor.shut();
workerExecutor.shut();
});
// Currently admin server cannot be started over TLS protocol.
// This appears to be an existing issue that needs rectifying.
adminServerConfig.httpConnectorConfig().ifPresent(it -> builder.setProtocolConnector(new WebServerConnectorFactory().create(it)));
return builder.build();
}
use of com.hotels.styx.server.netty.NettyServerBuilder in project styx by ExpediaGroup.
the class StyxProxyTest method startsAndStopsAServer.
@Test
public void startsAndStopsAServer() {
Service server = StyxServers.toGuavaService(new NettyServerBuilder().setProtocolConnector(connector(0)).bossExecutor(NettyExecutor.create("Test-Server-Boss", 1)).workerExecutor(NettyExecutor.create("Test-Server-Worker", 0)).build());
server.startAsync().awaitRunning();
assertThat("Server should be running", server.isRunning());
server.stopAsync().awaitTerminated();
assertThat("Server should not be running", !server.isRunning());
}
Aggregations