{
fail( de.getMessage() );
}
// Check the decoded HostAddress
HostAddresses hostAddresses = ( ( HostAddressesContainer ) hostAddressesContainer ).getHostAddresses();
assertEquals( 3, hostAddresses.getAddresses().length );
String[] expected = new String[]
{ "192.168.0.1", "192.168.0.2", "192.168.0.3" };
int i = 0;
for ( HostAddress hostAddress : hostAddresses.getAddresses() )
{
assertEquals( HostAddrType.ADDRTYPE_INET, hostAddress.getAddrType() );
assertTrue( Arrays.equals( Strings.getBytesUtf8( expected[i] ), hostAddress.getAddress() ) );
i++;
}
// Check the encoding
ByteBuffer bb = ByteBuffer.allocate( hostAddresses.computeLength() );
try
{
bb = hostAddresses.encode( bb );
// Check the length
assertEquals( 0x44, bb.limit() );
String encodedPdu = Strings.dumpBytes( bb.array() );