question: static OCSPResponse check ( List < CertId > certIds , URI responderURI , X509Certificate issuerCert , X509Certificate responderCert , Date date , List < Extension > extensions ) throws IOException , CertPathValidatorException { byte [ ] bytes = null ; OCSPRequest request = null ; try { request = new OCSPRequest ( certIds , extensions ) ; bytes = request . encodeBytes ( ) ; } catch ( IOException ioe ) { throw new CertPathValidatorException ( "Exception while encoding OCSPRequest" , ioe ) ; } InputStream in = null ; OutputStream out = null ; byte [ ] response = null ; try { URL url = responderURI . toURL ( ) ; if ( debug != null ) { debug . println ( "connecting to OCSP service at: " + url ) ; } HttpURLConnection con = ( HttpURLConnection ) url . openConnection ( ) ; con . setConnectTimeout ( CONNECT_TIMEOUT ) ; con . setReadTimeout ( CONNECT_TIMEOUT ) ; con . setDoOutput ( true ) ; con . setDoInput ( true ) ; con . setRequestMethod ( "POST" ) ; con . setRequestProperty ( "Content-type" , "application/ocsp-request" ) ; con . setRequestProperty ( "Content-length" , String . valueOf ( bytes . length ) ) ; out = con . getOutputStream ( ) ; out . write ( bytes ) ; out . flush ( ) ; if ( debug != null && con . getResponseCode ( ) != HttpURLConnection . HTTP_OK ) { debug . println ( "Received HTTP error: " + con . getResponseCode ( ) + " - " + con . getResponseMessage ( ) ) ; } in = con . getInputStream ( ) ; int contentLength = con . getContentLength ( ) ; if ( contentLength == - 1 ) { contentLength = Integer . MAX_VALUE ; } response = new byte [ contentLength > 2048 ? 2048 : contentLength ] ; int total = 0 ; while ( total < contentLength ) { int count = in . read ( response , total , response . length - total ) ; if ( count < 0 ) break ; total += count ; if ( total >= response . length && total < contentLength ) { response = Arrays . copyOf ( response , total * 2 ) ; } } response = Arrays . copyOf ( response , total ) ; } catch ( IOException ioe ) { throw new CertPathValidatorException ( "Unable to determine revocation status due to network error" , ioe , null , - 1 , BasicReason . UNDETERMINED_REVOCATION_STATUS ) ; } finally { if ( in != null ) { try { in . close ( ) ; } catch ( IOException ioe ) { throw ioe ; } } if ( out != null ) { try { out . close ( ) ; } catch ( IOException ioe ) { throw ioe ; } } } OCSPResponse ocspResponse = null ; try { ocspResponse = new OCSPResponse ( response ) ; } catch ( IOException ioe ) { throw new CertPathValidatorException ( ioe ) ; } ocspResponse . verify ( certIds , issuerCert , responderCert , date , request . getNonce ( ) ) ; return ocspResponse ; }
target:  Checks the revocation status of a list of certificates using OCSP.