// Bind as the user
LdapConnection anonymousConnection = getAnonymousNetworkConnection( getLdapServer() );
anonymousConnection.setTimeOut( 0L );
// Now change the password
PwdModifyRequestImpl pwdModifyRequest = new PwdModifyRequestImpl();
pwdModifyRequest.setUserIdentity( Strings.getBytesUtf8( "cn=User2,ou=system" ) );
pwdModifyRequest.setOldPassword( Strings.getBytesUtf8( "secret2" ) );
pwdModifyRequest.setNewPassword( Strings.getBytesUtf8( "secret2Bis" ) );
// Send the request
PwdModifyResponse pwdModifyResponse = ( PwdModifyResponse ) anonymousConnection.extended( pwdModifyRequest );
assertEquals( ResultCodeEnum.SUCCESS, pwdModifyResponse.getLdapResult().getResultCode() );