code: public static URLConnection getUrlConnection(URL url) throws IOException {
  		URLConnection urlConnection;
  		if (hasProxy()) {
  			urlConnection = url.openConnection(proxy);
  		} else {
  			urlConnection = url.openConnection();
  		}
  		urlConnection.setRequestProperty("User-Agent", userAgent);
  		return urlConnection;
  	}
docs: Opens a basic URL connection for the given URL and performs basic
  configurations. In particular, it will set the User-Agent. The current
  proxy settings are also respected. For http(s) URLs, the result is a
  {@link HttpURLConnection}.
  
  @param url
  the URL to open
  @return the URL connection to access this URL
  @throws IOException