@Test public void testDecodeWithUnknownSuboptions() throws Exception { final Dhcp6Options options = new Dhcp6Options(); final Test3Option option = new Test3Option(); option.setValue(22); options.add(option); final VendorSpecificInformationOption vendorSpecificInformationOption = VendorSpecificInformationOption.create( 1, options); final Test3Option test3Option = vendorSpecificInformationOption.getOptions().get(Test3Option.class); final Dhcp6Option next = vendorSpecificInformationOption.getOptions().get((short) 4).iterator().next(); assertTrue(next instanceof UnrecognizedOption); assertEquals(test3Option.getValue(), Ints.fromByteArray(next.getData())); }
public static VendorSpecificInformationOption create(@Nonnull final int enterpriseNumber, @Nonnull final Dhcp6Options options) { final VendorSpecificInformationOption iaNaOption = new VendorSpecificInformationOption(); int length = HEADER_SIZE; ByteBuffer encodedOptions = null; if (!options.isEmpty()) { encodedOptions = Dhcp6MessageEncoder.getInstance().encode(options); length += encodedOptions.limit(); } iaNaOption.setData(new byte[length]); iaNaOption.setEnterpriseNumber(enterpriseNumber); if (encodedOptions != null) { iaNaOption.setOptions(encodedOptions); } return iaNaOption; }
VendorSpecificInformationOption extends SuboptionOption { public static VendorSpecificInformationOption create(@Nonnull final int enterpriseNumber, @Nonnull final Dhcp6Options options) { final VendorSpecificInformationOption iaNaOption = new VendorSpecificInformationOption(); int length = HEADER_SIZE; ByteBuffer encodedOptions = null; if (!options.isEmpty()) { encodedOptions = Dhcp6MessageEncoder.getInstance().encode(options); length += encodedOptions.limit(); } iaNaOption.setData(new byte[length]); iaNaOption.setEnterpriseNumber(enterpriseNumber); if (encodedOptions != null) { iaNaOption.setOptions(encodedOptions); } return iaNaOption; } }
VendorSpecificInformationOption extends SuboptionOption { public static VendorSpecificInformationOption create(@Nonnull final int enterpriseNumber, @Nonnull final Dhcp6Options options) { final VendorSpecificInformationOption iaNaOption = new VendorSpecificInformationOption(); int length = HEADER_SIZE; ByteBuffer encodedOptions = null; if (!options.isEmpty()) { encodedOptions = Dhcp6MessageEncoder.getInstance().encode(options); length += encodedOptions.limit(); } iaNaOption.setData(new byte[length]); iaNaOption.setEnterpriseNumber(enterpriseNumber); if (encodedOptions != null) { iaNaOption.setOptions(encodedOptions); } return iaNaOption; }  }
VendorSpecificInformationOption extends SuboptionOption { public static VendorSpecificInformationOption create(@Nonnull final int enterpriseNumber, @Nonnull final Dhcp6Options options) { final VendorSpecificInformationOption iaNaOption = new VendorSpecificInformationOption(); int length = HEADER_SIZE; ByteBuffer encodedOptions = null; if (!options.isEmpty()) { encodedOptions = Dhcp6MessageEncoder.getInstance().encode(options); length += encodedOptions.limit(); } iaNaOption.setData(new byte[length]); iaNaOption.setEnterpriseNumber(enterpriseNumber); if (encodedOptions != null) { iaNaOption.setOptions(encodedOptions); } return iaNaOption; }  static void addDecoder(final int enterpriseNumber, final Dhcp6MessageDecoder dhcp6MessageDecoder); void setEnterpriseNumber(int enterpriseNumber); int getEnterpriseNumber(); @Override int getHeaderSize(); @Override short getTag(); @Override String toString(); static VendorSpecificInformationOption create(@Nonnull final int enterpriseNumber, @Nonnull final Dhcp6Options options); }
VendorSpecificInformationOption extends SuboptionOption { public static VendorSpecificInformationOption create(@Nonnull final int enterpriseNumber, @Nonnull final Dhcp6Options options) { final VendorSpecificInformationOption iaNaOption = new VendorSpecificInformationOption(); int length = HEADER_SIZE; ByteBuffer encodedOptions = null; if (!options.isEmpty()) { encodedOptions = Dhcp6MessageEncoder.getInstance().encode(options); length += encodedOptions.limit(); } iaNaOption.setData(new byte[length]); iaNaOption.setEnterpriseNumber(enterpriseNumber); if (encodedOptions != null) { iaNaOption.setOptions(encodedOptions); } return iaNaOption; }  static void addDecoder(final int enterpriseNumber, final Dhcp6MessageDecoder dhcp6MessageDecoder); void setEnterpriseNumber(int enterpriseNumber); int getEnterpriseNumber(); @Override int getHeaderSize(); @Override short getTag(); @Override String toString(); static VendorSpecificInformationOption create(@Nonnull final int enterpriseNumber, @Nonnull final Dhcp6Options options); static final Dhcp6MessageDecoder DEFAULT_DECODER; static final Map<Integer, Dhcp6MessageDecoder> DECODERS; }