Sha256: d3d53f63f43885936661b33d4991b1ee43f59aba29014c1ffb63b8d7298ec78d

Contents?: true

Size: 953 Bytes

Versions: 63

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.2) {
        $start = Time.now
        c = EM.connect("127.0.0.1", 12345, TimeoutHandler)
        c.comm_inactivity_timeout = 2.5
      }
    }

    assert_in_delta(2.5, (Time.now - $start), 0.3)
  end

end

Version data entries

63 entries across 63 versions & 7 rubygems

Version Path
classiccms-0.7.5 vendor/bundle/gems/eventmachine-0.12.10/tests/test_inactivity_timeout.rb
classiccms-0.7.4 vendor/bundle/gems/eventmachine-0.12.10/tests/test_inactivity_timeout.rb
classiccms-0.7.3 vendor/bundle/gems/eventmachine-0.12.10/tests/test_inactivity_timeout.rb
MattHulse-eventmachine-0.0.1 tests/test_inactivity_timeout.rb
MattHulse-eventmachine-0.12.10 tests/test_inactivity_timeout.rb
classiccms-0.7.2 vendor/bundle/gems/eventmachine-0.12.10/tests/test_inactivity_timeout.rb
classiccms-0.7.1 vendor/bundle/gems/eventmachine-0.12.10/tests/test_inactivity_timeout.rb
classiccms-0.7.0 vendor/bundle/gems/eventmachine-0.12.10/tests/test_inactivity_timeout.rb
classiccms-0.6.9 vendor/bundle/gems/eventmachine-0.12.10/tests/test_inactivity_timeout.rb
classiccms-0.6.8 vendor/bundle/gems/eventmachine-0.12.10/tests/test_inactivity_timeout.rb
classiccms-0.6.7 vendor/bundle/gems/eventmachine-0.12.10/tests/test_inactivity_timeout.rb
classiccms-0.6.6 vendor/bundle/gems/eventmachine-0.12.10/tests/test_inactivity_timeout.rb
classiccms-0.6.5 vendor/bundle/gems/eventmachine-0.12.10/tests/test_inactivity_timeout.rb
classiccms-0.6.4 vendor/bundle/gems/eventmachine-0.12.10/tests/test_inactivity_timeout.rb
classiccms-0.6.3 vendor/bundle/gems/eventmachine-0.12.10/tests/test_inactivity_timeout.rb
classiccms-0.6.2 vendor/bundle/gems/eventmachine-0.12.10/tests/test_inactivity_timeout.rb
classiccms-0.6.1 vendor/bundle/gems/eventmachine-0.12.10/tests/test_inactivity_timeout.rb
classiccms-0.6.0 vendor/bundle/gems/eventmachine-0.12.10/tests/test_inactivity_timeout.rb
classiccms-0.5.17 vendor/bundle/gems/eventmachine-0.12.10/tests/test_inactivity_timeout.rb
classiccms-0.5.16 vendor/bundle/gems/eventmachine-0.12.10/tests/test_inactivity_timeout.rb