eventmachine 1.0.0.beta.2-x86-mingw32 → 1.0.0.beta.3-x86-mingw32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. data/.yardopts +3 -0
  2. data/Gemfile +1 -0
  3. data/eventmachine.gemspec +1 -3
  4. data/ext/cmain.cpp +4 -4
  5. data/ext/ed.cpp +13 -16
  6. data/ext/ed.h +9 -10
  7. data/ext/em.cpp +14 -24
  8. data/ext/eventmachine.h +2 -2
  9. data/ext/extconf.rb +1 -1
  10. data/ext/rubymain.cpp +8 -6
  11. data/lib/em/connection.rb +3 -1
  12. data/lib/em/pure_ruby.rb +17 -17
  13. data/lib/em/resolver.rb +186 -0
  14. data/lib/em/spawnable.rb +3 -7
  15. data/lib/em/version.rb +1 -1
  16. data/lib/eventmachine.rb +6 -4
  17. data/lib/jeventmachine.rb +1 -1
  18. data/tasks/package.rake +4 -1
  19. data/tasks/test.rake +1 -0
  20. data/tests/em_test_helper.rb +55 -0
  21. data/tests/test_attach.rb +46 -56
  22. data/tests/test_basic.rb +74 -96
  23. data/tests/test_channel.rb +2 -4
  24. data/tests/test_connection_count.rb +1 -3
  25. data/tests/test_defer.rb +13 -44
  26. data/tests/test_deferrable.rb +19 -19
  27. data/tests/test_epoll.rb +25 -55
  28. data/tests/test_error_handler.rb +10 -7
  29. data/tests/test_exc.rb +6 -33
  30. data/tests/test_file_watch.rb +51 -35
  31. data/tests/test_futures.rb +9 -37
  32. data/tests/test_get_sock_opt.rb +27 -20
  33. data/tests/test_handler_check.rb +1 -3
  34. data/tests/test_hc.rb +24 -59
  35. data/tests/test_httpclient.rb +27 -64
  36. data/tests/test_httpclient2.rb +1 -29
  37. data/tests/test_inactivity_timeout.rb +44 -40
  38. data/tests/test_kb.rb +26 -52
  39. data/tests/test_ltp.rb +23 -67
  40. data/tests/test_ltp2.rb +1 -30
  41. data/tests/test_next_tick.rb +1 -30
  42. data/tests/test_object_protocol.rb +8 -9
  43. data/tests/test_pause.rb +45 -37
  44. data/tests/test_pending_connect_timeout.rb +42 -38
  45. data/tests/test_process_watch.rb +1 -3
  46. data/tests/test_processes.rb +92 -110
  47. data/tests/test_proxy_connection.rb +128 -104
  48. data/tests/test_pure.rb +29 -75
  49. data/tests/test_queue.rb +2 -4
  50. data/tests/test_resolver.rb +55 -0
  51. data/tests/test_running.rb +1 -29
  52. data/tests/test_sasl.rb +7 -32
  53. data/tests/test_send_file.rb +162 -196
  54. data/tests/test_servers.rb +13 -56
  55. data/tests/test_smtpclient.rb +1 -29
  56. data/tests/test_smtpserver.rb +1 -29
  57. data/tests/test_spawn.rb +2 -31
  58. data/tests/test_ssl_args.rb +9 -10
  59. data/tests/test_ssl_methods.rb +1 -3
  60. data/tests/test_ssl_verify.rb +63 -63
  61. data/tests/test_tick_loop.rb +1 -1
  62. data/tests/test_timers.rb +52 -89
  63. data/tests/test_ud.rb +1 -29
  64. metadata +20 -10
  65. data/setup.rb +0 -1585
  66. data/tests/test_errors.rb +0 -82
  67. data/tests/testem.rb +0 -31
@@ -1,32 +1,4 @@
1
- # $Id$
2
- #
3
- # Author:: Francis Cianfrocca (gmail: blackhedd)
4
- # Homepage:: http://rubyeventmachine.com
5
- # Date:: 8 April 2006
6
- #
7
- # See EventMachine and EventMachine::Connection for documentation and
8
- # usage examples.
9
- #
10
- #----------------------------------------------------------------------------
11
- #
12
- # Copyright (C) 2006-07 by Francis Cianfrocca. All Rights Reserved.
13
- # Gmail: blackhedd
14
- #
15
- # This program is free software; you can redistribute it and/or modify
16
- # it under the terms of either: 1) the GNU General Public License
17
- # as published by the Free Software Foundation; either version 2 of the
18
- # License, or (at your option) any later version; or 2) Ruby's License.
19
- #
20
- # See the file COPYING for complete licensing information.
21
- #
22
- #---------------------------------------------------------------------------
23
- #
24
- #
25
- #
26
-
27
- $:.unshift "../lib"
28
- require 'eventmachine'
29
- require 'test/unit'
1
+ require 'em_test_helper'
30
2
 
31
3
  class TestHttpClient < Test::Unit::TestCase
32
4
 
@@ -43,13 +15,13 @@ class TestHttpClient < Test::Unit::TestCase
43
15
 
44
16
  def test_http_client
45
17
  ok = false
46
- EventMachine.run {
47
- c = EventMachine::Protocols::HttpClient.send :request, :host => "www.google.com", :port => 80
18
+ EM.run {
19
+ c = EM::P::HttpClient.send :request, :host => "www.google.com", :port => 80
48
20
  c.callback {
49
21
  ok = true
50
- EventMachine.stop
22
+ EM.stop
51
23
  }
52
- c.errback {EventMachine.stop} # necessary, otherwise a failure blocks the test suite forever.
24
+ c.errback {EM.stop} # necessary, otherwise a failure blocks the test suite forever.
53
25
  }
54
26
  assert ok
55
27
  end
@@ -58,10 +30,10 @@ class TestHttpClient < Test::Unit::TestCase
58
30
 
59
31
  def test_http_client_1
60
32
  ok = false
61
- EventMachine.run {
62
- c = EventMachine::Protocols::HttpClient.send :request, :host => "www.google.com", :port => 80
63
- c.callback {ok = true; EventMachine.stop}
64
- c.errback {EventMachine.stop}
33
+ EM.run {
34
+ c = EM::P::HttpClient.send :request, :host => "www.google.com", :port => 80
35
+ c.callback {ok = true; EM.stop}
36
+ c.errback {EM.stop}
65
37
  }
66
38
  assert ok
67
39
  end
@@ -70,13 +42,13 @@ class TestHttpClient < Test::Unit::TestCase
70
42
 
71
43
  def test_http_client_2
72
44
  ok = false
73
- EventMachine.run {
74
- c = EventMachine::Protocols::HttpClient.send :request, :host => "www.google.com", :port => 80
45
+ EM.run {
46
+ c = EM::P::HttpClient.send :request, :host => "www.google.com", :port => 80
75
47
  c.callback {|result|
76
48
  ok = true;
77
- EventMachine.stop
49
+ EM.stop
78
50
  }
79
- c.errback {EventMachine.stop}
51
+ c.errback {EM.stop}
80
52
  }
81
53
  assert ok
82
54
  end
@@ -89,7 +61,7 @@ class TestHttpClient < Test::Unit::TestCase
89
61
  # causing this test to hang. Observe, there was no problem with responses
90
62
  # lacking a content-length, just when the content-length was zero.
91
63
  #
92
- class EmptyContent < EventMachine::Connection
64
+ class EmptyContent < EM::Connection
93
65
  def initialize *args
94
66
  super
95
67
  end
@@ -101,12 +73,12 @@ class TestHttpClient < Test::Unit::TestCase
101
73
 
102
74
  def test_http_empty_content
103
75
  ok = false
104
- EventMachine.run {
105
- EventMachine.start_server "127.0.0.1", 9701, EmptyContent
106
- c = EventMachine::Protocols::HttpClient.send :request, :host => "127.0.0.1", :port => 9701
76
+ EM.run {
77
+ EM.start_server "127.0.0.1", 9701, EmptyContent
78
+ c = EM::P::HttpClient.send :request, :host => "127.0.0.1", :port => 9701
107
79
  c.callback {|result|
108
80
  ok = true
109
- EventMachine.stop
81
+ EM.stop
110
82
  }
111
83
  }
112
84
  assert ok
@@ -115,7 +87,7 @@ class TestHttpClient < Test::Unit::TestCase
115
87
 
116
88
  #---------------------------------------
117
89
 
118
- class PostContent < EventMachine::Protocols::LineAndTextProtocol
90
+ class PostContent < EM::P::LineAndTextProtocol
119
91
  def initialize *args
120
92
  super
121
93
  @lines = []
@@ -155,23 +127,14 @@ class TestHttpClient < Test::Unit::TestCase
155
127
  end
156
128
  end
157
129
 
158
- def setup_timeout(timeout = 4)
159
- EM.schedule {
160
- start_time = EM.current_time
161
- EM.add_periodic_timer(0.01) {
162
- raise "timeout" if EM.current_time - start_time >= timeout
163
- }
164
- }
165
- end
166
-
167
130
  # TODO, this is WRONG. The handler is asserting an HTTP 1.1 request, but the client
168
131
  # is sending a 1.0 request. Gotta fix the client
169
132
  def test_post
170
133
  response = nil
171
- EventMachine.run {
172
- EventMachine.start_server Localhost, Localport, PostContent
134
+ EM.run {
135
+ EM.start_server Localhost, Localport, PostContent
173
136
  setup_timeout(2)
174
- c = EventMachine::Protocols::HttpClient.request(
137
+ c = EM::P::HttpClient.request(
175
138
  :host=>Localhost,
176
139
  :port=>Localport,
177
140
  :method=>:post,
@@ -181,7 +144,7 @@ class TestHttpClient < Test::Unit::TestCase
181
144
  )
182
145
  c.callback {|r|
183
146
  response = r
184
- EventMachine.stop
147
+ EM.stop
185
148
  }
186
149
  }
187
150
 
@@ -198,9 +161,9 @@ class TestHttpClient < Test::Unit::TestCase
198
161
  c = EM::Protocols::HttpClient.send :request, :host => "www.google.com", :port => 80, :cookie=>"aaa=bbb"
199
162
  c.callback {|result|
200
163
  ok = true;
201
- EventMachine.stop
164
+ EM.stop
202
165
  }
203
- c.errback {EventMachine.stop}
166
+ c.errback {EM.stop}
204
167
  }
205
168
  assert ok
206
169
  end
@@ -217,9 +180,9 @@ class TestHttpClient < Test::Unit::TestCase
217
180
  )
218
181
  c.callback {|result|
219
182
  ok = true;
220
- EventMachine.stop
183
+ EM.stop
221
184
  }
222
- c.errback {EventMachine.stop}
185
+ c.errback {EM.stop}
223
186
  }
224
187
  assert ok
225
188
  end
@@ -1,32 +1,4 @@
1
- # $Id$
2
- #
3
- # Author:: Francis Cianfrocca (gmail: blackhedd)
4
- # Homepage:: http://rubyeventmachine.com
5
- # Date:: 8 April 2006
6
- #
7
- # See EventMachine and EventMachine::Connection for documentation and
8
- # usage examples.
9
- #
10
- #----------------------------------------------------------------------------
11
- #
12
- # Copyright (C) 2006-07 by Francis Cianfrocca. All Rights Reserved.
13
- # Gmail: blackhedd
14
- #
15
- # This program is free software; you can redistribute it and/or modify
16
- # it under the terms of either: 1) the GNU General Public License
17
- # as published by the Free Software Foundation; either version 2 of the
18
- # License, or (at your option) any later version; or 2) Ruby's License.
19
- #
20
- # See the file COPYING for complete licensing information.
21
- #
22
- #---------------------------------------------------------------------------
23
- #
24
- #
25
- #
26
-
27
- $:.unshift "../lib"
28
- require 'eventmachine'
29
- require 'test/unit'
1
+ require 'em_test_helper'
30
2
 
31
3
  class TestHttpClient2 < Test::Unit::TestCase
32
4
  Localhost = "127.0.0.1"
@@ -1,50 +1,54 @@
1
- $:.unshift "../lib"
2
- require 'eventmachine'
3
- require 'test/unit'
1
+ require 'em_test_helper'
4
2
 
5
3
  class TestInactivityTimeout < Test::Unit::TestCase
6
4
 
7
- def test_default
8
- $timeout = nil
9
- EM.run {
10
- c = EM.connect("127.0.0.1", 54321)
11
- $timeout = c.comm_inactivity_timeout
12
- EM.stop
13
- }
14
-
15
- assert_equal(0.0, $timeout)
16
- end
17
-
18
- def test_set_and_get
19
- $timeout = nil
20
- EM.run {
21
- c = EM.connect("127.0.0.1", 54321)
22
- c.comm_inactivity_timeout = 2.5
23
- $timeout = c.comm_inactivity_timeout
24
- EM.stop
25
- }
26
-
27
- assert_equal(2.5, $timeout)
28
- end
5
+ if EM.respond_to? :get_comm_inactivity_timeout
6
+ def test_default
7
+ EM.run {
8
+ c = EM.connect("127.0.0.1", 54321)
9
+ assert_equal 0.0, c.comm_inactivity_timeout
10
+ EM.stop
11
+ }
12
+ end
29
13
 
30
- module TimeoutHandler
31
- def unbind
32
- EM.stop
14
+ def test_set_and_get
15
+ EM.run {
16
+ c = EM.connect("127.0.0.1", 54321)
17
+ c.comm_inactivity_timeout = 2.5
18
+ assert_equal 2.5, c.comm_inactivity_timeout
19
+ EM.stop
20
+ }
33
21
  end
34
- end
35
22
 
36
- def test_for_real
37
- EM.run {
38
- EM.heartbeat_interval = 0.1
39
- EM.start_server("127.0.0.1", 12345)
40
- EM.add_timer(0.1) {
41
- $start = Time.now
42
- c = EM.connect("127.0.0.1", 12345, TimeoutHandler)
43
- c.comm_inactivity_timeout = 0.2
23
+ def test_for_real
24
+ start, finish = nil
25
+
26
+ timeout_handler = Module.new do
27
+ define_method :unbind do
28
+ finish = Time.now
29
+ EM.stop
30
+ end
31
+ end
32
+
33
+ EM.run {
34
+ setup_timeout
35
+ EM.heartbeat_interval = 0.01
36
+ EM.start_server("127.0.0.1", 12345)
37
+ EM.add_timer(0.01) {
38
+ start = Time.now
39
+ c = EM.connect("127.0.0.1", 12345, timeout_handler)
40
+ c.comm_inactivity_timeout = 0.02
41
+ }
44
42
  }
45
- }
46
43
 
47
- assert_in_delta(0.2, (Time.now - $start), 0.1)
48
- end
44
+ assert_in_delta(0.02, (finish - start), 0.02)
45
+ end
46
+ else
47
+ warn "EM.comm_inactivity_timeout not implemented, skipping tests in #{__FILE__}"
49
48
 
49
+ # Because some rubies will complain if a TestCase class has no tests
50
+ def test_em_comm_inactivity_timeout_not_implemented
51
+ assert true
52
+ end
53
+ end
50
54
  end
@@ -1,60 +1,34 @@
1
- # $Id$
2
- #
3
- # Author:: Francis Cianfrocca (gmail: blackhedd)
4
- # Homepage:: http://rubyeventmachine.com
5
- # Date:: 8 April 2006
6
- #
7
- # See EventMachine and EventMachine::Connection for documentation and
8
- # usage examples.
9
- #
10
- #----------------------------------------------------------------------------
11
- #
12
- # Copyright (C) 2006-07 by Francis Cianfrocca. All Rights Reserved.
13
- # Gmail: blackhedd
14
- #
15
- # This program is free software; you can redistribute it and/or modify
16
- # it under the terms of either: 1) the GNU General Public License
17
- # as published by the Free Software Foundation; either version 2 of the
18
- # License, or (at your option) any later version; or 2) Ruby's License.
19
- #
20
- # See the file COPYING for complete licensing information.
21
- #
22
- #---------------------------------------------------------------------------
23
- #
24
- #
25
- #
26
-
27
- $:.unshift "../lib"
28
- require 'eventmachine'
29
- require 'test/unit'
1
+ require 'em_test_helper'
30
2
 
31
3
  class TestKeyboardEvents < Test::Unit::TestCase
32
4
 
33
- def setup
34
- end
35
-
36
- def teardown
37
- end
5
+ if !jruby?
6
+ module KbHandler
7
+ include EM::Protocols::LineText2
8
+ def receive_line d
9
+ EM::stop if d == "STOP"
10
+ end
11
+ end
38
12
 
39
- module KbHandler
40
- include EM::Protocols::LineText2
41
- def receive_line d
42
- EM::stop if d == "STOP"
13
+ # This test doesn't actually do anything useful but is here to
14
+ # illustrate the usage. If you removed the timer and ran this test
15
+ # by itself on a console, and then typed into the console, it would
16
+ # work.
17
+ # I don't know how to get the test harness to simulate actual keystrokes.
18
+ # When someone figures that out, then we can make this a real test.
19
+ #
20
+ def test_kb
21
+ EM.run {
22
+ EM.open_keyboard KbHandler
23
+ EM::Timer.new(1) { EM.stop }
24
+ } if $stdout.tty? # don't run the test unless it stands a chance of validity.
43
25
  end
44
- end
26
+ else
27
+ warn "EM.open_keyboard not implemented, skipping tests in #{__FILE__}"
45
28
 
46
- # This test doesn't actually do anything useful but is here to
47
- # illustrate the usage. If you removed the timer and ran this test
48
- # by itself on a console, and then typed into the console, it would
49
- # work.
50
- # I don't know how to get the test harness to simulate actual keystrokes.
51
- # When someone figures that out, then we can make this a real test.
52
- #
53
- def test_kb
54
- EM.run {
55
- EM.open_keyboard KbHandler
56
- EM::Timer.new(1) { EM.stop }
57
- } if $stdout.tty? # don't run the test unless it stands a chance of validity.
29
+ # Because some rubies will complain if a TestCase class has no tests
30
+ def test_em_open_keyboard_unsupported
31
+ assert true
32
+ end
58
33
  end
59
-
60
34
  end
@@ -1,42 +1,8 @@
1
- # $Id$
2
- #
3
- # Author:: Francis Cianfrocca (gmail: blackhedd)
4
- # Homepage:: http://rubyeventmachine.com
5
- # Date:: 8 April 2006
6
- #
7
- # See EventMachine and EventMachine::Connection for documentation and
8
- # usage examples.
9
- #
10
- #----------------------------------------------------------------------------
11
- #
12
- # Copyright (C) 2006-07 by Francis Cianfrocca. All Rights Reserved.
13
- # Gmail: blackhedd
14
- #
15
- # This program is free software; you can redistribute it and/or modify
16
- # it under the terms of either: 1) the GNU General Public License
17
- # as published by the Free Software Foundation; either version 2 of the
18
- # License, or (at your option) any later version; or 2) Ruby's License.
19
- #
20
- # See the file COPYING for complete licensing information.
21
- #
22
- #---------------------------------------------------------------------------
23
- #
24
- #
25
- #
26
- #
27
-
28
- require 'eventmachine'
29
- require 'test/unit'
1
+ require 'em_test_helper'
30
2
 
31
3
  class TestLineAndTextProtocol < Test::Unit::TestCase
32
4
 
33
- TestHost = "127.0.0.1"
34
- TestPort = 8905
35
-
36
-
37
- #--------------------------------------------------------------------
38
-
39
- class SimpleLineTest < EventMachine::Protocols::LineAndTextProtocol
5
+ class SimpleLineTest < EM::P::LineAndTextProtocol
40
6
  def receive_line line
41
7
  @line_buffer << line
42
8
  end
@@ -46,34 +12,29 @@ class TestLineAndTextProtocol < Test::Unit::TestCase
46
12
  def set_receive_data(&blk)
47
13
  @rdb = blk
48
14
  end
49
-
15
+
50
16
  def receive_data data
51
17
  @rdb.call(data) if @rdb
52
18
  end
53
-
19
+
54
20
  def unbind
55
21
  EM.add_timer(0.1) { EM.stop }
56
22
  end
57
23
  end
58
-
59
- def setup_timeout(timeout = 4)
60
- EM.schedule {
61
- start_time = EM.current_time
62
- EM.add_periodic_timer(0.01) {
63
- raise "timeout" if EM.current_time - start_time >= timeout
64
- }
65
- }
24
+
25
+ def setup
26
+ @port = next_port
66
27
  end
67
28
 
68
29
  def test_simple_lines
69
30
  lines_received = []
70
- EventMachine.run {
71
- EventMachine.start_server( TestHost, TestPort, SimpleLineTest ) do |conn|
31
+ EM.run {
32
+ EM.start_server( "127.0.0.1", @port, SimpleLineTest ) do |conn|
72
33
  conn.instance_eval "@line_buffer = lines_received"
73
34
  end
74
35
  setup_timeout
75
36
 
76
- EventMachine.connect TestHost, TestPort, StopClient do |c|
37
+ EM.connect "127.0.0.1", @port, StopClient do |c|
77
38
  c.send_data "aaa\nbbb\r\nccc\n"
78
39
  c.close_connection_after_writing
79
40
  end
@@ -83,7 +44,7 @@ class TestLineAndTextProtocol < Test::Unit::TestCase
83
44
 
84
45
  #--------------------------------------------------------------------
85
46
 
86
- class SimpleLineTest < EventMachine::Protocols::LineAndTextProtocol
47
+ class SimpleLineTest < EM::P::LineAndTextProtocol
87
48
  def receive_error text
88
49
  @error_message << text
89
50
  end
@@ -91,13 +52,13 @@ class TestLineAndTextProtocol < Test::Unit::TestCase
91
52
 
92
53
  def test_overlength_lines
93
54
  lines_received = []
94
- EventMachine.run {
95
- EventMachine.start_server( TestHost, TestPort, SimpleLineTest ) do |conn|
55
+ EM.run {
56
+ EM.start_server( "127.0.0.1", @port, SimpleLineTest ) do |conn|
96
57
  conn.instance_eval "@error_message = lines_received"
97
58
  end
98
59
  setup_timeout
99
60
 
100
- EventMachine.connect TestHost, TestPort, StopClient do |c|
61
+ EM.connect "127.0.0.1", @port, StopClient do |c|
101
62
  c.send_data "a" * (16*1024 + 1)
102
63
  c.send_data "\n"
103
64
  c.close_connection_after_writing
@@ -110,9 +71,7 @@ class TestLineAndTextProtocol < Test::Unit::TestCase
110
71
 
111
72
  #--------------------------------------------------------------------
112
73
 
113
- class LineAndTextTest < EventMachine::Protocols::LineAndTextProtocol
114
- def post_init
115
- end
74
+ class LineAndTextTest < EM::P::LineAndTextProtocol
116
75
  def receive_line line
117
76
  if line =~ /content-length:\s*(\d+)/i
118
77
  @content_length = $1.to_i
@@ -130,13 +89,13 @@ class TestLineAndTextProtocol < Test::Unit::TestCase
130
89
  output = ''
131
90
  lines_received = []
132
91
  text_received = []
133
- EventMachine.run {
134
- EventMachine.start_server( TestHost, TestPort, LineAndTextTest ) do |conn|
92
+ EM.run {
93
+ EM.start_server( "127.0.0.1", @port, LineAndTextTest ) do |conn|
135
94
  conn.instance_eval "@lines = lines_received; @text = text_received"
136
95
  end
137
96
  setup_timeout
138
97
 
139
- EventMachine.connect TestHost, TestPort, StopClient do |c|
98
+ EM.connect "127.0.0.1", @port, StopClient do |c|
140
99
  c.set_receive_data { |data| output << data }
141
100
  c.send_data "Content-length: 400\n"
142
101
  c.send_data "\n"
@@ -150,9 +109,7 @@ class TestLineAndTextProtocol < Test::Unit::TestCase
150
109
  #--------------------------------------------------------------------
151
110
 
152
111
 
153
- class BinaryTextTest < EventMachine::Protocols::LineAndTextProtocol
154
- def post_init
155
- end
112
+ class BinaryTextTest < EM::P::LineAndTextProtocol
156
113
  def receive_line line
157
114
  if line =~ /content-length:\s*(\d+)/i
158
115
  set_binary_mode $1.to_i
@@ -170,21 +127,20 @@ class TestLineAndTextProtocol < Test::Unit::TestCase
170
127
  output = ''
171
128
  lines_received = []
172
129
  text_received = []
173
- EventMachine.run {
174
- EventMachine.start_server( TestHost, TestPort, BinaryTextTest ) do |conn|
130
+ EM.run {
131
+ EM.start_server( "127.0.0.1", @port, BinaryTextTest ) do |conn|
175
132
  conn.instance_eval "@lines = lines_received; @text = text_received"
176
133
  end
177
134
  setup_timeout
178
135
 
179
- EventMachine.connect TestHost, TestPort, StopClient do |c|
136
+ EM.connect "127.0.0.1", @port, StopClient do |c|
180
137
  c.set_receive_data { |data| output << data }
181
138
  c.send_data "Content-length: 10000\n"
182
139
  c.send_data "A" * 10000
183
- EM.add_timer(0.2) { c.close_connection_after_writing }
140
+ EM.add_timer(0.1) { c.close_connection_after_writing }
184
141
  end
185
142
  }
186
143
  assert_equal( "received 10000 bytes", output )
187
144
  end
188
145
 
189
- #--------------------------------------------------------------------
190
146
  end