code: public void connect(URI endpoint) {
          if (endpoint.equals(this.getEndpoint()) && isListening) {
              return;
          }
  
          OkHttpClient client = new OkHttpClient.Builder()
                  .readTimeout(0, TimeUnit.MILLISECONDS)
                  .build();
          Request request = new Request.Builder()
                  .url(endpoint.toString())
                  .build();
          client.newWebSocket(request, this);
          client.dispatcher().executorService().shutdown();
  
          setEndpoint(endpoint);
      }
docs: Connects web socket client.
  
  @param endpoint The full address of an endpoint to connect to.
  Usually starts with 'ws://'.