org.apache.http.MalformedChunkCodingException Java Examples

The following examples show how to use org.apache.http.MalformedChunkCodingException. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: JsonStreamingArrayParserTest.java    From emodb with Apache License 2.0 5 votes vote down vote up
@Test
@SuppressWarnings("unchecked")
public void testMalformedChunkException() throws Exception {
    InputSupplier<InputStream> input = ByteStreams.join(
            ByteStreams.newInputStreamSupplier("[5,6".getBytes(Charsets.UTF_8)),
            exceptionStreamSupplier(new MalformedChunkCodingException("Bad chunk header")));
    assertThrowsEOFException(input.getInput(), Integer.class);
}
 
Example #2
Source File: FramedStream.java    From nomad-java-sdk with Mozilla Public License 2.0 5 votes vote down vote up
/**
 * Closes the stream and frees the underlying HTTP connection.
 *
 * @throws IOException if an error is encountered while trying to close the stream.
 */
@Override
public void close() throws IOException {
    try {
        // We need to first close the response directly rather than the parser or the response entity's
        // InputStream in order to avoid a long delay.
        response.close();
    } catch (MalformedChunkCodingException e) {
        // that's because we forced the stream closed
    }
}