Assert.assertEquals(response.getCharset(), Charset.GBK);
}
@Test
public void parseChunkedWithTrailers() throws IOException {
Response response = parser.parse(new ByteArrayInputStream(chunkedWithTrailers));
Assert.assertNotNull(response);
StatusLine statusLine = response.getStatusLine();
Assert.assertNotNull(statusLine);
Assert.assertEquals(statusLine.getVersion(), HTTP.HTTP_1_1);
Assert.assertEquals(statusLine.getStatusCode(), 200);
Assert.assertEquals(statusLine.getReason(), "OK");
List<Header> headers = response.getHeaders();
Assert.assertNotNull(headers);
Assert.assertEquals(headers.size(), 3);
Assert.assertTrue(Headers.isChunked(headers));
Assert.assertEquals(Headers.getValueByName(headers, Headers.CONNECTION), "Keep-Alive");
byte[] entity = response.getEntity();
Assert.assertEquals(new String(entity), "Hello World!-from http4j.author:guilin.zhang@hotmail.com");
Assert.assertEquals(response.getCharset(), Charset.GBK);
}