List of usage examples for org.apache.http.impl.nio.client AbstractClientExchangeHandler onRouteTunnelToTarget
final void onRouteTunnelToTarget()
From source file:org.apache.http.impl.nio.client.MainClientExec.java
@Override public void responseReceived(final HttpResponse response, final InternalState state, final AbstractClientExchangeHandler<?> handler) throws IOException, HttpException { if (this.log.isDebugEnabled()) { this.log.debug("[exchange: " + state.getId() + "] Response received " + response.getStatusLine()); }/*ww w.ja v a 2 s . c o m*/ final HttpClientContext context = state.getLocalContext(); context.setAttribute(HttpCoreContext.HTTP_RESPONSE, response); this.httpProcessor.process(response, context); handler.setCurrentResponse(response); if (!handler.isRouteEstablished()) { final int status = response.getStatusLine().getStatusCode(); if (status < 200) { throw new HttpException("Unexpected response to CONNECT request: " + response.getStatusLine()); } if (status == HttpStatus.SC_OK) { handler.onRouteTunnelToTarget(); handler.setCurrentRequest(null); } else { if (!handleConnectResponse(state, handler)) { state.setFinalResponse(response); } } } else { if (!handleResponse(state, handler)) { state.setFinalResponse(response); } } if (state.getFinalResponse() != null) { final HttpAsyncResponseConsumer<?> responseConsumer = state.getResponseConsumer(); responseConsumer.responseReceived(response); } }