Sha256: bf6c22ec63123f6fa8f964e933ccde4661240bc37bbcb0b3816fff8e4d92b49e
Contents?: true
Size: 953 Bytes
Versions: 8
Compression:
Stored size: 953 Bytes
Contents
$:.unshift "../lib" require 'eventmachine' require 'test/unit' class TestInactivityTimeout < Test::Unit::TestCase def test_default $timeout = nil EM.run { c = EM.connect("127.0.0.1", 54321) $timeout = c.comm_inactivity_timeout EM.stop } assert_equal(0.0, $timeout) end def test_set_and_get $timeout = nil EM.run { c = EM.connect("127.0.0.1", 54321) c.comm_inactivity_timeout = 2.5 $timeout = c.comm_inactivity_timeout EM.stop } assert_equal(2.5, $timeout) end module TimeoutHandler def unbind EM.stop end end def test_for_real EM.run { EM.heartbeat_interval = 0.1 EM.start_server("127.0.0.1", 12345) EM.add_timer(0.1) { $start = Time.now c = EM.connect("127.0.0.1", 12345, TimeoutHandler) c.comm_inactivity_timeout = 0.2 } } assert_in_delta(0.2, (Time.now - $start), 0.1) end end
Version data entries
8 entries across 8 versions & 3 rubygems