Sha256: 77655f721897326209aeb5a8be8377699f4a748c1139c7df2f21649f354cd52a

Contents?: true

Size: 697 Bytes

Versions: 7

Compression:

Stored size: 697 Bytes

Contents

require 'em_test_helper'
require 'socket'

class TestUnbindReason < Test::Unit::TestCase
  def test_connect_timeout
    error = nil
    EM.run {
      conn = EM.connect 'google.com', 81, Module.new{ |m|
        m.send(:define_method, :unbind) do |reason|
          error = reason
          EM.stop
        end
      }
      conn.pending_connect_timeout = 0.1
    }
    assert_equal error, Errno::ETIMEDOUT
  end

  def test_connect_refused
    error = nil
    EM.run {
      EM.connect '127.0.0.1', 12388, Module.new{ |m|
        m.send(:define_method, :unbind) do |reason|
          error = reason
          EM.stop
        end
      }
    }
    assert_equal error, Errno::ECONNREFUSED
  end
end

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
eventmachine-maglev--1.0.0.beta.4 tests/test_unbind_reason.rb
eventmachine-1.0.0.beta.4.1-x86-mswin32-60 tests/test_unbind_reason.rb
eventmachine-1.0.0.beta.4.1-x86-mingw32 tests/test_unbind_reason.rb
eventmachine-1.0.0.beta.4-x86-mswin32-60 tests/test_unbind_reason.rb
eventmachine-1.0.0.beta.4-x86-mingw32 tests/test_unbind_reason.rb
eventmachine-1.0.0.beta.4-java tests/test_unbind_reason.rb
eventmachine-1.0.0.beta.4 tests/test_unbind_reason.rb