}
@Override
public void handleWrite(SelectionKey key) {
logger.debug("handle write...");
DynamicByteBuffer dbb = (DynamicByteBuffer) key.attachment();
logger.debug("pending data about to be written");
ByteBuffer toSend = dbb.getByteBuffer();
SocketChannel channel = ((SocketChannel) key.channel());
try {
toSend.flip(); // prepare for write
long bytesWritten = channel.write(toSend);
if (IOLoop.INSTANCE.hasKeepAliveTimeout(channel)) {