public static boolean isIp4Address(String ipAddress) {

        try {
            final InetAddress address = InetAddresses.forString(ipAddress);
            if (address instanceof Inet4Address) {
                return true;
            }
        } catch (IllegalArgumentException e) {
            // Absorb exception.
        }

        return false;
    }
@Test
    public void testValidIp4Address() {

        assertTrue(DnsClient.isIp4Address("8.8.8.8"));
        assertTrue(DnsClient.isIp4Address("127.0.0.1"));
        assertFalse(DnsClient.isIp4Address("t127.0.0.1"));
        assertFalse(DnsClient.isIp4Address("google.com"));
    }