@Test void switchesToNonChunkIfNeeded() { assertChunkedInPipeline(channel); GenericSearchRequest upsertRequest = mock(GenericSearchRequest.class); when(upsertRequest.retryStrategy()).thenReturn(FailFastRetryStrategy.INSTANCE); channel.write(upsertRequest); assertNonChunkedInPipeline(channel); }
@Override public void write(final ChannelHandlerContext ctx, final Object msg, final ChannelPromise promise) throws Exception { boolean isChunked = chunkedClass.isAssignableFrom(msg.getClass()); if (isChunked && !chunkedHandlerActive) { deactivateNonChunkedHandler(ctx); activateChunkedHandler(ctx); } else if (!isChunked && chunkedHandlerActive) { deactivateChunkedHandler(ctx); activateNonChunkedHandler(ctx); } ctx.write(msg, promise); }
ChunkedHandlerSwitcher extends ChannelDuplexHandler { @Override public void write(final ChannelHandlerContext ctx, final Object msg, final ChannelPromise promise) throws Exception { boolean isChunked = chunkedClass.isAssignableFrom(msg.getClass()); if (isChunked && !chunkedHandlerActive) { deactivateNonChunkedHandler(ctx); activateChunkedHandler(ctx); } else if (!isChunked && chunkedHandlerActive) { deactivateChunkedHandler(ctx); activateNonChunkedHandler(ctx); } ctx.write(msg, promise); } }
ChunkedHandlerSwitcher extends ChannelDuplexHandler { @Override public void write(final ChannelHandlerContext ctx, final Object msg, final ChannelPromise promise) throws Exception { boolean isChunked = chunkedClass.isAssignableFrom(msg.getClass()); if (isChunked && !chunkedHandlerActive) { deactivateNonChunkedHandler(ctx); activateChunkedHandler(ctx); } else if (!isChunked && chunkedHandlerActive) { deactivateChunkedHandler(ctx); activateNonChunkedHandler(ctx); } ctx.write(msg, promise); } protected  ChunkedHandlerSwitcher(final ChunkedMessageHandler chunkedHandler,
                                   final NonChunkedHttpMessageHandler nonChunkedHandler,
                                   final Class<? extends Request> chunkedClass); }
ChunkedHandlerSwitcher extends ChannelDuplexHandler { @Override public void write(final ChannelHandlerContext ctx, final Object msg, final ChannelPromise promise) throws Exception { boolean isChunked = chunkedClass.isAssignableFrom(msg.getClass()); if (isChunked && !chunkedHandlerActive) { deactivateNonChunkedHandler(ctx); activateChunkedHandler(ctx); } else if (!isChunked && chunkedHandlerActive) { deactivateChunkedHandler(ctx); activateNonChunkedHandler(ctx); } ctx.write(msg, promise); } protected  ChunkedHandlerSwitcher(final ChunkedMessageHandler chunkedHandler,
                                   final NonChunkedHttpMessageHandler nonChunkedHandler,
                                   final Class<? extends Request> chunkedClass); @Override void channelActive(final ChannelHandlerContext ctx); @Override void write(final ChannelHandlerContext ctx, final Object msg, final ChannelPromise promise); }
ChunkedHandlerSwitcher extends ChannelDuplexHandler { @Override public void write(final ChannelHandlerContext ctx, final Object msg, final ChannelPromise promise) throws Exception { boolean isChunked = chunkedClass.isAssignableFrom(msg.getClass()); if (isChunked && !chunkedHandlerActive) { deactivateNonChunkedHandler(ctx); activateChunkedHandler(ctx); } else if (!isChunked && chunkedHandlerActive) { deactivateChunkedHandler(ctx); activateNonChunkedHandler(ctx); } ctx.write(msg, promise); } protected  ChunkedHandlerSwitcher(final ChunkedMessageHandler chunkedHandler,
                                   final NonChunkedHttpMessageHandler nonChunkedHandler,
                                   final Class<? extends Request> chunkedClass); @Override void channelActive(final ChannelHandlerContext ctx); @Override void write(final ChannelHandlerContext ctx, final Object msg, final ChannelPromise promise); static final String SWITCHER_IDENTIFIER; }