@Test(expected = IllegalArgumentException.class)
public void testMaxIntContentToString() throws Exception {

    final byte[] content = "Message content".getBytes(StandardCharsets.ISO_8859_1);
    final BasicHttpEntity entity = new BasicHttpEntity(new ByteArrayInputStream(content),
            Integer.MAX_VALUE + 100L, ContentType.TEXT_PLAIN.withCharset(StandardCharsets.ISO_8859_1));
    EntityUtils.toString(entity);
}