Dive into the code, change the write function in WritableSocketChannel.java(in restlet source code) and it will work. I don't know whether it's a bug.
from
public int write(ByteBuffer src) throws IOException {
return getWrappedChannel().write(src);
}
to
public int write(ByteBuffer src) throws IOException {
int count = 0;
while (src.hasRemaining()) {
count += getWrappedChannel().write(src);
}
return count;
}
According to java doc.
Some types of channels, depending upon their state, may write only some of the bytes or possibly none at all. A socket channel in non-blocking mode, for example, cannot write any more bytes than are free in the socket's output buffer.