public static void closeImmediately(Channel channel) {
    assert channel.eventLoop().inEventLoop();
    channel.config().setOption(ChannelOption.SO_LINGER, 0);
    channel.unsafe().close(channel.voidPromise());
  }
Directly closes the channel, setting SO_LINGER to 0 and skipping any handlers in the pipeline.
This is useful for cases where it's important to immediately close without any delay.
Otherwise, pipeline handlers and even general TCP flows can cause a normal close to take
upwards of a few second or more. This will likely cause the client side to see either a
"Connection reset by peer" or unexpected ConnectionClosedException.
<p>
<b>It's necessary to call this from within the channel's eventLoop!</b>
hbase-common/src/main/java/org/apache/hadoop/hbase/util/NettyUnsafeUtils.java