use of io.servicetalk.transport.netty.internal.WriteDemandEstimator in project servicetalk by apple.
the class NettyPipelinedConnectionTest method setUp.
@BeforeEach
void setUp() throws Exception {
channel = new EmbeddedDuplexChannel(false);
WriteDemandEstimator demandEstimator = mock(WriteDemandEstimator.class);
writePublisher1 = new TestPublisher<>();
writePublisher2 = new TestPublisher<>();
when(demandEstimator.estimateRequestN(anyLong())).then(invocation1 -> MAX_VALUE);
CloseHandler closeHandler = UNSUPPORTED_PROTOCOL_CLOSE_HANDLER;
final DefaultNettyConnection<Integer, Integer> connection = DefaultNettyConnection.<Integer, Integer>initChannel(channel, DEFAULT_ALLOCATOR, immediate(), null, closeHandler, defaultFlushStrategy(), null, channel2 -> {
channel2.pipeline().addLast(new ChannelInboundHandlerAdapter() {
@Override
public void channelRead(ChannelHandlerContext ctx, Object msg) {
ctx.fireChannelRead(msg);
closeHandler.protocolPayloadEndInbound(ctx);
}
});
}, defaultStrategy(), mock(Protocol.class), NoopConnectionObserver.INSTANCE, true, __ -> false).toFuture().get();
requester = new NettyPipelinedConnection<>(connection, 8);
}
Aggregations