code: @Override
      public void quit(String reason) {
          if (!connected) {
              throw new NotConnectedException();
          }
  
          Message quit = new Message(MessageType.QUIT, reason);
          ChannelFuture future = connection.send(quit);
  
          /* Wait for message to be sent and then close the underlying connection */
          future.addListener(new ChannelFutureListener() {
              @Override
              public void operationComplete(ChannelFuture future) throws Exception {
                  connection.close();
              }
          });
      }
docs: Quit from the server and close all network connections
  
  @param reason The reason for quitting as given in the QUIT message