em-websocket 0.4.0 → 0.5.3

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 (41) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.rdoc +35 -1
  3. data/Gemfile +6 -0
  4. data/LICENCE +7 -0
  5. data/README.md +49 -7
  6. data/em-websocket.gemspec +2 -8
  7. data/examples/test.html +3 -1
  8. data/lib/em-websocket/close03.rb +3 -0
  9. data/lib/em-websocket/close05.rb +3 -0
  10. data/lib/em-websocket/close06.rb +3 -0
  11. data/lib/em-websocket/close75.rb +2 -1
  12. data/lib/em-websocket/connection.rb +118 -26
  13. data/lib/em-websocket/framing03.rb +3 -2
  14. data/lib/em-websocket/framing05.rb +3 -2
  15. data/lib/em-websocket/framing07.rb +16 -4
  16. data/lib/em-websocket/framing76.rb +1 -4
  17. data/lib/em-websocket/handler.rb +31 -3
  18. data/lib/em-websocket/handler76.rb +2 -0
  19. data/lib/em-websocket/handshake.rb +23 -4
  20. data/lib/em-websocket/handshake04.rb +10 -6
  21. data/lib/em-websocket/handshake75.rb +11 -1
  22. data/lib/em-websocket/handshake76.rb +4 -0
  23. data/lib/em-websocket/masking04.rb +1 -5
  24. data/lib/em-websocket/message_processor_03.rb +6 -3
  25. data/lib/em-websocket/message_processor_06.rb +30 -9
  26. data/lib/em-websocket/version.rb +1 -1
  27. data/lib/em-websocket/websocket.rb +7 -0
  28. data/spec/helper.rb +67 -52
  29. data/spec/integration/common_spec.rb +49 -32
  30. data/spec/integration/draft03_spec.rb +83 -57
  31. data/spec/integration/draft05_spec.rb +14 -12
  32. data/spec/integration/draft06_spec.rb +67 -7
  33. data/spec/integration/draft13_spec.rb +29 -20
  34. data/spec/integration/draft75_spec.rb +44 -40
  35. data/spec/integration/draft76_spec.rb +58 -46
  36. data/spec/integration/gte_03_examples.rb +42 -0
  37. data/spec/integration/shared_examples.rb +93 -0
  38. data/spec/unit/framing_spec.rb +24 -4
  39. data/spec/unit/handshake_spec.rb +24 -1
  40. data/spec/unit/masking_spec.rb +2 -0
  41. metadata +18 -107
@@ -1,5 +1,4 @@
1
1
  require 'helper'
2
- require 'integration/shared_examples'
3
2
 
4
3
  describe "draft03" do
5
4
  include EM::SpecHelper
@@ -35,20 +34,19 @@ describe "draft03" do
35
34
  }
36
35
  end
37
36
 
37
+ def start_client
38
+ client = EM.connect('0.0.0.0', 12345, Draft03FakeWebSocketClient)
39
+ client.send_data(format_request(@request))
40
+ yield client if block_given?
41
+ return client
42
+ end
43
+
38
44
  it_behaves_like "a websocket server" do
39
45
  let(:version) { 3 }
46
+ end
40
47
 
41
- def start_server
42
- EM::WebSocket.start(:host => "0.0.0.0", :port => 12345) { |ws|
43
- yield ws
44
- }
45
- end
46
-
47
- def start_client
48
- client = EM.connect('0.0.0.0', 12345, Draft03FakeWebSocketClient)
49
- client.send_data(format_request(@request))
50
- yield client if block_given?
51
- end
48
+ it_behaves_like "a WebSocket server drafts 3 and above" do
49
+ let(:version) { 3 }
52
50
  end
53
51
 
54
52
  # These examples are straight from the spec
@@ -56,36 +54,30 @@ describe "draft03" do
56
54
  describe "examples from the spec" do
57
55
  it "should accept a single-frame text message" do
58
56
  em {
59
- EM::WebSocket.start(:host => "0.0.0.0", :port => 12345) { |ws|
57
+ start_server { |ws|
60
58
  ws.onmessage { |msg|
61
59
  msg.should == 'Hello'
62
60
  done
63
61
  }
64
62
  }
65
-
66
- # Create a fake client which sends draft 76 handshake
67
- connection = EM.connect('0.0.0.0', 12345, FakeWebSocketClient)
68
- connection.send_data(format_request(@request))
69
-
70
- # Send frame
71
- connection.onopen {
72
- connection.send_data("\x04\x05Hello")
63
+ start_client { |client|
64
+ client.onopen {
65
+ client.send_data("\x04\x05Hello")
66
+ }
73
67
  }
74
68
  }
75
69
  end
76
70
 
77
71
  it "should accept a fragmented text message" do
78
72
  em {
79
- EM::WebSocket.start(:host => "0.0.0.0", :port => 12345) { |ws|
73
+ start_server { |ws|
80
74
  ws.onmessage { |msg|
81
75
  msg.should == 'Hello'
82
76
  done
83
77
  }
84
78
  }
85
79
 
86
- # Create a fake client which sends draft 76 handshake
87
- connection = EM.connect('0.0.0.0', 12345, FakeWebSocketClient)
88
- connection.send_data(format_request(@request))
80
+ connection = start_client
89
81
 
90
82
  # Send frame
91
83
  connection.onopen {
@@ -97,11 +89,9 @@ describe "draft03" do
97
89
 
98
90
  it "should accept a ping request and respond with the same body" do
99
91
  em {
100
- EM::WebSocket.start(:host => "0.0.0.0", :port => 12345) { |ws| }
92
+ start_server
101
93
 
102
- # Create a fake client which sends draft 76 handshake
103
- connection = EM.connect('0.0.0.0', 12345, FakeWebSocketClient)
104
- connection.send_data(format_request(@request))
94
+ connection = start_client
105
95
 
106
96
  # Send frame
107
97
  connection.onopen {
@@ -120,16 +110,15 @@ describe "draft03" do
120
110
  em {
121
111
  data = "a" * 256
122
112
 
123
- EM::WebSocket.start(:host => "0.0.0.0", :port => 12345) { |ws|
124
- ws.onmessage { |msg|
113
+ start_server { |ws|
114
+ ws.onbinary { |msg|
115
+ msg.encoding.should == Encoding.find("BINARY") if defined?(Encoding)
125
116
  msg.should == data
126
117
  done
127
118
  }
128
119
  }
129
120
 
130
- # Create a fake client which sends draft 76 handshake
131
- connection = EM.connect('0.0.0.0', 12345, FakeWebSocketClient)
132
- connection.send_data(format_request(@request))
121
+ connection = start_client
133
122
 
134
123
  # Send frame
135
124
  connection.onopen {
@@ -142,16 +131,15 @@ describe "draft03" do
142
131
  em {
143
132
  data = "a" * 65536
144
133
 
145
- EM::WebSocket.start(:host => "0.0.0.0", :port => 12345) { |ws|
146
- ws.onmessage { |msg|
134
+ start_server { |ws|
135
+ ws.onbinary { |msg|
136
+ msg.encoding.should == Encoding.find("BINARY") if defined?(Encoding)
147
137
  msg.should == data
148
138
  done
149
139
  }
150
140
  }
151
141
 
152
- # Create a fake client which sends draft 76 handshake
153
- connection = EM.connect('0.0.0.0', 12345, FakeWebSocketClient)
154
- connection.send_data(format_request(@request))
142
+ connection = start_client
155
143
 
156
144
  # Send frame
157
145
  connection.onopen {
@@ -164,11 +152,9 @@ describe "draft03" do
164
152
  describe "close handling" do
165
153
  it "should respond to a new close frame with a close frame" do
166
154
  em {
167
- EM::WebSocket.start(:host => "0.0.0.0", :port => 12345) { |ws| }
155
+ start_server
168
156
 
169
- # Create a fake client which sends draft 76 handshake
170
- connection = EM.connect('0.0.0.0', 12345, FakeWebSocketClient)
171
- connection.send_data(format_request(@request))
157
+ connection = start_client
172
158
 
173
159
  # Send close frame
174
160
  connection.onopen {
@@ -183,22 +169,31 @@ describe "draft03" do
183
169
  }
184
170
  end
185
171
 
186
- it "should close the connection on receiving a close acknowlegement" do
172
+ it "should close the connection on receiving a close acknowlegement and call onclose with close code 1005 and was_clean=true (initiated by server)" do
187
173
  em {
188
174
  ack_received = false
189
175
 
190
- EM::WebSocket.start(:host => "0.0.0.0", :port => 12345) { |ws|
176
+ start_server { |ws|
191
177
  ws.onopen {
192
178
  # 2. Send a close frame
193
179
  EM.next_tick {
194
- ws.close_websocket
180
+ ws.close
195
181
  }
196
182
  }
183
+
184
+ # 5. Onclose event on server
185
+ ws.onclose { |event|
186
+ event.should == {
187
+ :code => 1005,
188
+ :reason => "",
189
+ :was_clean => true,
190
+ }
191
+ done
192
+ }
197
193
  }
198
194
 
199
195
  # 1. Create a fake client which sends draft 76 handshake
200
- connection = EM.connect('0.0.0.0', 12345, FakeWebSocketClient)
201
- connection.send_data(format_request(@request))
196
+ connection = start_client
202
197
 
203
198
  # 3. Check that close frame recieved and acknowlege it
204
199
  connection.onmessage { |frame|
@@ -210,18 +205,39 @@ describe "draft03" do
210
205
  # 4. Check that connection is closed _after_ the ack
211
206
  connection.onclose {
212
207
  ack_received.should == true
213
- done
208
+ }
209
+ }
210
+ end
211
+
212
+ # it "should repur"
213
+ #
214
+ it "should return close code 1005 and was_clean=true after closing handshake (initiated by client)" do
215
+ em {
216
+ start_server { |ws|
217
+ ws.onclose { |event|
218
+ event.should == {
219
+ :code => 1005,
220
+ :reason => "",
221
+ :was_clean => true,
222
+ }
223
+ done
224
+ }
225
+ }
226
+ start_client { |client|
227
+ client.onopen {
228
+ client.send_data("\x01\x00")
229
+ }
214
230
  }
215
231
  }
216
232
  end
217
233
 
218
234
  it "should not allow data frame to be sent after close frame sent" do
219
235
  em {
220
- EM::WebSocket.start(:host => "0.0.0.0", :port => 12345) { |ws|
236
+ start_server { |ws|
221
237
  ws.onopen {
222
238
  # 2. Send a close frame
223
239
  EM.next_tick {
224
- ws.close_websocket
240
+ ws.close
225
241
  }
226
242
 
227
243
  # 3. Check that exception raised if I attempt to send more data
@@ -235,25 +251,23 @@ describe "draft03" do
235
251
  }
236
252
 
237
253
  # 1. Create a fake client which sends draft 76 handshake
238
- connection = EM.connect('0.0.0.0', 12345, FakeWebSocketClient)
239
- connection.send_data(format_request(@request))
254
+ start_client
240
255
  }
241
256
  end
242
257
 
243
258
  it "should still respond to control frames after close frame sent" do
244
259
  em {
245
- EM::WebSocket.start(:host => "0.0.0.0", :port => 12345) { |ws|
260
+ start_server { |ws|
246
261
  ws.onopen {
247
262
  # 2. Send a close frame
248
263
  EM.next_tick {
249
- ws.close_websocket
264
+ ws.close
250
265
  }
251
266
  }
252
267
  }
253
268
 
254
269
  # 1. Create a fake client which sends draft 76 handshake
255
- connection = EM.connect('0.0.0.0', 12345, FakeWebSocketClient)
256
- connection.send_data(format_request(@request))
270
+ connection = start_client
257
271
 
258
272
  connection.onmessage { |frame|
259
273
  if frame == "\x01\x00"
@@ -268,5 +282,17 @@ describe "draft03" do
268
282
  }
269
283
  }
270
284
  end
285
+
286
+ it "should report that close codes are not supported" do
287
+ em {
288
+ start_server { |ws|
289
+ ws.onopen {
290
+ ws.supports_close_codes?.should == false
291
+ done
292
+ }
293
+ }
294
+ start_client
295
+ }
296
+ end
271
297
  end
272
298
  end
@@ -20,28 +20,30 @@ describe "draft05" do
20
20
  }
21
21
  }
22
22
  end
23
-
24
- def start_server
25
- EM::WebSocket.start(:host => "0.0.0.0", :port => 12345) { |ws|
26
- yield ws
27
- }
28
- end
29
23
 
30
24
  def start_client
31
- client = EM.connect('0.0.0.0', 12345, Draft03FakeWebSocketClient)
25
+ client = EM.connect('0.0.0.0', 12345, Draft05FakeWebSocketClient)
32
26
  client.send_data(format_request(@request))
33
27
  yield client if block_given?
28
+ return client
34
29
  end
35
30
 
36
- it "should open connection" do
31
+ it_behaves_like "a websocket server" do
32
+ let(:version) { 5 }
33
+ end
34
+
35
+ it_behaves_like "a WebSocket server drafts 3 and above" do
36
+ let(:version) { 5 }
37
+ end
38
+
39
+ it "should report that close codes are not supported" do
37
40
  em {
38
- start_server { |server|
39
- server.onopen {
40
- server.instance_variable_get(:@handler).class.should == EventMachine::WebSocket::Handler05
41
+ start_server { |ws|
42
+ ws.onopen {
43
+ ws.supports_close_codes?.should == false
41
44
  done
42
45
  }
43
46
  }
44
-
45
47
  start_client
46
48
  }
47
49
  end
@@ -26,22 +26,26 @@ describe "draft06" do
26
26
  "Upgrade" => "websocket",
27
27
  "Connection" => "Upgrade",
28
28
  "Sec-WebSocket-Accept" => "s3pPLMBiTxaQ9kYGzzhZRbK+xOo=",
29
+ "Sec-WebSocket-Protocol" => "sample",
29
30
  }
30
31
  }
31
32
  end
32
-
33
- def start_server
34
- EM::WebSocket.start(:host => "0.0.0.0", :port => 12345) { |ws|
35
- yield ws
36
- }
37
- end
38
33
 
39
34
  def start_client
40
- client = EM.connect('0.0.0.0', 12345, Draft03FakeWebSocketClient)
35
+ client = EM.connect('0.0.0.0', 12345, Draft05FakeWebSocketClient)
41
36
  client.send_data(format_request(@request))
42
37
  yield client if block_given?
38
+ return client
43
39
  end
44
40
 
41
+ it_behaves_like "a websocket server" do
42
+ let(:version) { 6 }
43
+ end
44
+
45
+ it_behaves_like "a WebSocket server drafts 3 and above" do
46
+ let(:version) { 6 }
47
+ end
48
+
45
49
  it "should open connection" do
46
50
  em {
47
51
  start_server { |server|
@@ -82,4 +86,60 @@ describe "draft06" do
82
86
  }
83
87
  }
84
88
  end
89
+
90
+ it "should return close code and reason if closed via handshake" do
91
+ em {
92
+ start_server { |ws|
93
+ ws.onclose { |event|
94
+ # 2. Receive close event in server
95
+ event.should == {
96
+ :code => 4004,
97
+ :reason => "close reason",
98
+ :was_clean => true,
99
+ }
100
+ done
101
+ }
102
+ }
103
+ start_client { |client|
104
+ client.onopen {
105
+ # 1: Send close handshake
106
+ close_data = [4004].pack('n')
107
+ close_data << "close reason"
108
+ client.send_frame(:close, close_data)
109
+ }
110
+ }
111
+ }
112
+ end
113
+
114
+ it "should return close code 1005 if no code was specified" do
115
+ em {
116
+ start_server { |ws|
117
+ ws.onclose { |event|
118
+ event.should == {
119
+ :code => 1005,
120
+ :reason => "",
121
+ :was_clean => true,
122
+ }
123
+ done
124
+ }
125
+ }
126
+ start_client { |client|
127
+ client.onopen {
128
+ client.send_frame(:close, '')
129
+ }
130
+ }
131
+ }
132
+ end
133
+
134
+ it "should report that close codes are supported" do
135
+ em {
136
+ start_server { |ws|
137
+ ws.onopen {
138
+ ws.supports_close_codes?.should == true
139
+ done
140
+ }
141
+ }
142
+ start_client
143
+ }
144
+ end
85
145
  end
@@ -1,5 +1,6 @@
1
+ # encoding: BINARY
2
+
1
3
  require 'helper'
2
- require 'integration/shared_examples'
3
4
 
4
5
  describe "draft13" do
5
6
  include EM::SpecHelper
@@ -27,33 +28,31 @@ describe "draft13" do
27
28
  "Upgrade" => "websocket",
28
29
  "Connection" => "Upgrade",
29
30
  "Sec-WebSocket-Accept" => "s3pPLMBiTxaQ9kYGzzhZRbK+xOo=",
31
+ "Sec-WebSocket-Protocol" => "sample",
30
32
  }
31
33
  }
32
34
  end
33
35
 
36
+ def start_client
37
+ client = EM.connect('0.0.0.0', 12345, Draft07FakeWebSocketClient)
38
+ client.send_data(format_request(@request))
39
+ yield client if block_given?
40
+ return client
41
+ end
42
+
34
43
  it_behaves_like "a websocket server" do
35
44
  let(:version) { 13 }
45
+ end
36
46
 
37
- def start_server
38
- EM::WebSocket.start(:host => "0.0.0.0", :port => 12345) { |ws|
39
- yield ws
40
- }
41
- end
42
-
43
- def start_client
44
- client = EM.connect('0.0.0.0', 12345, Draft07FakeWebSocketClient)
45
- client.send_data(format_request(@request))
46
- yield client if block_given?
47
- end
47
+ it_behaves_like "a WebSocket server drafts 3 and above" do
48
+ let(:version) { 13 }
48
49
  end
49
50
 
50
51
  it "should send back the correct handshake response" do
51
52
  em {
52
- EventMachine::WebSocket.start(:host => "0.0.0.0", :port => 12345) { }
53
+ start_server
53
54
 
54
- # Create a fake client which sends draft 13 handshake
55
- connection = EM.connect('0.0.0.0', 12345, Draft07FakeWebSocketClient)
56
- connection.send_data(format_request(@request))
55
+ connection = start_client
57
56
 
58
57
  connection.onopen {
59
58
  connection.handshake_response.lines.sort.
@@ -66,7 +65,7 @@ describe "draft13" do
66
65
  # TODO: This test would be much nicer with a real websocket client...
67
66
  it "should support sending pings and binding to onpong" do
68
67
  em {
69
- EventMachine::WebSocket.start(:host => "0.0.0.0", :port => 12345) { |ws|
68
+ start_server { |ws|
70
69
  ws.onopen {
71
70
  ws.should be_pingable
72
71
  EM.next_tick {
@@ -80,9 +79,7 @@ describe "draft13" do
80
79
  }
81
80
  }
82
81
 
83
- # Create a fake client which sends draft 13 handshake
84
- connection = EM.connect('0.0.0.0', 12345, Draft07FakeWebSocketClient)
85
- connection.send_data(format_request(@request))
82
+ connection = start_client
86
83
 
87
84
  # Confusing, fake onmessage means any data after the handshake
88
85
  connection.onmessage { |data|
@@ -93,4 +90,16 @@ describe "draft13" do
93
90
  }
94
91
  }
95
92
  end
93
+
94
+ it "should report that close codes are supported" do
95
+ em {
96
+ start_server { |ws|
97
+ ws.onopen {
98
+ ws.supports_close_codes?.should == true
99
+ done
100
+ }
101
+ }
102
+ start_client
103
+ }
104
+ end
96
105
  end
@@ -1,5 +1,4 @@
1
1
  require 'helper'
2
- require 'integration/shared_examples'
3
2
 
4
3
  # These integration tests are older and use a different testing style to the
5
4
  # integration tests for newer drafts. They use EM::HttpRequest which happens
@@ -9,40 +8,35 @@ describe "WebSocket server draft75" do
9
8
  include EM::SpecHelper
10
9
  default_timeout 1
11
10
 
11
+ def start_client
12
+ client = Draft75WebSocketClient.new
13
+ yield client if block_given?
14
+ return client
15
+ end
16
+
12
17
  it_behaves_like "a websocket server" do
13
18
  let(:version) { 75 }
14
-
15
- def start_server
16
- EM::WebSocket.start(:host => "0.0.0.0", :port => 12345) { |ws|
17
- yield ws
18
- }
19
- end
20
-
21
- def start_client
22
- client = Draft75WebSocketClient.new
23
- yield client if block_given?
24
- end
25
19
  end
26
20
 
27
21
  it "should automatically complete WebSocket handshake" do
28
22
  em {
29
23
  MSG = "Hello World!"
30
24
  EventMachine.add_timer(0.1) do
31
- http = EventMachine::HttpRequest.new('ws://127.0.0.1:12345/').get :timeout => 0
32
- http.errback { fail }
33
- http.callback { http.response_header.status.should == 101 }
25
+ ws = EventMachine::WebSocketClient.connect('ws://127.0.0.1:12345/')
26
+ ws.errback { fail }
27
+ ws.callback { }
34
28
 
35
- http.stream { |msg|
36
- msg.should == MSG
29
+ ws.stream { |msg|
30
+ msg.data.should == MSG
37
31
  EventMachine.stop
38
32
  }
39
33
  end
40
34
 
41
- EventMachine::WebSocket.start(:host => "0.0.0.0", :port => 12345) do |ws|
35
+ start_server { |ws|
42
36
  ws.onopen {
43
37
  ws.send MSG
44
38
  }
45
- end
39
+ }
46
40
  }
47
41
  end
48
42
 
@@ -52,17 +46,16 @@ describe "WebSocket server draft75" do
52
46
  received = []
53
47
 
54
48
  EventMachine.add_timer(0.1) do
55
- http = EventMachine::HttpRequest.new('ws://127.0.0.1:12345/').get :timeout => 0
56
- http.errback { fail }
57
- http.stream {|msg|}
58
- http.callback {
59
- http.response_header.status.should == 101
60
- http.send messages[0]
61
- http.send messages[1]
49
+ ws = EventMachine::WebSocketClient.connect('ws://127.0.0.1:12345/')
50
+ ws.errback { fail }
51
+ ws.stream {|msg|}
52
+ ws.callback {
53
+ ws.send_msg messages[0]
54
+ ws.send_msg messages[1]
62
55
  }
63
56
  end
64
57
 
65
- EventMachine::WebSocket.start(:host => "0.0.0.0", :port => 12345) do |ws|
58
+ start_server { |ws|
66
59
  ws.onopen {}
67
60
  ws.onclose {}
68
61
  ws.onmessage {|msg|
@@ -71,41 +64,40 @@ describe "WebSocket server draft75" do
71
64
 
72
65
  EventMachine.stop if received.size == messages.size
73
66
  }
74
- end
67
+ }
75
68
  }
76
69
  end
77
70
 
78
71
  it "should call onclose callback when client closes connection" do
79
72
  em {
80
73
  EventMachine.add_timer(0.1) do
81
- http = EventMachine::HttpRequest.new('ws://127.0.0.1:12345/').get :timeout => 0
82
- http.errback { fail }
83
- http.callback {
84
- http.response_header.status.should == 101
85
- http.close_connection
74
+ ws = EventMachine::WebSocketClient.connect('ws://127.0.0.1:12345/')
75
+ ws.errback { fail }
76
+ ws.callback {
77
+ ws.close_connection
86
78
  }
87
- http.stream{|msg|}
79
+ ws.stream{|msg|}
88
80
  end
89
81
 
90
- EventMachine::WebSocket.start(:host => "0.0.0.0", :port => 12345) do |ws|
82
+ start_server { |ws|
91
83
  ws.onopen {}
92
84
  ws.onclose {
93
85
  ws.state.should == :closed
94
86
  EventMachine.stop
95
87
  }
96
- end
88
+ }
97
89
  }
98
90
  end
99
91
 
100
92
  it "should call onerror callback with raised exception and close connection on bad handshake" do
101
93
  em {
102
94
  EventMachine.add_timer(0.1) do
103
- http = EventMachine::HttpRequest.new('http://127.0.0.1:12345/').get :timeout => 0
104
- http.errback { http.response_header.status.should == 0 }
95
+ http = EM::HttpRequest.new('http://127.0.0.1:12345/').get
96
+ http.errback { }
105
97
  http.callback { fail }
106
98
  end
107
99
 
108
- EventMachine::WebSocket.start(:host => "0.0.0.0", :port => 12345) do |ws|
100
+ start_server { |ws|
109
101
  ws.onopen { fail }
110
102
  ws.onclose { EventMachine.stop }
111
103
  ws.onerror {|e|
@@ -113,7 +105,19 @@ describe "WebSocket server draft75" do
113
105
  e.message.should match('Not an upgrade request')
114
106
  EventMachine.stop
115
107
  }
116
- end
108
+ }
109
+ }
110
+ end
111
+
112
+ it "should report that close codes are not supported" do
113
+ em {
114
+ start_server { |ws|
115
+ ws.onopen {
116
+ ws.supports_close_codes?.should == false
117
+ done
118
+ }
119
+ }
120
+ start_client
117
121
  }
118
122
  end
119
123
  end