Example #1
0
  /** Binds this server to the address specified in the configuration. */
  private void bind() {
    SocketAddress address = getBindAddress(ServerConfig.Key.SERVER_PORT);

    logger.info("Binding to address: " + address + "...");
    ChannelFuture future = networkServer.bind(address);
    Channel channel = future.awaitUninterruptibly().channel();
    if (!channel.isActive()) {
      throw new RuntimeException("Failed to bind to address. Maybe it is already in use?");
    }
  }