Sha256: 4d84c029d9e6eaa5e601d0f24f9b8089e751f2c738c82cb343d867033b380e07

Contents?: true

Size: 680 Bytes

Versions: 4

Compression:

Stored size: 680 Bytes

Contents

require_relative 'em_test_helper'

class TestIdleConnection < Test::Unit::TestCase
  def setup
    @port = next_port
  end

  def test_idle_time
    omit_if(!EM.respond_to?(:get_idle_time))

    a, b = nil, nil
    EM.run do
      EM.start_server '127.0.0.1', @port, Module.new
      conn = EM.connect '127.0.0.1', @port
      EM.add_timer(0.3) do
        a = conn.get_idle_time
        conn.send_data 'a'
        EM.next_tick do
          EM.next_tick do
            b = conn.get_idle_time
            conn.close_connection
            EM.stop
          end
        end
      end
    end

    assert_in_delta 0.3, a, (darwin? ? 0.2 : 0.1)
    assert_in_delta 0, b, 0.1
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
eventmachine-mkroman-1.3.0.dev.1 tests/test_idle_connection.rb
wj_eventmachine-1.3.2 tests/test_idle_connection.rb
wj_eventmachine-1.3.1 tests/test_idle_connection.rb
wj_eventmachine-1.3.0.dev.1 tests/test_idle_connection.rb