public void write(ByteBuffer data) throws PyroException {
        this.selector.checkThread();

        if (!this.key.isValid()) {
            // graceful, as this is meant to be async
            return;
        }

        if (this.doShutdown) {
            throw new PyroException("shutting down");
        }

        this.outbound.append(data);

        if (this.doEagerWrite) {
            try {
                this.onReadyToWrite(System.currentTimeMillis());
            } catch (NotYetConnectedException exc) {
                this.adjustWriteOp();
            } catch (IOException exc) {
                this.onConnectionError(exc);
                key.cancel();
            }
        } else {
            this.adjustWriteOp();
        }
    }