*/
public void test18NextUpdateThisUpdate() throws Exception {
final X509Certificate ocspTestCert = getTestCert(false);
// And an OCSP request
OCSPReqGenerator gen = new OCSPReqGenerator();
gen.addRequest(new CertificateID(CertificateID.HASH_SHA1, cacert, ocspTestCert.getSerialNumber()));
OCSPReq req = gen.generate();
// POST the request and receive a singleResponse
URL url = new URL(httpReqPath + '/' + resourceOcsp);
HttpURLConnection con = (HttpURLConnection) url.openConnection();
con.setDoOutput(true);
con.setRequestMethod("POST");
con.setRequestProperty("Content-Type", "application/ocsp-request");
OutputStream os = con.getOutputStream();
os.write(req.getEncoded());
os.close();
assertEquals("Response code", 200, con.getResponseCode());
// Some appserver (Weblogic) responds with
// "application/ocsp-response; charset=UTF-8"
assertNotNull(con.getContentType());
assertTrue(con.getContentType().startsWith("application/ocsp-response"));
OCSPResp response = new OCSPResp(new ByteArrayInputStream(OcspJunitHelper.inputStreamToBytes(con.getInputStream())));
assertEquals("Response status not the expected.", 0, response.getStatus());
BasicOCSPResp brep = (BasicOCSPResp) response.getResponseObject();
X509Certificate[] chain = brep.getCerts("BC");
boolean verify = brep.verify(chain[0].getPublicKey(), "BC");
assertTrue("Response failed to verify.", verify);
SingleResp[] singleResps = brep.getResponses();
assertEquals("No of SingResps should be 1.", 1, singleResps.length);
CertificateID certId = singleResps[0].getCertID();
assertEquals("Serno in response does not match serno in request.", certId.getSerialNumber(), ocspTestCert.getSerialNumber());
assertNull("Status is not null.", singleResps[0].getCertStatus());
Date thisUpdate = singleResps[0].getThisUpdate();
Date nextUpdate = singleResps[0].getNextUpdate();
Date producedAt = brep.getProducedAt();
assertNotNull("thisUpdate was not set.", thisUpdate);