List<Control> responseControls = internalSearch.getResponseControls();
assertNotNull(responseControls);
assertEquals(responseControls.size(), 2);
ServerSideSortResponseControl sortResponse = null;
VLVResponseControl vlvResponse = null;
for (Control c : responseControls)
{
if (c.getOID().equals(OID_SERVER_SIDE_SORT_RESPONSE_CONTROL))
{
if(c instanceof LDAPControl)
{
sortResponse = ServerSideSortResponseControl.DECODER.decode(c.isCritical(), ((LDAPControl)c).getValue());
}
else
{
sortResponse = (ServerSideSortResponseControl)c;
}
}
else if (c.getOID().equals(OID_VLV_RESPONSE_CONTROL))
{
if(c instanceof LDAPControl)
{
vlvResponse = VLVResponseControl.DECODER.decode(c.isCritical(), ((LDAPControl)c).getValue());
}
else
{
vlvResponse = (VLVResponseControl)c;
}
}
else
{
fail("Response control with unexpected OID " + c.getOID());
}
}
assertNotNull(sortResponse);
assertEquals(sortResponse.getResultCode(), 0);
assertNotNull(vlvResponse);
assertEquals(vlvResponse.getVLVResultCode(), 0);
assertEquals(vlvResponse.getTargetPosition(), 1);
assertEquals(vlvResponse.getContentCount(), 10);
}