public XioServer build() {
log.debug("Building");
serverBootstrap.group(channelConfig.bossGroup(), channelConfig.workerGroup());
serverBootstrap.channel(channelConfig.channel());
final XioServerInstrumentation instrumentation = new XioServerInstrumentation();
serverBootstrap.childHandler(pipelineAssembler.build(instrumentation));
ChannelFuture future = serverBootstrap.bind();
future.awaitUninterruptibly();
if (future.isSuccess()) {
instrumentation.addressBound = (InetSocketAddress) future.channel().localAddress();
} else {
log.error("Couldn't bind channel", future.cause());
throw new RuntimeException(future.cause());
}
return new XioServer(future.channel(), instrumentation, config, state);
}
}