@Test public void shouldPropagateDownstreamFlushOnPipelineFutureSuccess() throws Exception { context.checking( new Expectations() { { oneOf(upstream) .handleUpstream( with(any(ChannelHandlerContext.class)), with(any(PreparationEvent.class))); oneOf(upstream) .handleUpstream( with(any(ChannelHandlerContext.class)), with(channelState(OPEN, TRUE))); oneOf(downstream) .handleDownstream( with(any(ChannelHandlerContext.class)), with(any(FlushEvent.class))); } }); channelFactory.newChannel(pipeline); ChannelFuture executionFuture = execution.getHandlerFuture(); executionFuture.setSuccess(); ChannelFuture handlerFuture = handler.getHandlerFuture(); handlerFuture.sync(); context.assertIsSatisfied(); }
@Test public void shouldNotPropagateDownstreamFlushOnPipelineFutureFailure() throws Exception { context.checking( new Expectations() { { oneOf(upstream) .handleUpstream( with(any(ChannelHandlerContext.class)), with(any(PreparationEvent.class))); oneOf(upstream) .handleUpstream( with(any(ChannelHandlerContext.class)), with(channelState(OPEN, TRUE))); } }); channelFactory.newChannel(pipeline); ChannelFuture executionFuture = execution.getHandlerFuture(); executionFuture.setFailure(new ChannelException("pipeline already failed")); ChannelFuture handlerFuture = handler.getHandlerFuture(); assertFalse(handlerFuture.isDone()); context.assertIsSatisfied(); }