connection.setRequestMethod("POST");
connection.setChunkedStreamingMode(4096);
connection.setRequestProperty("content-length", "-1");
connection.setRequestProperty("content-encoding", "gzip");
OutputStream out = connection.getOutputStream();
final ReportingOutputStream rout = HttpUtils.newReportingOutputStream(connection,
out, true);
return new FilterOutputStream(rout) {
@Override
public void close() throws IOException {
super.close();