ByteArrayOutputStream originalContent = new ByteArrayOutputStream();
for (int c = 0; c < 5000000; ++c) {
originalContent.write(c);
}
byte[] entity = originalContent.toByteArray();
ClientResponse response =
client.resource(new URI(getBaseURI() + "/large")).contentType(MediaType.TEXT_XML_TYPE)
.post(entity);
assertEquals(277, response.getStatusCode());
InputStream respStream = response.getEntity(InputStream.class);
for (int c = 0; c < entity.length; ++c) {
int respByte = respStream.read();
assertEquals(entity[c] % 256, (byte)respByte);
}
StringBuffer sb = new StringBuffer();
for (int c = 0; c < 50; ++c) {
sb.append("abcdefghijklmnopqrstuvwxyz");
}
assertEquals(sb.toString(), response.getHeaders().getFirst("appendStringsHeader"));
}