Sha256: 432c245cbba4b96d2d7071853006ff070d07ae3f07f793b56af1f852192727c1

Contents?: true

Size: 1.05 KB

Versions: 53

Compression:

Stored size: 1.05 KB

Contents

# encoding: utf-8

require 'spec_helper'

describe "Connection-level exception" do

  #
  # Environment
  #

  include EventedSpec::AMQPSpec

  default_timeout 2

  amqp_before do
    @connection = AMQP.connect
    @channel    = AMQP::Channel.new(@connection)
  end

  after(:all) do
    AMQP.cleanup_state
    done
  end


  #
  # Examples
  #

  it "can be handled with Session#on_error" do
    @connection.on_error do |conn, connection_close|
      conn.should == @connection

      connection_close.method_id.should == 31
      connection_close.class_id.should == 10
      connection_close.reply_code.should == 504
      connection_close.reply_text.should_not be_nil
      connection_close.reply_text.should_not be_empty

      done
    end

    EventMachine.add_timer(0.3) do
      # send_frame is NOT part of the public API, but it is public for entities like AMQ::Client::Channel
      # and we use it here to trigger a connection-level exception. MK.
      @connection.send_frame(AMQ::Protocol::Connection::TuneOk.encode(1000, 1024 * 128 * 1024, 10))
    end
  end
end

Version data entries

53 entries across 53 versions & 1 rubygems

Version Path
amqp-0.9.2 spec/integration/connection_level_exception_handling_spec.rb
amqp-0.9.1 spec/integration/connection_level_exception_handling_spec.rb
amqp-0.9.0 spec/integration/connection_level_exception_handling_spec.rb
amqp-0.9.0.pre3 spec/integration/connection_level_exception_handling_spec.rb
amqp-0.9.0.pre2 spec/integration/connection_level_exception_handling_spec.rb
amqp-0.9.0.pre1 spec/integration/connection_level_exception_handling_spec.rb
amqp-0.8.4 spec/integration/connection_level_exception_handling_spec.rb
amqp-0.8.3 spec/integration/connection_level_exception_handling_spec.rb
amqp-0.8.2 spec/integration/connection_level_exception_handling_spec.rb
amqp-0.8.1 spec/integration/connection_level_exception_handling_spec.rb
amqp-0.8.0 spec/integration/connection_level_exception_handling_spec.rb
amqp-0.8.0.rc15 spec/integration/connection_level_exception_handling_spec.rb
amqp-0.8.0.rc14 spec/integration/connection_level_exception_handling_spec.rb