code: private void checkCloseConnection(ChannelFuture future) {
          // If this connection is closing and the graceful shutdown has completed, close the connection
          // once this operation completes.
          if (closeListener != null && isGracefulShutdownComplete()) {
              ChannelFutureListener closeListener = this.closeListener;
              // This method could be called multiple times
              // and we don't want to notify the closeListener multiple times.
              this.closeListener = null;
              try {
                  closeListener.operationComplete(future);
              } catch (Exception e) {
                  throw new IllegalStateException("Close listener threw an unexpected exception", e);
              }
          }
      }
docs: Closes the connection if the graceful shutdown process has completed.
  @param future Represents the status that will be passed to the {@link #closeListener}.