fail( de.getMessage() );
}
stream.flip();
SearchResultReference searchResultReference = ldapMessageContainer.getMessage();
assertEquals( 1, searchResultReference.getMessageId() );
Set<String> ldapUrlsSet = new HashSet<String>();
for ( int i = 0; i < ldapUrls.length; i++ )
{
ldapUrlsSet.add( Strings.utf8ToString( ldapUrls[i].getBytes() ) );
}
Referral referral = searchResultReference.getReferral();
assertNotNull( referral );
for ( String ldapUrl : referral.getLdapUrls() )
{
if ( ldapUrlsSet.contains( ldapUrl ) )
{
ldapUrlsSet.remove( ldapUrl );
}
else
{
fail( ldapUrl.toString() + " is not present" );
}
}
assertTrue( ldapUrlsSet.size() == 0 );
// Check the Control
Map<String, Control> controls = searchResultReference.getControls();
assertEquals( 1, controls.size() );
@SuppressWarnings("unchecked")
CodecControl<Control> control = ( org.apache.directory.shared.ldap.codec.api.CodecControl<Control> ) controls