public void testSimpleBindAnonymous() throws Exception
{
getLdapServer().getDirectoryService().setAllowAnonymousAccess( true );
//System.out.println( "------------------Create connection" + i + "-------------" );
LdapConnection connection = new LdapNetworkConnection( "localhost", getLdapServer().getPort() );
//System.out.println( "------------------Bind" + i + "-------------" );
// Try with no parameters
connection.anonymousBind();
assertTrue( connection.isAuthenticated() );
//System.out.println( "----------------Unbind" + i + "-------------" );
connection.unBind();
assertFalse( connection.isConnected() );
connection.close();
// Try with empty strings
connection = new LdapNetworkConnection( "localhost", getLdapServer().getPort() );
connection.bind( "", "" );
assertTrue( connection.isAuthenticated() );
connection.unBind();
assertFalse( connection.isConnected() );
connection.close();
// Try with null parameters
connection = new LdapNetworkConnection( "localhost", getLdapServer().getPort() );
connection.bind( ( String ) null, ( String ) null );
assertTrue( connection.isAuthenticated() );
assertTrue( connection.isConnected() );
connection.unBind();
assertFalse( connection.isConnected() );
connection.close();
connection = new LdapNetworkConnection( "localhost", getLdapServer().getPort() );
//System.out.println( "----------------Unbind done" + i + "-------------" );
assertFalse( connection.isConnected() );
connection.close();
//System.out.println( "----------------Unconnected" + i + "-------------" );
}