/** {@inheritDoc} */
  @Override
  public org.ldaptive.control.ResponseControl handleResponse(final Control responseControl) {
    org.ldaptive.control.ResponseControl ctl = null;
    if (PagedResultsControl.OID.equals(responseControl.getOid())) {
      final PagedResults c = (PagedResults) responseControl;
      ctl = new PagedResultsControl(c.getSize(), c.getCookie(), c.isCritical());
    } else if (PasswordPolicyControl.OID.equals(responseControl.getOid())) {
      final PasswordPolicy c = (PasswordPolicy) responseControl;
      if (c.hasResponse()) {
        ctl = new PasswordPolicyControl(c.isCritical());

        final PasswordPolicyResponse ppr = c.getResponse();
        ((PasswordPolicyControl) ctl).setTimeBeforeExpiration(ppr.getTimeBeforeExpiration());
        ((PasswordPolicyControl) ctl).setGraceAuthNsRemaining(ppr.getGraceAuthNRemaining());

        final PasswordPolicyErrorEnum error = ppr.getPasswordPolicyError();
        if (error != null) {
          ((PasswordPolicyControl) ctl)
              .setError(PasswordPolicyControl.Error.valueOf(error.getValue()));
        }
      }
    } else if (SyncStateControl.OID.equals(responseControl.getOid())) {
      final SyncStateValue c = (SyncStateValue) responseControl;
      ctl =
          new SyncStateControl(
              SyncStateControl.State.valueOf(c.getSyncStateType().getValue()),
              UuidType.decode(ByteBuffer.wrap(c.getEntryUUID())),
              c.getCookie(),
              c.isCritical());
    } else if (SyncDoneControl.OID.equals(responseControl.getOid())) {
      final SyncDoneValue c = (SyncDoneValue) responseControl;
      ctl = new SyncDoneControl(c.getCookie(), c.isRefreshDeletes(), c.isCritical());
    }
    return ctl;
  }
 /** {@inheritDoc} */
 @Override
 public String getOID(final Control control) {
   return control.getOid();
 }