Here you can find the source of pingUrl(URL url)
public static void pingUrl(URL url) throws IOException
//package com.java2s; //License from project: Apache License import java.io.*; import java.net.URL; import java.net.URLConnection; public class Main { public static void pingUrl(URL url) throws IOException { URLConnection con = url.openConnection(); con.connect();/*w ww .j a v a 2 s . c o m*/ con.getInputStream().read(); } }