You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: ipc.rb
    path of file: ./repos/avro/lang/ruby/lib/avro
    
    the code of the file until where you have to start completion: # frozen_string_literal: true
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreem
    
    def read_framed_message
      message = []
      loop do
        buffer = StringIO.new(String.new('', encoding: 'BINARY'))
        buffer_length = read_buffer_length
        if buffer_length == 0
          return message.join
        end
        while buffer.tell < buffer_length
          chunk = sock.read(buffer_length - buffer.tell)
          if chunk == ''
            raise ConnectionClosedException.new("Socket read 0 bytes.")
          end