import java.io.IOException;
import java.net.*;

public class ServerResponse {

	public static void response(URL url) throws IOException {

		HttpURLConnection connection = (HttpURLConnection) url.openConnection();
	}

}
package com.complet;

import java.io.IOException;
import java.net.*;

public class ServerResponse {

	public static void response(URL url) throws IOException {

		HttpURLConnection connection = (HttpURLConnection) url.openConnection();

		try {

			connection.connect();

		} catch (Exception exp) {

		    System.err.println(exp.getMessage());

		}
	}

}
Call the connect method -of HttpUrlConnection Class- to initiate the connection, catch exceptions, define the package