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 testHostAllowed() throws URISyntaxException {
        Assert.assertTrue(hostWhitelist.isHostAllowed(new URI("http://192.168.0.1")));
        Assert.assertTrue(hostWhitelist.isHostAllowed(new URI("http://10.1.2.3:8543")));
        Assert.assertTrue(hostWhitelist.isHostAllowed(new URI("https://192.168.0.10:8765")));
    }