@Test
public void testDecodeGzipedRequestBody() throws Exception {

    String body = "This is the original body content, but gzipped";
    byte[] gzippedBody = compress(body);
    Operation op = Operation
            .createGet(null)
            .setContentLength(gzippedBody.length)
            .addRequestHeader(Operation.CONTENT_ENCODING_HEADER,
                    Operation.CONTENT_ENCODING_GZIP)
            .addRequestHeader(Operation.CONTENT_TYPE_HEADER, Operation.MEDIA_TYPE_TEXT_PLAIN);
    Utils.decodeBody(op, ByteBuffer.wrap(gzippedBody), true);
    assertEquals(body, op.getBody(String.class));
    // Content encoding header is removed as the body is already decoded
    assertNull(op.getRequestHeader(Operation.CONTENT_ENCODING_HEADER));
}