private void close0() throws IOException {
    if (!live) {
      return;
    }
    live = false;

    if (socketChannel != null && socketChannel.isOpen()) {
      readHandler.shutdown();
      writeHandler.shutdown();
      socketChannel.close();
    }
  }
  TcpIpConnection newConnection(SocketChannelWrapper channel, Address endpoint) {
    TcpIpConnection connection =
        new TcpIpConnection(this, connectionIdGen.incrementAndGet(), channel, ioThreadingModel);

    connection.setEndPoint(endpoint);
    activeConnections.add(connection);
    acceptedSockets.remove(channel);

    connection.start();
    ioThreadingModel.onConnectionAdded(connection);

    logger.info(
        "Established socket connection between "
            + channel.socket().getLocalSocketAddress()
            + " and "
            + channel.socket().getRemoteSocketAddress());
    openedCount.inc();

    return connection;
  }
 Object getConnectionAddress() {
   return (endPoint == null) ? socketChannel.socket().getRemoteSocketAddress() : endPoint;
 }
 @Override
 public InetSocketAddress getRemoteSocketAddress() {
   return (InetSocketAddress) socketChannel.socket().getRemoteSocketAddress();
 }
 @Override
 public int getPort() {
   return socketChannel.socket().getPort();
 }
 @Override
 public InetAddress getInetAddress() {
   return socketChannel.socket().getInetAddress();
 }