// TODO: not by the JavaDoc API spec
public int write(ByteBuffer buffer) throws IOException {
        if (disconnected)
            return -1;    // TODO: not by the JavaDoc API spec
        if (throwExceptionOnSend)
            throw new IOException("text IO exception");
        // we could write remaining bytes, but for test this is enough
        if (buffer.remaining() > writeBuffer.remaining())
            return 0;
        int startPos = buffer.position();
        writeBuffer.put(buffer);
        return buffer.position() - startPos;
    }
public int write(ByteBuffer buffer) throws IOException {
if (disconnected)
return -1; // TODO: not by the JavaDoc API spec
if (throwExceptionOnSend)
throw new IOException("text IO exception");
public int write(ByteBuffer buffer) throws IOException {
if (disconnected)
return -1; // TODO: not by the JavaDoc API spec
if (throwExceptionOnSend)
throw new IOException("text IO exception");
// we could write remaining bytes, but for test this is enough
if (buffer.remaining() > writeBuffer.remaining())
return 0;
int startPos = buffer.position();
writeBuffer.put(buffer);
return buffer.position() - startPos;
}
public int write(ByteBuffer buffer) throws IOException {
if (disconnected)
return -1; // TODO: not by the JavaDoc API spec
if (throwExceptionOnSend)
throw new IOException("text IO exception");
// we could write remaining bytes, but for test this is enough
if (buffer.remaining() > writeBuffer.remaining())
return 0;
int startPos = buffer.position();
writeBuffer.put(buffer);
return buffer.position() - startPos;
}