Class: TestLineAndTextProtocol
- Inherits:
-
Test::Unit::TestCase
- Object
- Test::Unit::TestCase
- TestLineAndTextProtocol
show all
- Defined in:
- lib/ext/eventmachine-0.12.10/tests/test_ltp.rb
Defined Under Namespace
Modules: StopClient
Classes: BinaryTextTest, LineAndTextTest, SimpleLineTest
Constant Summary
collapse
- TestHost =
"127.0.0.1"
- TestPort =
8905
Instance Method Summary
collapse
Instance Method Details
#test_binary_text ⇒ Object
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
|
# File 'lib/ext/eventmachine-0.12.10/tests/test_ltp.rb', line 161
def test_binary_text
output = ''
lines_received = []
text_received = []
EventMachine.run {
EventMachine.start_server( TestHost, TestPort, BinaryTextTest ) do |conn|
conn.instance_eval "@lines = lines_received; @text = text_received"
end
EventMachine.add_timer(4) {assert(false, "test timed out")}
EventMachine.connect TestHost, TestPort, StopClient do |c|
c.set_receive_data { |data| output << data }
c.send_data "Content-length: 10000\n"
c.send_data "A" * 10000
EM.add_timer(0.2) { c.close_connection_after_writing }
end
}
assert_equal( "received 10000 bytes", output )
end
|
#test_lines_and_text ⇒ Object
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
|
# File 'lib/ext/eventmachine-0.12.10/tests/test_ltp.rb', line 121
def test_lines_and_text
output = ''
lines_received = []
text_received = []
EventMachine.run {
EventMachine.start_server( TestHost, TestPort, LineAndTextTest ) do |conn|
conn.instance_eval "@lines = lines_received; @text = text_received"
end
EventMachine.add_timer(4) {assert(false, "test timed out")}
EventMachine.connect TestHost, TestPort, StopClient do |c|
c.set_receive_data { |data| output << data }
c.send_data "Content-length: 400\n"
c.send_data "\n"
c.send_data "A" * 400
EM.add_timer(0.1) { c.close_connection_after_writing }
end
}
assert_equal( "received 400 bytes", output )
end
|
#test_overlength_lines ⇒ Object
#test_simple_lines ⇒ Object