Here you can find the source of openConnection(String urlPath)
public static URLConnection openConnection(String urlPath)
//package com.java2s; //License from project: LGPL import java.io.IOException; import java.io.UncheckedIOException; import java.net.URL; import java.net.URLConnection; public class Main { public static URLConnection openConnection(String urlPath) { try {//from w w w . j a va2 s . c o m URL url = new URL(urlPath); return url.openConnection(); } catch (IOException ex) { throw new UncheckedIOException(ex); } } }