use of com.yahoo.jdisc.handler.ContentChannel in project vespa by vespa-engine.
the class ContainerShutdownTestCase method requireThatRequestContentCloseFailedDoesNotBlockTermination.
@Test
public void requireThatRequestContentCloseFailedDoesNotBlockTermination() {
MyRequestHandler requestHandler = MyRequestHandler.newEagerFail();
Context ctx = Context.newPendingRequest(requestHandler);
ContentChannel requestContent = ctx.request.connect(MyResponseHandler.newEagerCompletion());
requestContent.close(null);
ctx.request.release();
requestHandler.respond().close(null);
assertTrue(ctx.shutdown());
assertTrue(ctx.driver.close());
}
use of com.yahoo.jdisc.handler.ContentChannel in project vespa by vespa-engine.
the class ContainerShutdownTestCase method requireThatRequestWriteCompletionExceptionDoesNotBlockTermination.
@Test
public void requireThatRequestWriteCompletionExceptionDoesNotBlockTermination() {
MyRequestHandler requestHandler = MyRequestHandler.newEagerCloseResponse();
Context ctx = Context.newPendingRequest(requestHandler);
ContentChannel requestContent = ctx.request.connect(MyResponseHandler.newEagerCompletion());
ctx.request.release();
requestContent.write(null, MyCompletion.newException());
requestContent.close(null);
requestHandler.requestContent.closeCompletion.completed();
assertFalse(ctx.shutdown());
try {
requestHandler.requestContent.writeCompletion.completed();
fail();
} catch (MyException e) {
// ignore
}
assertTrue(ctx.terminated);
assertTrue(ctx.driver.close());
}
use of com.yahoo.jdisc.handler.ContentChannel in project vespa by vespa-engine.
the class ContainerShutdownTestCase method requireThatRequestContentWriteFailedDoesNotBlockTermination.
@Test
public void requireThatRequestContentWriteFailedDoesNotBlockTermination() {
MyRequestHandler requestHandler = MyRequestHandler.newEagerFail();
Context ctx = Context.newPendingRequest(requestHandler);
ContentChannel requestContent = ctx.request.connect(MyResponseHandler.newEagerCompletion());
requestContent.write(ByteBuffer.allocate(69), null);
requestContent.close(null);
ctx.request.release();
requestHandler.respond().close(null);
assertTrue(ctx.shutdown());
assertTrue(ctx.driver.close());
}
use of com.yahoo.jdisc.handler.ContentChannel in project vespa by vespa-engine.
the class NonWorkingContentChannelTestCase method requireThatWriteThrowsException.
@Test
public void requireThatWriteThrowsException() {
ContentChannel content = new NonWorkingContentChannel();
try {
content.write(null, null);
fail();
} catch (UnsupportedOperationException e) {
}
content = new NonWorkingContentChannel();
try {
content.write(ByteBuffer.allocate(69), null);
fail();
} catch (UnsupportedOperationException e) {
}
content = new NonWorkingContentChannel();
try {
content.write(ByteBuffer.allocate(69), new MyCompletion());
fail();
} catch (UnsupportedOperationException e) {
}
content = new NonWorkingContentChannel();
try {
content.write(null, new MyCompletion());
fail();
} catch (UnsupportedOperationException e) {
}
}
use of com.yahoo.jdisc.handler.ContentChannel in project vespa by vespa-engine.
the class MbusClientTestCase method requireThatRequestContentDoesNotSupportWrite.
@Test
public void requireThatRequestContentDoesNotSupportWrite() throws InterruptedException {
ClientTestDriver driver = ClientTestDriver.newInstance();
MyResponseHandler responseHandler = MyResponseHandler.newInstance();
Request request = null;
ContentChannel content;
try {
request = driver.newClientRequest(new SimpleMessage("foo"));
content = request.connect(responseHandler);
} finally {
if (request != null) {
request.release();
}
}
try {
content.write(ByteBuffer.allocate(69), null);
fail();
} catch (UnsupportedOperationException e) {
}
content.close(null);
assertTrue(driver.awaitMessageAndSendReply(new EmptyReply()));
assertNotNull(responseHandler.awaitResponse());
assertTrue(driver.close());
}
Aggregations