ChannelByteChunker extends AbstractChannelTransformer<ChannelByteChunker, ByteBuf, ByteBuf> { public static ChannelByteChunker create(MemSize minChunkSize, MemSize maxChunkSize) { return new ChannelByteChunker(minChunkSize.toInt(), maxChunkSize.toInt()); } private  ChannelByteChunker(int minChunkSize, int maxChunkSize); static ChannelByteChunker create(MemSize minChunkSize, MemSize maxChunkSize);  }
@Test public void testForStackOverflow() { ChannelByteChunker channelByteChunker = ChannelByteChunker.create(MemSize.of(10_000), MemSize.of(10_000)); ChannelSupplier<ByteBuf> supplier = ChannelSupplier.ofStream(Stream.generate(() -> ByteBufStrings.wrapAscii("a")).limit(10_000)) .transformWith(channelByteChunker); await(supplier.streamTo(ChannelConsumer.ofConsumer(ByteBuf::recycle))); }