@Test public void deserialize__Bits() throws Exception { Rloc address = LispAddressSerializer.getInstance() .deserializeRloc( hexToByteBuffer( "40 03 00 00 " + // "0A 00 00 10 " + // "00 05 00 01 AA BB CC DD " + // IPv4 "00 02 00 01 11 22 33 44")); // IPv4 assertEquals(ExplicitLocatorPathLcaf.class, address.getAddressType()); ExplicitLocatorPath elp = (ExplicitLocatorPath) address.getAddress(); List<Hop> hops = elp.getExplicitLocatorPath().getHop(); assertEquals(2, hops.size()); assertEquals("170.187.204.221", String.valueOf(hops.get(0).getAddress().getValue())); assertEquals(true, hops.get(0).getLrsBits().isLookup().booleanValue()); assertEquals(false, hops.get(0).getLrsBits().isRlocProbe().booleanValue()); assertEquals(true, hops.get(0).getLrsBits().isStrict().booleanValue()); assertEquals("17.34.51.68", String.valueOf(hops.get(1).getAddress().getValue())); assertEquals(false, hops.get(1).getLrsBits().isLookup().booleanValue()); assertEquals(true, hops.get(1).getLrsBits().isRlocProbe().booleanValue()); assertEquals(false, hops.get(1).getLrsBits().isStrict().booleanValue()); }
@Test public void deserialize__NoAddresses() throws Exception { Rloc address = LispAddressSerializer.getInstance() .deserializeRloc( hexToByteBuffer( "40 03 00 00 " + // "0A 00 00 00 ")); assertEquals(ExplicitLocatorPathLcaf.class, address.getAddressType()); ExplicitLocatorPath elp = (ExplicitLocatorPath) address.getAddress(); List<Hop> hops = elp.getExplicitLocatorPath().getHop(); assertEquals(0, hops.size()); }