public void testSendSmallGzipContentEncoded() throws HttpException, IOException {
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();
ClientResponse response =
client.resource(BASE_URI + "/bigbook").accept(MediaType.TEXT_PLAIN)
.header("Transfer-Encoding", "chunked").header("Content-Encoding", "gzip")