env.put( "java.naming.security.credentials", password );
env.put( "java.naming.security.authentication", "simple" );
LdapContext ctx = new InitialLdapContext( env, null );
ctx = ctx.newInstance( null );
UnsolicitedNotificationListener listener = new DisconnectNotificationCommand();
( ( EventContext ) ctx ).addNamingListener( "", SearchControls.SUBTREE_SCOPE, listener );
System.out.println( "Listening for notifications." );
System.out.println( "Press any key to terminate." );
System.in.read();