public void send(AsyncMsg data) throws TransportException {
try {
ByteBuffer buffers[] = serialize(data);
synchronized (sendMutex) {
if (closing)
throw new TransportException("connection has been closed.");
// should block.
socketChannel.write(buffers);
}
} catch (IOException e) {
throw new TransportException("" + e);
}
}