Message out = exchange.getOut(true);
try {
int responseCode = httpClient.executeMethod(method);
out.setHeaders(in.getHeaders());
out.setHeader(HTTP_RESPONSE_CODE, responseCode);
LoadingByteArrayOutputStream bos = new LoadingByteArrayOutputStream();
InputStream is = method.getResponseBodyAsStream();
IOUtils.copy(is, bos);
bos.flush();
is.close();
out.setBody(bos.createInputStream());
} finally {
method.releaseConnection();
}
// lets set the headers