public boolean matches(@Nullable final String hostOrIp) {
        if (pattern == null) {
            LOG.debug("No proxy host pattern defined");
            return false;
        }
        if (isNullOrEmpty(hostOrIp)) {
            LOG.debug("Host or IP address <{}> doesn't match <{}>", hostOrIp, noProxyHosts);
            return false;
        }

        if (pattern.matcher(hostOrIp.toLowerCase(Locale.ROOT)).matches()) {
            LOG.debug("Host or IP address <{}> matches <{}>", hostOrIp, noProxyHosts);
            return true;
        } else {
            LOG.debug("Host or IP address <{}> doesn't match <{}>", hostOrIp, noProxyHosts);
            return false;
        }
    }
@Test
    public void matches() {
        assertPattern(null, "127.0.0.1").isFalse();
        assertPattern("", "127.0.0.1").isFalse();
        assertPattern(",,", "127.0.0.1").isFalse();

        assertPattern("127.0.0.1", "127.0.0.1").isTrue();
        assertPattern("127.0.0.1", "127.0.0.2").isFalse();
        assertPattern("127.0.0.*", "127.0.0.1").isTrue();
        assertPattern("127.0.*", "127.0.0.1").isTrue();
        assertPattern("127.0.*,10.0.0.*", "127.0.0.1").isTrue();

        assertPattern("node0.graylog.example.com", "node0.graylog.example.com").isTrue();
        assertPattern("node0.graylog.example.com", "node1.graylog.example.com").isFalse();
        assertPattern("*.graylog.example.com", "node0.graylog.example.com").isTrue();
        assertPattern("*.graylog.example.com", "node1.graylog.example.com").isTrue();
        assertPattern("node0.graylog.example.*", "node0.GRAYLOG.example.com").isTrue();
        assertPattern("node0.graylog.example.*,127.0.0.1,*.graylog.example.com", "node1.graylog.example.com").isTrue();

        // Wildcard is only supported at beginning or end of the pattern
        assertPattern("127.0.*.1", "127.0.0.1").isFalse();
        assertPattern("node0.*.example.com", "node0.graylog.example.com").isFalse();
        assertPattern("*.0.0.*", "127.0.0.1").isFalse();
    }