@Test public void testDecode() throws Exception { final String ip = "10.0.1.1"; final String testValue = "test1"; final Dhcp6Options options = new Dhcp6Options(); final Test1Option option = new Test1Option(); option.setString(testValue); options.add(option); final Test2Option option2 = new Test2Option(); option2.setAddress(ip); options.add(option2); final VendorSpecificInformationOption vendorSpecificInformationOption = VendorSpecificInformationOption.create( 1, options); final Test1Option test1Option = vendorSpecificInformationOption.getOptions().get(Test1Option.class); assertNotNull(test1Option); assertEquals(testValue, test1Option.getString()); assertEquals(1, Iterables.size(vendorSpecificInformationOption.getOptions().getAll(Test1Option.class))); assertEquals(1, Iterables.size(vendorSpecificInformationOption.getOptions().get(((short) 10)))); final Test2Option test2Option = vendorSpecificInformationOption.getOptions().get(Test2Option.class); assertNotNull(test2Option); assertEquals(InetAddress.getByName(ip), test2Option.getAddress()); assertTrue(Iterables.isEmpty(vendorSpecificInformationOption.getOptions().get(((short) 99)))); }
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; }