@Test public void testDeserialize() throws DeserializationException { Redirect rd = deserializer.deserialize(bytePacket, 0, bytePacket.length); assertArrayEquals(rd.getTargetAddress(), TARGET_ADDRESS); assertArrayEquals(rd.getDestinationAddress(), DESTINATION_ADDRESS); assertThat(rd.getOptions().size(), is(1)); NeighborDiscoveryOptions.Option option = rd.getOptions().get(0); assertThat(option.type(), is(NeighborDiscoveryOptions.TYPE_TARGET_LL_ADDRESS)); assertArrayEquals(option.data(), MAC_ADDRESS.toBytes()); }
@Override public IPacket deserialize(byte[] data, int offset, int length) { final ByteBuffer bb = ByteBuffer.wrap(data, offset, length); bb.getInt(); bb.get(this.targetAddress, 0, Ip6Address.BYTE_LENGTH); bb.get(this.destinationAddress, 0, Ip6Address.BYTE_LENGTH); this.options.deserialize(data, bb.position(), bb.limit() - bb.position()); return this; }
Redirect extends BasePacket { @Override public IPacket deserialize(byte[] data, int offset, int length) { final ByteBuffer bb = ByteBuffer.wrap(data, offset, length); bb.getInt(); bb.get(this.targetAddress, 0, Ip6Address.BYTE_LENGTH); bb.get(this.destinationAddress, 0, Ip6Address.BYTE_LENGTH); this.options.deserialize(data, bb.position(), bb.limit() - bb.position()); return this; } }
Redirect extends BasePacket { @Override public IPacket deserialize(byte[] data, int offset, int length) { final ByteBuffer bb = ByteBuffer.wrap(data, offset, length); bb.getInt(); bb.get(this.targetAddress, 0, Ip6Address.BYTE_LENGTH); bb.get(this.destinationAddress, 0, Ip6Address.BYTE_LENGTH); this.options.deserialize(data, bb.position(), bb.limit() - bb.position()); return this; }  }
Redirect extends BasePacket { @Override public IPacket deserialize(byte[] data, int offset, int length) { final ByteBuffer bb = ByteBuffer.wrap(data, offset, length); bb.getInt(); bb.get(this.targetAddress, 0, Ip6Address.BYTE_LENGTH); bb.get(this.destinationAddress, 0, Ip6Address.BYTE_LENGTH); this.options.deserialize(data, bb.position(), bb.limit() - bb.position()); return this; }  byte[] getTargetAddress(); Redirect setTargetAddress(final byte[] targetAddress); byte[] getDestinationAddress(); Redirect setDestinationAddress(final byte[] destinationAddress); List<NeighborDiscoveryOptions.Option> getOptions(); Redirect addOption(final byte type, final byte[] data); @Override byte[] serialize(); @Override IPacket deserialize(byte[] data, int offset, int length); @Override int hashCode(); @Override boolean equals(final Object obj); static Deserializer<Redirect> deserializer(); @Override String toString(); }
Redirect extends BasePacket { @Override public IPacket deserialize(byte[] data, int offset, int length) { final ByteBuffer bb = ByteBuffer.wrap(data, offset, length); bb.getInt(); bb.get(this.targetAddress, 0, Ip6Address.BYTE_LENGTH); bb.get(this.destinationAddress, 0, Ip6Address.BYTE_LENGTH); this.options.deserialize(data, bb.position(), bb.limit() - bb.position()); return this; }  byte[] getTargetAddress(); Redirect setTargetAddress(final byte[] targetAddress); byte[] getDestinationAddress(); Redirect setDestinationAddress(final byte[] destinationAddress); List<NeighborDiscoveryOptions.Option> getOptions(); Redirect addOption(final byte type, final byte[] data); @Override byte[] serialize(); @Override IPacket deserialize(byte[] data, int offset, int length); @Override int hashCode(); @Override boolean equals(final Object obj); static Deserializer<Redirect> deserializer(); @Override String toString(); static final byte HEADER_LENGTH; }