digestBytes = FileTools.readFiletoBuffer(infile);
}
MessageDigest dig = MessageDigest.getInstance(TSPAlgorithms.SHA1, "BC");
dig.update(digestBytes);
byte[] digest = dig.digest();
TimeStampRequest timeStampRequest = timeStampRequestGenerator.generate(TSPAlgorithms.SHA1, digest, BigInteger.valueOf(nonce));
// create a singular HttpClient object
HttpClient client = new HttpClient();
//establish a connection within 5 seconds
client.setConnectionTimeout(5000);
//client.getHttpConnectionManager().getParams().setConnectionTimeout(5000);
PostMethod method = new PostMethod(urlstr);
method.setParameter("http.socket.timeout", "5000");
method.setRequestHeader("Content-Type", "application/timestamp-query");
method.setRequestBody(new ByteArrayInputStream(timeStampRequest.getEncoded()));
//method.setRequestEntity(new InputStreamRequestEntity(new ByteArrayInputStream(timeStampRequest.getEncoded())));
//method.setContentChunked(true);
InputStream input = null;
ByteArrayOutputStream baos = null;
byte[] replyBytes = null;