} );
stream.flip();
// Allocate a LdapMessage Container
Asn1Container ldapMessageContainer = new LdapMessageContainer<MessageDecorator<? extends Message>>( codec );
// Decode a BindRequest PDU first block of data
try
{
ldapDecoder.decode( stream, ldapMessageContainer );
}
catch ( DecoderException de )
{
de.printStackTrace();
fail( de.getMessage() );
}
assertEquals( TLVStateEnum.LENGTH_STATE_PENDING, ldapMessageContainer.getState() );
// Second block of data
stream = ByteBuffer.allocate( 1 );
stream.put( new byte[]
{ ( byte ) 0x80 // End of the length
} );
stream.flip();
// Decode a BindRequest PDU second block of data
try
{
ldapDecoder.decode( stream, ldapMessageContainer );
}
catch ( DecoderException de )
{
de.printStackTrace();
fail( de.getMessage() );
}
assertEquals( TLVStateEnum.TAG_STATE_START, ldapMessageContainer.getState() );
// Check the decoded length
assertEquals( 384, ldapMessageContainer.getCurrentTLV().getLength() );
}