docs: @Override
      synchronized public void cleanup() {
          LOGGER.info("Cleanup the DirectorySocket.");
  
          if(task != null){
              task.toStop();
              task = null;
          }
  
          if(client != null){
              try {
                  client.stop();
              } catch (Exception e) {
                  LOGGER.warn("Close WebSocketClient get exception.", e);
              }
              client = null;
          }
  
          try {
              if(session != null){
                  session.close();
              }
          } catch (IOException e) {
              LOGGER.warn("Close the WebSocket Session get exception.", e);
          }
  
          if(sessionFuture != null){
              try {
              sessionFuture.cancel(true);
              } catch (Exception e) {
                  // do nothing
              }
          }
  
          session = null;
          sessionFuture = null;
          websocketStarted = false;
          connected = false;
          isStarted = false;
      }