code: private void connect() {
          try {
              URL url = new URL(this.endpoint);
              connection = (HttpURLConnection) url.openConnection();
              connection.setReadTimeout(this.readTimeoutMs);
              connection.setConnectTimeout(this.connectTimeoutMs);
              connection.setRequestMethod(this.method.name());
              if (method == HttpMethod.POST || method == HttpMethod.PUT) {
                  connection.setDoOutput(true);
              } else {
                  connection.setDoOutput(false);
              }
              connection.setDoInput(true);
              connection.setUseCaches(false);
              for (String headerName : headers.keySet()) {
                  String headerValue = headers.get(headerName);
                  connection.setRequestProperty(headerName, headerValue);
              }
              connection.connect();
          } catch (Exception e) {
              throw new RuntimeException(e);
          }
      }
docs: Connect to the remote server.