boolean () { try { URL url = new URL("https://www.google.com/"); URLConnection connection = url.openConnection(); connection.setConnectTimeout(1000); connection.connect(); return true; } catch (Exception e) { LOG.info("Internet connection is not available"); return false; } }