Repository: netty/netty
File: transport/src/test/java/io/netty/channel/pool/FixedChannelPoolTest.java (Java)

Code before:
                        ch.pipeline().addLast(new ChannelInboundHandlerAdapter());
                    }
                });

        return new Tuple(addr, cb, sb);
    }

    private static final class TestChannelPoolHandler extends AbstractChannelPoolHandler {
        @Override
        public void channelCreated(Channel ch) throws Exception {
            // NOOP
        }
    }

    private static final class Tuple {

        LocalAddress address;
        Bootstrap cb;
        ServerBootstrap sb;

        Tuple(LocalAddress address, Bootstrap cb, ServerBootstrap sb) {
            this.address = address;
            this.cb = cb;
            this.sb = sb;
        }
    }
}


Review comment (suggestion):
```suggestion
        assertSame(channel, sameChannel);
```

Code after:
                AcquireTimeoutAction.NEW, 500, 1, Integer.MAX_VALUE, true);

        // releaseHealthCheck=true,channel=open,doHealthCheckOnRelease
        Channel channel = pool.acquire().syncUninterruptibly().getNow();
        pool.release(channel).syncUninterruptibly().getNow();
        Channel sameChannel = pool.acquire().syncUninterruptibly().getNow();
        assertSame(sameChannel, channel);

        // releaseHealthCheck=true,channel=close,doHealthCheckOnRelease
        sameChannel.close().syncUninterruptibly();
        pool.release(channel).syncUninterruptibly().getNow();
        sameChannel = pool.acquire().syncUninterruptibly().getNow();
        assertNotSame(sameChannel, channel);

        // close all and create a new poll
        sameChannel.close().syncUninterruptibly();
        channel.close().syncUninterruptibly();
        pool.close();
        pool = new InnerFixedChannelPool(t.cb, handler, ChannelHealthChecker.ACTIVE,
                AcquireTimeoutAction.NEW, 500, 1, Integer.MAX_VALUE, false);

        // releaseHealthCheck=false,channel=open,releaseAndOffer
        channel = pool.acquire().syncUninterruptibly().getNow();
        pool.release(channel).syncUninterruptibly().getNow();
        sameChannel = pool.acquire().syncUninterruptibly().getNow();
        assertSame(sameChannel, channel);

        // releaseHealthCheck=false,channel=close,releaseAndOffer
        sameChannel.close().syncUninterruptibly();
        pool.release(channel).syncUninterruptibly().getNow();
        // the acquire will do a heath check.. this is why we call the special method
        sameChannel = pool.pollChannel();
        assertSame(sameChannel, channel);

        sc.close().syncUninterruptibly();
        sameChannel.close().syncUninterruptibly();
        channel.close().syncUninterruptibly();
        pool.close();
    }

    @ParameterizedTest
    @ValueSource(booleans = { true, false })
    public void testChannelProcessingOrder(boolean lastInFirstOutOrdering) {
        Tuple t = bootstrap();

        // Start server
        Channel sc = t.sb.bind(t.address).syncUninterruptibly().channel();

        FixedChannelPool pool = new FixedChannelPool(t.cb, new TestChannelPoolHandler(),
                ChannelHealthChecker.ACTIVE, AcquireTimeoutAction.NEW, 500, 1,
                Integer.MAX_VALUE, false, lastInFirstOutOrdering);