code: private void closeConnection(Session session, int guacamoleStatusCode,
              int webSocketCode) {
  
          try {
              String message = Integer.toString(guacamoleStatusCode);
              session.close(new CloseStatus(webSocketCode, message));
          }
          catch (IOException e) {
              logger.debug("Unable to close WebSocket connection.", e);
          }
  
      }
docs: Sends the given numeric Guacamole and WebSocket status
  codes on the given WebSocket connection and closes the
  connection.
  
  @param session
  The outbound WebSocket connection to close.
  
  @param guacamoleStatusCode
  The numeric Guacamole status code to send.
  
  @param webSocketCode
  The numeric WebSocket status code to send.