code: public void write(int value) throws IOException {
      if (pos >= buf.length) {
        if (pos >= getMaxPacketLength() && !bufferContainDataAfterMark) {
          //buffer is more than a Packet, must flushBuffer()
          flushBuffer(false);
        } else {
          growBuffer(1);
        }
      }
      buf[pos++] = (byte) value;
    }
docs: Write byte into buffer, flush buffer to socket if needed.
  
  @param value byte to send
  @throws IOException if socket error occur.