private HttpURLConnection createConnection() {
    try {
      final HttpURLConnection connection;
      if (httpProxyHost != null)
        connection = CONNECTION_FACTORY.create(url, createProxy());
      else
        connection = CONNECTION_FACTORY.create(url);
      connection.setRequestMethod(requestMethod);
      return connection;
    } catch (IOException e) {
      throw new HttpRequestException(e);
    }
  }
Create HTTP connection wrapper

@param url Remote resource URL.
@param method HTTP request method (e.g., "GET", "POST").
@throws HttpRequestException
lib/src/main/java/com/github/kevinsawicki/http/HttpRequest.java