private void pipe(InputStream in, OutputStream out, int contentLength) throws IOException {
// System.out.println("### contentLength="+contentLength);
InputStream pin = new PipedInputStream();
OutputStream pout = new PipedOutputStream((PipedInputStream) pin);
pin = applyFilters(pin);
pool.execute(new ReadWriteThread(in, pout, contentLength, true, "Reader"));
Future<?> future = pool.submit(new ReadWriteThread(pin, out, "Writer"));
// Join using future.get() so that connection is closed only after stream has been written to.
try {
future.get();
} catch (Exception e1) {