code: public ChannelFuture close(Channel channel, CloseWebSocketFrame frame, ChannelPromise promise) {
          if (channel == null) {
              throw new NullPointerException("channel");
          }
          return channel.writeAndFlush(frame, promise).addListener(ChannelFutureListener.CLOSE);
      }
docs: Performs the closing handshake
  
  @param channel
  Channel
  @param frame
  Closing Frame that was received
  @param promise
  the {@link ChannelPromise} to be notified when the closing handshake is done