LdapConnection connection = getAdminConnection();
Dn adminDn = new Dn( "uid=admin,ou=system" );
ModifyRequest modReq = new ModifyRequestImpl();
modReq.setName( adminDn );
String newPwd = "replaced";
modReq.replace( SchemaConstants.USER_PASSWORD_AT, newPwd );
connection.modify( modReq );
connection.close();
connection = getConnectionAs( adminDn, newPwd );
Entry entry = connection.lookup( adminDn.getName() );