Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

32 lines (29 sloc) 0.697 kb
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
Jump to Line
Something went wrong with that request. Please try again.