Sha256: 87ba1792394d12f6cbc4267906494262dec36940f39bbfd27c16bf9305df5121

Contents?: true

Size: 979 Bytes

Versions: 4

Compression:

Stored size: 979 Bytes

Contents

require_relative 'em_test_helper'

class TestUnbindReason < Test::Unit::TestCase

  class StubConnection < EM::Connection
    attr_reader :error
    def unbind(reason = nil)
      @error = reason
      EM.stop
    end
  end

  # RFC 5737 Address Blocks Reserved for Documentation
  def test_connect_timeout
    conn = nil
    EM.run do
      conn = EM.connect '192.0.2.0', 80, StubConnection
      conn.pending_connect_timeout = 1
    end
    assert_equal Errno::ETIMEDOUT, conn.error
  end

  def test_connect_refused
    pend('FIXME: this test is broken on Windows') if windows?
    conn = nil
    EM.run do
      conn = EM.connect '127.0.0.1', 12388, StubConnection
    end
    assert_equal Errno::ECONNREFUSED, conn.error
  end

  def test_optional_argument
    pend('FIXME: this test is broken on Windows') if windows?
    conn = nil
    EM.run do
      conn = EM.connect '127.0.0.1', 12388, StubConnection
    end
    assert_equal Errno::ECONNREFUSED, conn.error
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

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