@Test public void test_ARPA_V4() { NetworkInBytes networkInBytes = ArpaUtil.parseArpa("2.0.0.in-addr.arpa"); assertEquals(IpVersion.V4, networkInBytes.getIpVersion()); assertEquals("0.0.2.0", networkInBytes.getStartAddressAsString()); assertArrayEquals("", IpV4.toByteArray("0.0.2.0"), networkInBytes.getStartAddress()); assertEquals("0.0.2.255", networkInBytes.getEndAddressAsString()); assertArrayEquals("", IpV4.toByteArray("0.0.2.255"), networkInBytes.getEndAddress()); }
private void doTestArpaV6(String arpa, String expectedStartAddress, String expectedEndAddress) throws ArrayComparisonFailure { NetworkInBytes networkInBytes = ArpaUtil.parseArpa(arpa); assertEquals(IpVersion.V6, networkInBytes.getIpVersion()); assertEquals(expectedStartAddress, networkInBytes.getStartAddressAsString()); assertArrayEquals("", IpV6.toByteArray(expectedStartAddress), networkInBytes.getStartAddress()); assertEquals(expectedEndAddress, networkInBytes.getEndAddressAsString()); assertArrayEquals("", IpV6.toByteArray(expectedEndAddress), networkInBytes.getEndAddress()); }
@Test public void test_generate_ARPA() { // NetworkInBytes networkInBytes = IpUtil.parseArpa("f.f.ip6.arpa"); NetworkInBytes networkInBytes = ArpaUtil.parseArpa("1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa"); String hex1 = DatatypeConverter.printHexBinary(networkInBytes.getStartAddress()); // System.err.println("0x" + hex1); String hex2 = DatatypeConverter.printHexBinary(networkInBytes.getEndAddress()); // System.err.println("0x" + hex2); }