I had to make the following change to onWriteDemand():
@Override
public final void onWriteDemand( WebSocket conn ) {
try/*IO*/{
channel.keyFor( selector ).interestOps( SelectionKey.OP_READ | SelectionKey.OP_WRITE );
} catch ( CancelledKeyException e ) {
}
selector.wakeup();
}
I had to make the following change to onWriteDemand():