public void test10MultipleRequests() throws Exception {
// Tests that we handle multiple requests in one OCSP request message
// An OCSP request for a certificate from an unknown CA
OCSPReqGenerator gen = new OCSPReqGenerator();
gen.addRequest(new CertificateID(CertificateID.HASH_SHA1, unknowncacert, new BigInteger("1")));
// Get user and ocspTestCert that we know...
loadUserCert(caid);
gen.addRequest(new CertificateID(CertificateID.HASH_SHA1, cacert, ocspTestCert.getSerialNumber()));
Hashtable exts = new Hashtable();
X509Extension ext = new X509Extension(false, new DEROctetString("123456789".getBytes()));
exts.put(OCSPObjectIdentifiers.id_pkix_ocsp_nonce, ext);
gen.setRequestExtensions(new X509Extensions(exts));
OCSPReq req = gen.generate();
// Send the request and receive a singleResponse
SingleResp[] singleResps = helper.sendOCSPPost(req.getEncoded(), null, 0, 200);
assertEquals("No of SingleResps should be 2.", 2, singleResps.length);
SingleResp singleResp1 = singleResps[0];
CertificateID certId = singleResp1.getCertID();
assertEquals("Serno in response does not match serno in request.", certId.getSerialNumber(), new BigInteger("1"));
Object status = singleResp1.getCertStatus();
assertTrue("Status is not Unknown", status instanceof UnknownStatus);
SingleResp singleResp2 = singleResps[1];
certId = singleResp2.getCertID();
assertEquals("Serno in response does not match serno in request.", certId.getSerialNumber(), ocspTestCert.getSerialNumber());
status = singleResp2.getCertStatus();
assertEquals("Status is not null (good)", status, null);
}