code: public void connect() throws DeploymentException, IOException, InterruptedException {
  		final WebSocketContainer container = ContainerProvider.getWebSocketContainer();
  		connectLatch = new CountDownLatch(1);
  		this.userSession = container.connectToServer(this, endpointURI);
  		connectLatch.await(15, TimeUnit.SECONDS);
  	}
docs: Open a new connection and wait until connection is ready
  
  @throws DeploymentException
  @throws IOException
  @throws InterruptedException