blob: ff9193e01a4296fbe613a9aad20bb38c8e3e4373 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
require '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
|