If we call for a session.close(true), we expect the session not to write any messages into the socket.
This is not what happen. The close(true) call just adds the session into the IoProcessor.removedSession queue, and continue to proceed with flush before processing the session removal.
Typically, if the session is being closed in a IoHandler.messageReceived(), then it comes form the process() method call, which is :
At this point, after the read, the write may be executed (typically if some big message was written but not sent completely, so that the OP_WRITE flag was set to TRUE).
We should most certainly check if the session is being closed before trying to write something.