public static void closeChannel(Channel channel) {
   final String addrRemote = RemotingHelper.parseChannelRemoteAddr(channel);
   channel
       .close()
       .addListener(
           new ChannelHandlerListener() {
             @Override
             public void operationComplete(Future future) throws Exception {
               LOGGER.info(
                   "closeChannel: close the connection to remote address[{}] result: {}",
                   addrRemote,
                   future.isSuccess());
             }
           });
 }
  public static String parseChannelRemoteAddr(final Channel channel) {
    if (null == channel) {
      return "";
    }
    final SocketAddress remote = channel.remoteAddress();
    final String addr = remote != null ? remote.toString() : "";

    if (addr.length() > 0) {
      int index = addr.lastIndexOf("/");
      if (index >= 0) {
        return addr.substring(index + 1);
      }

      return addr;
    }

    return "";
  }