* Test the decoding of a AddResponse with a valid LdapResult with referrals
*/
@Test
public void testDecodeAddResponseEmptyResultCodeOKReferrals()
{
Asn1Decoder ldapDecoder = new Asn1Decoder();
ByteBuffer stream = ByteBuffer.allocate( 0x24 );
stream.put( new byte[]
{ 0x30,
0x22, // LDAPMessage ::=SEQUENCE {
0x02, 0x01,
0x01, // messageID MessageID
0x69,
0x1D, // CHOICE { ..., addResponse AddResponse, ...
0x0A, 0x01,
0x0A, // resultCode success (Referral)
0x04,
0x00, // Empty matched Dn
0x04,
0x00, // Empty errorMessage
( byte ) 0xA3, 0x14, 0x04, 0x08, 'l', 'd', 'a', 'p', ':', '/', '/', '/', 0x04, 0x08, 'l', 'd', 'a',
'p', ':', '/', '/', '/' } );
String decodedPdu = Strings.dumpBytes(stream.array());
stream.flip();
// Allocate a LdapMessage Container
LdapMessageContainer<AddResponseDecorator> container = new LdapMessageContainer<AddResponseDecorator>( codec );
// Decode the AddResponse PDU
try
{
ldapDecoder.decode( stream, container );
}
catch ( DecoderException de )
{
de.printStackTrace();
fail( de.getMessage() );