code: @Override
      public Session connectToServer(Class<? extends Endpoint> endpointClass, ClientEndpointConfig endpointConfig, URI path) throws DeploymentException, IOException {
  
          Object theObject = null;
  
          if (endpointClass == null || path == null) {
              throw new IllegalArgumentException();
          }
  
          if (!(Endpoint.class.isAssignableFrom(endpointClass))) {
              DeploymentException e = new DeploymentException("Class " + endpointClass.getName() + " does not extend Endpoint");
              String msg = Tr.formatMessage(tc, "client.invalid.endpointclass", endpointClass.toString(), e.getMessage());
              Tr.error(tc, "client.invalid.endpointclass", endpointClass.toString(), e.getMessage());
              throw new DeploymentException(msg, e);
          }
  
          ClientConnector x = new ClientConnector();
  
          try {
              theObject = getEndpointInstance(endpointClass);
          } catch (DeploymentException e) {
              String msg = Tr.formatMessage(tc, "client.connection.error", endpointClass.toString(), e.getMessage());
              Tr.error(tc, "client.connection.error", endpointClass.toString(), e.getMessage());
              throw new DeploymentException(msg, e);
          }
  
          return x.connectClass(theObject, path, endpointConfig, this);
      }
docs: /*
  (non-Javadoc)
  
  @see javax.websocket.WebSocketContainer#connectToServer(java.lang.Class, javax.websocket.ClientEndpointConfig, java.net.URI)