public static boolean isHostName(String hostName) {

        return VALID_HOSTNAME_PATTERN.matcher(hostName).matches();
    }
@Test
    public void testValidHostname() {

        assertTrue(DnsClient.isHostName("google.com"));
        assertTrue(DnsClient.isHostName("api.graylog.com"));
        assertFalse(DnsClient.isHostName("http://api.graylog.com")); // Prefix not allowed
        assertFalse(DnsClient.isHostName("api.graylog.com/10")); // URL params not allowed
        assertFalse(DnsClient.isHostName("api.graylog.com?name=dano")); // Query strings not allowed.
    }