catch ( DecoderException de )
{
fail( de.getMessage() );
}
AuthorizationData authData = authDataContainer.getAuthorizationData();
assertNotNull( authData.getAuthorizationData().size() );
assertEquals( 2, authData.getAuthorizationData().size() );
String[] expected = new String[]{ "abcdef", "ghi" };
int i = 0;
for ( AuthorizationDataEntry ad : authData.getAuthorizationData() )
{
assertEquals( AuthorizationType.AD_INTENDED_FOR_SERVER, ad.getAdType() );
assertTrue( Arrays.equals( Strings.getBytesUtf8(expected[i++]), ad.getAdData() ) );
}
// Check the encoding
ByteBuffer bb = ByteBuffer.allocate( authData.computeLength() );
try
{
bb = authData.encode( bb );
// Check the length
assertEquals( 0x21, bb.limit() );
String encodedPdu = Strings.dumpBytes(bb.array());