public static long getTotalPendingOutboundBytes(Channel channel) {
    ChannelOutboundBuffer outboundBuffer = channel.unsafe().outboundBuffer();
    // can be null when the channel is closing
    if (outboundBuffer == null) {
      return 0;
    }
    return outboundBuffer.totalPendingWriteBytes();
  }
Get total bytes pending write to socket
hbase-common/src/main/java/org/apache/hadoop/hbase/util/NettyUnsafeUtils.java