1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
|
require "spec_helper"
describe "Client-defined heartbeat interval" do
context "with value > 0" do
let(:connection) do
c = Bunny.new(username: "bunny_gem", password: "bunny_password", vhost: "bunny_testbed", heartbeat_timeout: 4)
c.start
c
end
it "can be enabled explicitly" do
sleep 5.0
connection.close
end
end
# issue 267
context "with value = 0" do
let(:connection) do
c = Bunny.new(username: "bunny_gem", password: "bunny_password", vhost: "bunny_testbed",
heartbeat_timeout: 0, automatically_recover: false)
c.start
c
end
it "disables heartbeats" do
sleep 1.0
connection.close
end
end
end
describe "Server-defined heartbeat interval" do
let(:connection) do
c = Bunny.new(username: "bunny_gem", password: "bunny_password", vhost: "bunny_testbed", heartbeat_timeout: :server)
c.start
c
end
it "can be enabled explicitly" do
puts "Sleeping for 5 seconds with heartbeat interval of 4"
sleep 5.0
connection.close
end
end
|