@Test public void testDeserializeTruncated() throws Exception { byte[] nsHeader = new byte[NeighborSolicitation.HEADER_LENGTH]; ByteBuffer.wrap(bytePacket).get(nsHeader); PacketTestUtils.testDeserializeTruncated(NeighborSolicitation.deserializer(), nsHeader); }
public static Deserializer<NeighborSolicitation> deserializer() { return (data, offset, length) -> { checkInput(data, offset, length, HEADER_LENGTH); NeighborSolicitation neighborSolicitation = new NeighborSolicitation(); ByteBuffer bb = ByteBuffer.wrap(data, offset, length); bb.getInt(); bb.get(neighborSolicitation.targetAddress, 0, Ip6Address.BYTE_LENGTH); if (bb.limit() - bb.position() > 0) { NeighborDiscoveryOptions options = NeighborDiscoveryOptions.deserializer() .deserialize(data, bb.position(), bb.limit() - bb.position()); for (NeighborDiscoveryOptions.Option option : options.options()) { neighborSolicitation.addOption(option.type(), option.data()); } } return neighborSolicitation; }; }
NeighborSolicitation extends BasePacket { public static Deserializer<NeighborSolicitation> deserializer() { return (data, offset, length) -> { checkInput(data, offset, length, HEADER_LENGTH); NeighborSolicitation neighborSolicitation = new NeighborSolicitation(); ByteBuffer bb = ByteBuffer.wrap(data, offset, length); bb.getInt(); bb.get(neighborSolicitation.targetAddress, 0, Ip6Address.BYTE_LENGTH); if (bb.limit() - bb.position() > 0) { NeighborDiscoveryOptions options = NeighborDiscoveryOptions.deserializer() .deserialize(data, bb.position(), bb.limit() - bb.position()); for (NeighborDiscoveryOptions.Option option : options.options()) { neighborSolicitation.addOption(option.type(), option.data()); } } return neighborSolicitation; }; } }
NeighborSolicitation extends BasePacket { public static Deserializer<NeighborSolicitation> deserializer() { return (data, offset, length) -> { checkInput(data, offset, length, HEADER_LENGTH); NeighborSolicitation neighborSolicitation = new NeighborSolicitation(); ByteBuffer bb = ByteBuffer.wrap(data, offset, length); bb.getInt(); bb.get(neighborSolicitation.targetAddress, 0, Ip6Address.BYTE_LENGTH); if (bb.limit() - bb.position() > 0) { NeighborDiscoveryOptions options = NeighborDiscoveryOptions.deserializer() .deserialize(data, bb.position(), bb.limit() - bb.position()); for (NeighborDiscoveryOptions.Option option : options.options()) { neighborSolicitation.addOption(option.type(), option.data()); } } return neighborSolicitation; }; }  }
NeighborSolicitation extends BasePacket { public static Deserializer<NeighborSolicitation> deserializer() { return (data, offset, length) -> { checkInput(data, offset, length, HEADER_LENGTH); NeighborSolicitation neighborSolicitation = new NeighborSolicitation(); ByteBuffer bb = ByteBuffer.wrap(data, offset, length); bb.getInt(); bb.get(neighborSolicitation.targetAddress, 0, Ip6Address.BYTE_LENGTH); if (bb.limit() - bb.position() > 0) { NeighborDiscoveryOptions options = NeighborDiscoveryOptions.deserializer() .deserialize(data, bb.position(), bb.limit() - bb.position()); for (NeighborDiscoveryOptions.Option option : options.options()) { neighborSolicitation.addOption(option.type(), option.data()); } } return neighborSolicitation; }; }  byte[] getTargetAddress(); NeighborSolicitation setTargetAddress(final byte[] targetAddress); List<NeighborDiscoveryOptions.Option> getOptions(); NeighborSolicitation 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<NeighborSolicitation> deserializer(); @Override String toString(); }
NeighborSolicitation extends BasePacket { public static Deserializer<NeighborSolicitation> deserializer() { return (data, offset, length) -> { checkInput(data, offset, length, HEADER_LENGTH); NeighborSolicitation neighborSolicitation = new NeighborSolicitation(); ByteBuffer bb = ByteBuffer.wrap(data, offset, length); bb.getInt(); bb.get(neighborSolicitation.targetAddress, 0, Ip6Address.BYTE_LENGTH); if (bb.limit() - bb.position() > 0) { NeighborDiscoveryOptions options = NeighborDiscoveryOptions.deserializer() .deserialize(data, bb.position(), bb.limit() - bb.position()); for (NeighborDiscoveryOptions.Option option : options.options()) { neighborSolicitation.addOption(option.type(), option.data()); } } return neighborSolicitation; }; }  byte[] getTargetAddress(); NeighborSolicitation setTargetAddress(final byte[] targetAddress); List<NeighborDiscoveryOptions.Option> getOptions(); NeighborSolicitation 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<NeighborSolicitation> deserializer(); @Override String toString(); static final byte HEADER_LENGTH; }