public boolean isHostAllowed(URI serviceUri) {
        if (serviceUri != null) {
            List<String> hostWhitelist = config.getHostWhitelist();
            if (hostWhitelist == null || hostWhitelist.size() == 0) {
                throw new ConfigException("No whitelist defined to allow the route to " + serviceUri);
            }
            String host = serviceUri.getHost();
            return hostWhitelist.stream().anyMatch(
                    hostRegEx -> host != null && host.matches(hostRegEx));
        } else {
            return false;
        }
    }
@Test
    public void testHostNotAllowed() throws URISyntaxException {
        Assert.assertFalse(hostWhitelist.isHostAllowed(new URI("http://192.168.2.1")));
        Assert.assertFalse(hostWhitelist.isHostAllowed(new URI("http2://10.2.3.4:8643")));
        Assert.assertFalse(hostWhitelist.isHostAllowed(new URI("https://192.168.1.20:7654")));
    }