@Override
public void writeTo(OutputStream out)
throws IOException
{
try {
countingOutputStream = new CountingOutputStream(out);
request.getBodyGenerator().write(countingOutputStream);
}
catch (Exception e) {
Throwables.propagateIfPossible(e, IOException.class);
throw new IOException(e);