Skip to content

Commit 9f1adcb

Browse files
spuuncarlhoerberg
authored andcommitted
Add spec
1 parent c9725e8 commit 9f1adcb

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

spec/amqproxy/server_spec.cr

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,4 +242,21 @@ describe AMQProxy::Server do
242242
end
243243
end
244244
end
245+
246+
it "should treat all frames as heartbeats" do
247+
with_server do |server, proxy_url|
248+
Fiber.yield
249+
AMQP::Client.start("#{proxy_url}?heartbeat=1") do |conn|
250+
client = server.@clients.first?.should_not be_nil
251+
last_heartbeat = client.@last_heartbeat
252+
conn.channel
253+
Fiber.yield
254+
client.@last_heartbeat.should be > last_heartbeat
255+
last_heartbeat = client.@last_heartbeat
256+
conn.write AMQ::Protocol::Frame::Heartbeat.new
257+
Fiber.yield
258+
client.@last_heartbeat.should be > last_heartbeat
259+
end
260+
end
261+
end
245262
end

0 commit comments

Comments
 (0)