# File lib/amq/client/async/adapter.rb, line 634
        def get_next_frame
          return nil unless @chunk_buffer.size > 7 # otherwise, cannot read the length
          # octet + short
          offset = 3 # 1 + 2
          # length
          payload_length = @chunk_buffer[offset, 4].unpack(AMQ::Protocol::PACK_UINT32).first
          # 4 bytes for long payload length, 1 byte final octet
          frame_length = offset + payload_length + 5
          if frame_length <= @chunk_buffer.size
            @chunk_buffer.slice!(0, frame_length)
          else
            nil
          end
        end