* non-success result code.
*/
@Test
public void testOnReferral() throws Exception
{
LDAPConnection conn = getWiredConnection( ldapServer );
LDAPConstraints constraints = new LDAPConstraints();
constraints.setReferrals( false );
conn.setConstraints( constraints );
// comparison success
LDAPAttribute attribute = new LDAPAttribute( "uid", "akarasulu" );
assertTrue( conn.compare( "uid=akarasulu,ou=users,ou=system", attribute, constraints ) );
// referrals failure
attribute = new LDAPAttribute( "uid", "akarasulu" );
LDAPResponseListener listener = null;
LDAPResponse response = null;
listener = conn.compare( "uid=akarasuluref,ou=users,ou=system", attribute, null, constraints );
response = listener.getResponse();
assertEquals( ResultCodeEnum.REFERRAL.getValue(), response.getResultCode() );
assertEquals( "ldap://localhost:10389/uid=akarasulu,ou=users,ou=system", response.getReferrals()[0] );
assertEquals( "ldap://foo:10389/uid=akarasulu,ou=users,ou=system", response.getReferrals()[1] );
assertEquals( "ldap://bar:10389/uid=akarasulu,ou=users,ou=system", response.getReferrals()[2] );
conn.disconnect();
}