list.close();
// Now read the next ones
javax.naming.ldap.Control[] responseControls = ( ( LdapContext ) ctx ).getResponseControls();
PagedResultsResponseControl responseControl =
( PagedResultsResponseControl ) responseControls[0];
assertEquals( 0, responseControl.getResultSize() );
// check if this is over
byte[] cookie = responseControl.getCookie();
if ( Strings.isEmpty( cookie ) )
{
// If so, exit the loop
break;
}
// Prepare the next iteration, sending a bad cookie
createNextSearchControls( ctx, responseControl.getCookie(), 4 - loop );
assertEquals( expectedSize[loop - 1], results.size() );
}
assertEquals( 4, loop );