code: public int write(byte []buffer, int offset, int length, boolean isEnd)
      throws IOException
    {
      int result;
  
      long requestExpireTime = _requestExpireTime;
  
      if (requestExpireTime > 0 && requestExpireTime < CurrentTime.currentTime()) {
        close();
        throw new ClientDisconnectException(L.l("{0}: request-timeout write exp={0}s",
                                                addressRemote(),
                                                CurrentTime.currentTime() - requestExpireTime));
      }
  
      synchronized (_writeLock) {
        long now = CurrentTime.getCurrentTimeActual();
        long expires = _socketTimeout + now;
  
        // _isNativeFlushRequired = true;
  
        do {
          result = writeNative(_socketFd, buffer, offset, length);
  
          //byte []tempBuffer = _byteBuffer.array();
          //System.out.println("TEMP: " + tempBuffer);
          //System.arraycopy(buffer, offset, tempBuffer, 0, length);
          //_byteBuffer.position(0);
          //_byteBuffer.put(buffer, offset, length);
          //result = writeNativeNio(_fd, _byteBuffer, 0, length);
        } while (result == JniStream.TIMEOUT_EXN
                 && CurrentTime.getCurrentTimeActual() < expires);
      }
  
      if (isEnd) {
        // websocket/1261
        closeWrite();
      }
      
      return result;
    }
docs: Writes to the socket.