try {
if (isNTLMFirstHandShake(proxyAuth)) {
tempInvocationStatus = InvocationStatus.CONTINUE;
}
if (proxyAuth.toLowerCase().startsWith("negotiate")) {
final Connection c = getConnectionForNextRequest(ctx, req, responsePacket, httpTransactionContext);
final HttpTxContext newContext = httpTransactionContext.copy();
httpTransactionContext.setFuture(null);
HttpTxContext.set(ctx, newContext);
newContext.setInvocationStatus(tempInvocationStatus);
String challengeHeader;
String server = proxyServer.getHost();
challengeHeader = GSSSPNEGOWrapper.generateToken(server);
req.getHeaders().add(Header.ProxyAuthorization.toString(), "Negotiate " + challengeHeader);
return executeRequest(httpTransactionContext, req, c, newContext);
} else if (isNTLMSecondHandShake(proxyAuth)) {
final Connection c = ctx.getConnection();
final HttpTxContext newContext = httpTransactionContext.copy();
httpTransactionContext.setFuture(null);
HttpTxContext.set(ctx, newContext);
newContext.setInvocationStatus(tempInvocationStatus);
return executeRequest(httpTransactionContext, req, c, newContext);
} else {
final Connection c = getConnectionForNextRequest(ctx, req, responsePacket, httpTransactionContext);
final HttpTxContext newContext = httpTransactionContext.copy();
httpTransactionContext.setFuture(null);
HttpTxContext.set(ctx, newContext);
newContext.setInvocationStatus(tempInvocationStatus);