}
// tyrusConnection == null
// proxy
final HttpStatus httpStatus = ((HttpResponsePacket) message.getHttpHeader()).getHttpStatus();
if (httpStatus.getStatusCode() != 101) {
if (proxy && !PROXY_CONNECTED.get(grizzlyConnection)) {
if (httpStatus == HttpStatus.OK_200) {
PROXY_CONNECTED.set(grizzlyConnection, true);
// TYRUS-221: Proxy handshake is complete, we need to enable SSL layer for secure ("wss")
// connections now.
if (sslFilter != null) {
((GrizzlyClientSocket.FilterWrapper) sslFilter).enable();
}
httpCodecFilter.resetResponseProcessing(grizzlyConnection);
final UpgradeRequest upgradeRequest = UPGRADE_REQUEST.get(grizzlyConnection);
ctx.write(getHttpContent(upgradeRequest));
UPGRADE_REQUEST.remove(grizzlyConnection);
} else {
throw new IOException(String.format("Proxy error. %s: %s", httpStatus.getStatusCode(),
new String(httpStatus.getReasonPhraseBytes(), "UTF-8")));
}
return ctx.getInvokeAction();
}
}