I'm a bit worried about the comments in this method for
AbstractTrafficControlTest:

    public void testSuspendResumeReadWrite() throws Exception {
        ConnectFuture future = connect(port, new ClientIoHandler());
        future.awaitUninterruptibly();
        IoSession session = future.getSession();

        // We wait for the sessionCreated() event is fired because we
        // cannot guarantee that it is invoked already.
        while (session.getAttribute("lock") == null) {
            Thread.yield();
        }

Why can't this be used?
        while (!session.isConnected()) {
            Thread.yield();
        }

Or why isn't there a Future with an awaitUninterruptibly() on it to
ensure the connection has been created.

The lock attribute is created in the test client handler. If the test
code shows the correct behaviour for handling session creation then
that means all client handlers need to implement it and that feels
messy.

What's the correct way of doing this?

Reply via email to