// postMethod.setRequestHeader("Content-)
ByteArrayOutputStream originalContent = new ByteArrayOutputStream();
originalContent.write("Hello world".getBytes("UTF-8"));
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ChunkedOutputStream chunkedOut = new ChunkedOutputStream(baos);
GZIPOutputStream gzipOut = new GZIPOutputStream(chunkedOut);
originalContent.writeTo(gzipOut);
gzipOut.finish();
chunkedOut.finish();
byte[] content = baos.toByteArray();
postMethod
.setRequestEntity(new ByteArrayRequestEntity(content, "text/plain; charset=utf-8"));
try {