@Test public void testSerialize() { RouterSolicitation rs = new RouterSolicitation(); rs.addOption(NeighborDiscoveryOptions.TYPE_TARGET_LL_ADDRESS, MAC_ADDRESS1.toBytes()); assertArrayEquals(rs.serialize(), bytePacket); }
@Override public byte[] serialize() { byte[] optionsData = null; if (this.options.hasOptions()) { optionsData = this.options.serialize(); } int optionsLength = 0; if (optionsData != null) { optionsLength = optionsData.length; } final byte[] data = new byte[HEADER_LENGTH + optionsLength]; final ByteBuffer bb = ByteBuffer.wrap(data); bb.putInt(0); if (optionsData != null) { bb.put(optionsData); } return data; }
RouterSolicitation extends BasePacket { @Override public byte[] serialize() { byte[] optionsData = null; if (this.options.hasOptions()) { optionsData = this.options.serialize(); } int optionsLength = 0; if (optionsData != null) { optionsLength = optionsData.length; } final byte[] data = new byte[HEADER_LENGTH + optionsLength]; final ByteBuffer bb = ByteBuffer.wrap(data); bb.putInt(0); if (optionsData != null) { bb.put(optionsData); } return data; } }
RouterSolicitation extends BasePacket { @Override public byte[] serialize() { byte[] optionsData = null; if (this.options.hasOptions()) { optionsData = this.options.serialize(); } int optionsLength = 0; if (optionsData != null) { optionsLength = optionsData.length; } final byte[] data = new byte[HEADER_LENGTH + optionsLength]; final ByteBuffer bb = ByteBuffer.wrap(data); bb.putInt(0); if (optionsData != null) { bb.put(optionsData); } return data; }  }
RouterSolicitation extends BasePacket { @Override public byte[] serialize() { byte[] optionsData = null; if (this.options.hasOptions()) { optionsData = this.options.serialize(); } int optionsLength = 0; if (optionsData != null) { optionsLength = optionsData.length; } final byte[] data = new byte[HEADER_LENGTH + optionsLength]; final ByteBuffer bb = ByteBuffer.wrap(data); bb.putInt(0); if (optionsData != null) { bb.put(optionsData); } return data; }  List<NeighborDiscoveryOptions.Option> getOptions(); RouterSolicitation 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<RouterSolicitation> deserializer(); @Override String toString(); }
RouterSolicitation extends BasePacket { @Override public byte[] serialize() { byte[] optionsData = null; if (this.options.hasOptions()) { optionsData = this.options.serialize(); } int optionsLength = 0; if (optionsData != null) { optionsLength = optionsData.length; } final byte[] data = new byte[HEADER_LENGTH + optionsLength]; final ByteBuffer bb = ByteBuffer.wrap(data); bb.putInt(0); if (optionsData != null) { bb.put(optionsData); } return data; }  List<NeighborDiscoveryOptions.Option> getOptions(); RouterSolicitation 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<RouterSolicitation> deserializer(); @Override String toString(); static final byte HEADER_LENGTH; }