userConnection2 = new LdapNetworkConnection( "localhost", ldapServer.getPort() );
userConnection2.setTimeOut( 0L );
addUser( adminConnection, userCn, password );
BindRequest bindReq = new BindRequestImpl();
bindReq.setDn( userDn );
bindReq.setCredentials( "12345" );
bindReq.addControl( PP_REQ_CTRL );
BindResponse bindResponse = userConnection2.bind( bindReq );
PasswordPolicy respCtrl = getPwdRespCtrl( bindResponse );
assertNotNull( respCtrl );
assertNull( respCtrl.getResponse() );
// now modify change time
ModifyRequest modifyRequest = new ModifyRequestImpl();
modifyRequest.setName( userDn );
modifyRequest.replace( "pwdChangedTime", DateUtils.getGeneralizedTime( new Date().getTime() - 3100000 ) );
adminConnection.modify( modifyRequest );
BindRequest bindReq2 = new BindRequestImpl();
bindReq2.setDn( userDn );
bindReq2.setCredentials( "12345" );
bindReq2.addControl( new PasswordPolicyImpl() );
bindResponse = userConnection.bind( bindReq2 );
respCtrl = getPwdRespCtrl( bindResponse );
assertNotNull( respCtrl );
assertNotNull( respCtrl.getResponse() );
assertTrue( respCtrl.getResponse().getTimeBeforeExpiration() > 0 );