}
public void run() {
try {
boolean base64 = true;
TimeStampRequestGenerator timeStampRequestGenerator = new TimeStampRequestGenerator();
Random rand = new Random();
int nonce = rand.nextInt();
byte[] digestBytes = new byte[20];
if (infile != null) {
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