@Test public void testIpV6MatcherWithIpV4() throws UnknownHostException { netMatcher = new NetMatcher(DNSFixture.LOCALHOST_IP_V6_ADDRESSES, DNSFixture.DNS_SERVER_IPV6_MOCK); assertThat(netMatcher.matchInetNetwork("127.0.0.1")).isFalse(); assertThat(netMatcher.matchInetNetwork("localhost")).isFalse(); assertThat(netMatcher.matchInetNetwork("172.16.15.254")).isFalse(); assertThat(netMatcher.matchInetNetwork("192.168.1.254")).isFalse(); assertThat(netMatcher.matchInetNetwork("192.169.1.254")).isFalse(); }
public boolean matchInetNetwork(String hostIP) { InetAddress ip; try { ip = dnsServer.getByName(hostIP); } catch (UnknownHostException uhe) { LOGGER.info("Cannot resolve address for {}: {}", hostIP, uhe.getMessage()); return false; } return matchInetNetwork(ip); }
NetMatcher { public boolean matchInetNetwork(String hostIP) { InetAddress ip; try { ip = dnsServer.getByName(hostIP); } catch (UnknownHostException uhe) { LOGGER.info("Cannot resolve address for {}: {}", hostIP, uhe.getMessage()); return false; } return matchInetNetwork(ip); } }
NetMatcher { public boolean matchInetNetwork(String hostIP) { InetAddress ip; try { ip = dnsServer.getByName(hostIP); } catch (UnknownHostException uhe) { LOGGER.info("Cannot resolve address for {}: {}", hostIP, uhe.getMessage()); return false; } return matchInetNetwork(ip); } NetMatcher(String[] nets, DNSService dnsServer);  NetMatcher(Collection<String> nets, DNSService dnsServer);  NetMatcher(String commaSeparatedNets, DNSService dnsServer); }
NetMatcher { public boolean matchInetNetwork(String hostIP) { InetAddress ip; try { ip = dnsServer.getByName(hostIP); } catch (UnknownHostException uhe) { LOGGER.info("Cannot resolve address for {}: {}", hostIP, uhe.getMessage()); return false; } return matchInetNetwork(ip); } NetMatcher(String[] nets, DNSService dnsServer);  NetMatcher(Collection<String> nets, DNSService dnsServer);  NetMatcher(String commaSeparatedNets, DNSService dnsServer); boolean matchInetNetwork(String hostIP); boolean matchInetNetwork(InetAddress ip); @Override String toString(); }
NetMatcher { public boolean matchInetNetwork(String hostIP) { InetAddress ip; try { ip = dnsServer.getByName(hostIP); } catch (UnknownHostException uhe) { LOGGER.info("Cannot resolve address for {}: {}", hostIP, uhe.getMessage()); return false; } return matchInetNetwork(ip); } NetMatcher(String[] nets, DNSService dnsServer);  NetMatcher(Collection<String> nets, DNSService dnsServer);  NetMatcher(String commaSeparatedNets, DNSService dnsServer); boolean matchInetNetwork(String hostIP); boolean matchInetNetwork(InetAddress ip); @Override String toString(); static final String NETS_SEPARATOR; }