def flush
      return @transport.flush unless @write

      out = [@wbuf.length].pack('N')
      # Array#pack should return a BINARY encoded String, so it shouldn't be necessary to force encoding
      out << @wbuf
      @transport.write(out)
      @transport.flush
      @wbuf = Bytes.empty_byte_buffer
    end
def flush
      return @transport.flush unless @write

      out = [@wbuf.length].pack('N')
      # Array#pack should return a BINARY encoded String, so it shouldn't be necessary to force encoding
      out << @wbuf
      @transport.write(out)
      @transport.flush
      @wbuf = Bytes.empty_byte_buffer
    end
Writes the output buffer to the stream in the format of a 4-byte length
 followed by the actual data.