code: public void connect() {
  
          readyState = ReadyState.CONNECTING;
  
          try {
              if (webSocketHandler == null) {
                  webSocketHandler = new WebSocketHandlerAdapter();
              }
  
              container.connectToServer(new SimpleWebSocketClientEndpoint(), ClientEndpointConfig.Builder.create().build(), websocketURI);
          } catch (Exception e) {
  
              readyState = ReadyState.CLOSED;
              // throws DeploymentException, IOException
              throw new RuntimeException("could not establish connection");
  
          }
      }
docs: Establishes the connection to the given WebSocket Server Address.