CloseableHttpResponse callBackend(
final HttpRoute route,
final HttpRequestWrapper request,
final HttpClientContext context,
final HttpExecutionAware execAware) throws IOException, HttpException {
final Date requestDate = getCurrentDate();
log.trace("Calling the backend");
final CloseableHttpResponse backendResponse = backend.execute(route, request, context, execAware);
try {
backendResponse.addHeader("Via", generateViaHeader(backendResponse));
return handleBackendResponse(route, request, context, execAware,
requestDate, getCurrentDate(), backendResponse);
} catch (final IOException ex) {
backendResponse.close();
throw ex;
} catch (final RuntimeException ex) {
backendResponse.close();
throw ex;
}
}