code: public Object openConnection(String endpointUri) throws ConnectionException {
          try {
              Map<String,String> params = getRequestParameters();
              if (params != null && !params.isEmpty()) {
                  StringBuffer query = new StringBuffer();
                  query.append(endpointUri.indexOf('?') < 0 ? '?' : '&');
                  int count = 0;
                  for (String name : params.keySet()) {
                      if (count > 0)
                          query.append('&');
                      String encoding = getUrlEncoding();
                      query.append(encoding == null ? name : URLEncoder.encode(name, encoding)).append("=");
                      query.append(encoding == null ? params.get(name) : URLEncoder.encode(params.get(name), encoding));
                      count++;
                  }
                  endpointUri += query;
              }
              URL url = new URL(endpointUri);
  
              HttpConnection httpConnection;
              if ("PATCH".equals(getHttpMethod()))
                  httpConnection = new HttpAltConnection(url);
              else
                  httpConnection = new HttpConnection(url);
  
              httpConnection.open();
              return httpConnection;
          }
          catch (Exception ex) {
              throw new ConnectionException(ConnectionException.CONNECTION_DOWN, ex.getMessage(), ex);
          }
      }
docs: Returns an HttpConnection based on the configured endpoint, which
  includes the resource path. Override for HTTPS or other connection type.