# File lib/bunny/queue08.rb, line 16
    def initialize(client, name, opts = {})
      # check connection to server
      raise Bunny::ConnectionError, 'Not connected to server' if client.status == :not_connected

      @client = client
      @opts   = opts
      @delivery_tag = nil
      @subscription = nil

      # Queues without a given name are named by the server and are generally
      # bound to the process that created them.
      if !name
        opts = {
          :passive => false,
          :durable => false,
          :exclusive => true,
          :auto_delete => true
        }.merge(opts)
      end

      # ignore the :nowait option if passed, otherwise program will hang waiting for a
      # response that will not be sent by the server
      opts.delete(:nowait)

      opts = { :queue => name || '', :nowait => false }.merge(opts)

      client.send_frame(Qrack::Protocol::Queue::Declare.new(opts))

      method = client.next_method

      client.check_response(method, Qrack::Protocol::Queue::DeclareOk, "Error declaring queue #{name}")

      @name = method.queue
      client.queues[@name] = self
    end