ciao valia.

in realtà ho solo cambiato indirizzo levando http:// ed ha funzionato.
codice:
public class CheckConnection {

    public static boolean check() throws IOException {
        String site = "www.google.it";
        try (Socket socket = new Socket()) {
            InetSocketAddress addr = new InetSocketAddress(site, 80);
            socket.connect(addr, 3000);
            return socket.isConnected();
        }
    }
}
non saprei dare una spiegazione!