Sha256: ca9813eb1111f80b80260aa4e846591b0ef881f31f0885b6c01cfeac08a38db6
Contents?: true
Size: 1.03 KB
Versions: 5
Compression:
Stored size: 1.03 KB
Contents
# encoding: utf-8 require File.expand_path("../helper.rb", __FILE__) class TestMonitor attr_reader :listening, :closed, :accepted def on_listening(addr, fd) @listening = true end def on_closed(addr, fd) @closed = true end def on_accepted(addr, fd) @accepted = true end def on_bind_failed(addr, fd) @bind_failed = true end end class TestZmqMonitoring < ZmqTestCase def test_monitoring ctx = ZMQ::Context.new sock = ctx.socket(:REP) assert_raises TypeError do sock.monitor(:invalid) end assert_raises TypeError do sock.monitor("inproc://monitor.rep", nil, :invalid) end cb = TestMonitor.new assert !sock.monitor("tcp://0.0.0.0:5000") assert sock.monitor("inproc://monitor.rep", cb) sleep 1 port = sock.bind("tcp://127.0.0.1:*") sleep 1 assert cb.listening client = ctx.socket(:REQ) client.connect("tcp://127.0.0.1:#{port}") sleep 1 assert cb.accepted sock.close sleep 1 assert cb.closed ensure ctx.destroy end end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
rbczmq-1.7.9 | test/test_monitoring.rb |
rbczmq-1.7.8 | test/test_monitoring.rb |
rbczmq-1.7.7 | test/test_monitoring.rb |
rbczmq-1.7.6 | test/test_monitoring.rb |
rbczmq-1.7.5 | test/test_monitoring.rb |