use of com.metamx.http.client.response.InputStreamResponseHandler in project druid by druid-io.
the class JettyTest method testChunkNotFinalized.
// Tests that threads are not stuck when partial chunk is not finalized
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=424107
@Test
@Ignore
public // above bug is not fixed in jetty for gzip encoding, and the chunk is still finalized instead of throwing exception.
void testChunkNotFinalized() throws Exception {
ListenableFuture<InputStream> go = client.go(new Request(HttpMethod.GET, new URL("http://localhost:" + port + "/exception/exception")), new InputStreamResponseHandler());
try {
StringWriter writer = new StringWriter();
IOUtils.copy(go.get(), writer, "utf-8");
Assert.fail("Should have thrown Exception");
} catch (IOException e) {
// Expected.
}
}
use of com.metamx.http.client.response.InputStreamResponseHandler in project druid by druid-io.
the class JettyTest method testThreadNotStuckOnException.
@Test
public void testThreadNotStuckOnException() throws Exception {
final CountDownLatch latch = new CountDownLatch(1);
Executors.newSingleThreadExecutor().execute(new Runnable() {
@Override
public void run() {
try {
ListenableFuture<InputStream> go = client.go(new Request(HttpMethod.GET, new URL("http://localhost:" + port + "/exception/exception")), new InputStreamResponseHandler());
StringWriter writer = new StringWriter();
IOUtils.copy(go.get(), writer, "utf-8");
} catch (IOException e) {
// Expected.
} catch (Throwable t) {
Throwables.propagate(t);
}
latch.countDown();
}
});
latch.await(5, TimeUnit.SECONDS);
}
Aggregations