Skip to content

Commit

Permalink
Adapt test
Browse files Browse the repository at this point in the history
  • Loading branch information
vietj committed Oct 18, 2024
1 parent f2a2c2f commit a866a07
Showing 1 changed file with 18 additions and 16 deletions.
34 changes: 18 additions & 16 deletions vertx-core/src/test/java/io/vertx/tests/net/ConnectionBaseTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -285,29 +285,31 @@ public void testFailedQueueMessages() throws Exception {

@Test
public void testDrainReentrancy() throws Exception {
// assumeTrue(TRANSPORT != Transport.IO_URING);
connectHandler = so -> {
ChannelHandlerContext chctx = so.channelHandlerContext();
chctx.pipeline().addBefore("handler", "myhandler", new ChannelDuplexHandler() {
int reentrant;
@Override
public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception {
public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) {
assertEquals(0, reentrant++);
switch (msg.toString()) {
case "msg1":
// Fill outbound buffer
assertTrue(ctx.channel().isWritable());
ctx.write(BufferInternal.buffer(TestUtils.randomAlphaString((int)ctx.channel().bytesBeforeUnwritable())).getByteBuf());
assertFalse(ctx.channel().isWritable());
// Flush to trigger writability change
ctx.flush();
assertTrue(ctx.channel().isWritable());
break;
case "msg2":
testComplete();
break;
try {
switch (msg.toString()) {
case "msg1":
// Fill outbound buffer
assertTrue(ctx.channel().isWritable());
ChannelFuture f = ctx.write(BufferInternal.buffer(TestUtils.randomAlphaString((int) ctx.channel().bytesBeforeUnwritable())).getByteBuf());
assertFalse(ctx.channel().isWritable());
// Flush to trigger writability change
ctx.flush();
assertEquals(TRANSPORT != Transport.IO_URING, ctx.channel().isWritable());
break;
case "msg2":
testComplete();
break;
}
} finally {
reentrant--;
}
reentrant--;
}
});

Expand Down

0 comments on commit a866a07

Please sign in to comment.