code: public void connect() throws Exception {
          logger.debug("[connect] initializing new connection");
  
          synchronized (webSocketHandler.getNotifyConnectionObject()) {
              webSocketConnectionManager.start();
  
              try {
                  webSocketHandler.getNotifyConnectionObject().wait(TimeUnit.SECONDS.toMillis(WEBSOCKET_TIMEOUT));
              }
              catch (InterruptedException e) {
                  throw new Exception("websocket connection not open");
              }
  
              if (!isConnected()) {
                  throw new Exception("websocket connection timeout (uri = " + uriTemplate + ")");
              }
          }
      }
docs: Initiate connection to Neo4j server.
  @throws Exception connection could not be established