Sha256: b38baecbe0917080d7ae4c9bb5a5d6ecf6caf2f164a4a89b66935b3fdb198d86
Contents?: true
Size: 1.07 KB
Versions: 7
Compression:
Stored size: 1.07 KB
Contents
require 'helper' describe "draft05" do include EM::SpecHelper default_timeout 1 before :each do @request = { :port => 80, :method => "GET", :path => "/demo", :headers => { 'Host' => 'example.com', 'Upgrade' => 'websocket', 'Connection' => 'Upgrade', 'Sec-WebSocket-Key' => 'dGhlIHNhbXBsZSBub25jZQ==', 'Sec-WebSocket-Protocol' => 'sample', 'Sec-WebSocket-Origin' => 'http://example.com', 'Sec-WebSocket-Version' => '5' } } end def start_server EM::WebSocket.start(:host => "0.0.0.0", :port => 12345) { |ws| yield ws } end def start_client client = EM.connect('0.0.0.0', 12345, Draft03FakeWebSocketClient) client.send_data(format_request(@request)) yield client if block_given? end it "should open connection" do em { start_server { |server| server.onopen { server.instance_variable_get(:@handler).class.should == EventMachine::WebSocket::Handler05 done } } start_client } end end
Version data entries
7 entries across 7 versions & 2 rubygems