/**
  * Returns the dir sync flags in the supplied response or -1 if no flags exists.
  *
  * @param response of a previous dir sync operation
  * @return dir sync flags or -1
  */
 protected long getDirSyncFlags(final Response<SearchResult> response) {
   long flags = -1;
   final DirSyncControl ctl = (DirSyncControl) response.getControl(DirSyncControl.OID);
   if (ctl != null) {
     flags = ctl.getFlags();
   }
   return flags;
 }
 /**
  * Returns the dir sync cookie in the supplied response or null if no cookie exists.
  *
  * @param response of a previous dir sync operation
  * @return dir sync cookie or null
  */
 protected byte[] getDirSyncCookie(final Response<SearchResult> response) {
   byte[] cookie = null;
   final DirSyncControl ctl = (DirSyncControl) response.getControl(DirSyncControl.OID);
   if (ctl != null) {
     if (ctl.getCookie() != null && ctl.getCookie().length > 0) {
       cookie = ctl.getCookie();
     }
   }
   return cookie;
 }