*/
@Test
public void testDoubleSimpleBindValid() throws Exception
{
BindResponse response1 = connection.bind( "uid=admin,ou=system", "secret" );
LdapResult ldapResult1 = response1.getLdapResult();
assertEquals( ResultCodeEnum.SUCCESS, ldapResult1.getResultCode() );
assertEquals( 1, response1.getMessageId() );
assertTrue( connection.isAuthenticated() );
// The messageId must have been incremented
BindResponse response2 = connection.bind( "uid=admin,ou=system", "secret" );
LdapResult ldapResult2 = response2.getLdapResult();
assertEquals( ResultCodeEnum.SUCCESS, ldapResult2.getResultCode() );
assertEquals( 2, response2.getMessageId() );
assertTrue( connection.isAuthenticated() );
// Now, unbind
connection.unBind();
assertFalse( connection.isAuthenticated() );
assertFalse( connection.isConnected() );
// And Bind again. The messageId should be 1
BindResponse response3 = connection.bind( "uid=admin,ou=system", "secret" );
LdapResult ldapResult3 = response3.getLdapResult();
assertEquals( ResultCodeEnum.SUCCESS, ldapResult3.getResultCode() );
assertEquals( 1, response3.getMessageId() );
assertTrue( connection.isAuthenticated() );
}