code: @Override
    public void write(byte []buf, int offset, int length, boolean isEnd)
      throws IOException
    {
      if (_s == null) {
        return;
      }
      
      try {
        _needsFlush = true;
        
        while (length > 0) {
          _writeBuffer.clear();
          int sublen = Math.min(length, _writeBuffer.remaining());
          
          _writeBuffer.put(buf, offset, sublen);
          _writeBuffer.flip();
          
          _s.write(_writeBuffer);
          
          length -= sublen;
          offset += sublen;
        }
  
        _totalWriteBytes += length;
      } catch (IOException e) {
        IOException exn = ClientDisconnectException.create(this + ":" + e, e);
        
        try {
          close();
        } catch (IOException e1) {
        }
  
        throw exn;
      }
    }
docs: Writes bytes to the socket.
  
  @param buf byte buffer containing the bytes
  @param offset offset into the buffer
  @param length number of bytes to read
  @param isEnd if the write is at a close.
  
  @exception throws ClientDisconnectException if the connection is dropped