diff options
author | Kazuki Yamaguchi <k@rhe.jp> | 2015-11-03 11:53:57 +0900 |
---|---|---|
committer | Kazuki Yamaguchi <k@rhe.jp> | 2015-11-03 12:04:22 +0900 |
commit | 3bec944cea2d7c5f09198747e9e33c4cfdbb5cd4 (patch) | |
tree | 6ac5516b441e25e4b96dd707171ae2467235bd49 /test | |
parent | 3a52f04bc7842dd11df6710d10522ad06180d3b2 (diff) | |
download | plum-3bec944cea2d7c5f09198747e9e33c4cfdbb5cd4.tar.gz |
split server into plum/server
Diffstat (limited to 'test')
-rw-r--r-- | test/plum/test_http_connection.rb | 8 | ||||
-rw-r--r-- | test/plum/test_https_connection.rb | 10 | ||||
-rw-r--r-- | test/utils/server.rb | 4 |
3 files changed, 11 insertions, 11 deletions
diff --git a/test/plum/test_http_connection.rb b/test/plum/test_http_connection.rb index ea72a55..bd586a5 100644 --- a/test/plum/test_http_connection.rb +++ b/test/plum/test_http_connection.rb @@ -5,7 +5,7 @@ using Plum::BinaryString class HTTPConnectionNegotiationTest < Minitest::Test ## with Prior Knowledge (same as over TLS) def test_server_must_raise_cprotocol_error_non_settings_after_magic - con = HTTPConnection.new(StringIO.new) + con = HTTPServerConnection.new(StringIO.new) con << Connection::CLIENT_CONNECTION_PREFACE assert_connection_error(:protocol_error) { con << Frame.new(type: :window_update, stream_id: 0, payload: "".push_uint32(1)).assemble @@ -14,7 +14,7 @@ class HTTPConnectionNegotiationTest < Minitest::Test def test_server_accept_fragmented_magic magic = Connection::CLIENT_CONNECTION_PREFACE - con = HTTPConnection.new(StringIO.new) + con = HTTPServerConnection.new(StringIO.new) assert_no_error { con << magic[0...5] con << magic[5..-1] @@ -25,7 +25,7 @@ class HTTPConnectionNegotiationTest < Minitest::Test ## with HTTP/1.1 Upgrade def test_server_accept_upgrade io = StringIO.new - con = HTTPConnection.new(io) + con = HTTPServerConnection.new(io) heads = nil con.on(:headers) {|_, _h| heads = _h.to_h } req = "GET / HTTP/1.1\r\n" << @@ -47,7 +47,7 @@ class HTTPConnectionNegotiationTest < Minitest::Test def test_server_deny_non_upgrade io = StringIO.new - con = HTTPConnection.new(io) + con = HTTPServerConnection.new(io) req = "GET / HTTP/1.1\r\n" << "Host: rhe.jp\r\n" << "User-Agent: nya\r\n" << diff --git a/test/plum/test_https_connection.rb b/test/plum/test_https_connection.rb index b08f7be..52a1cf5 100644 --- a/test/plum/test_https_connection.rb +++ b/test/plum/test_https_connection.rb @@ -4,21 +4,21 @@ using Plum::BinaryString class HTTPSConnectionNegotiationTest < Minitest::Test def test_server_must_raise_cprotocol_error_invalid_magic_short - con = HTTPSConnection.new(StringIO.new) + con = HTTPSServerConnection.new(StringIO.new) assert_connection_error(:protocol_error) { con << "HELLO" } end def test_server_must_raise_cprotocol_error_invalid_magic_long - con = HTTPSConnection.new(StringIO.new) + con = HTTPSServerConnection.new(StringIO.new) assert_connection_error(:protocol_error) { con << ("HELLO" * 100) # over 24 } end def test_server_must_raise_cprotocol_error_non_settings_after_magic - con = HTTPSConnection.new(StringIO.new) + con = HTTPSServerConnection.new(StringIO.new) con << Connection::CLIENT_CONNECTION_PREFACE assert_connection_error(:protocol_error) { con << Frame.new(type: :window_update, stream_id: 0, payload: "".push_uint32(1)).assemble @@ -27,7 +27,7 @@ class HTTPSConnectionNegotiationTest < Minitest::Test def test_server_accept_fragmented_magic magic = Connection::CLIENT_CONNECTION_PREFACE - con = HTTPSConnection.new(StringIO.new) + con = HTTPSServerConnection.new(StringIO.new) assert_no_error { con << magic[0...5] con << magic[5..-1] @@ -49,7 +49,7 @@ class HTTPSConnectionNegotiationTest < Minitest::Test begin Timeout.timeout(3) { sock = ssl_server.accept - plum = HTTPSConnection.new(sock) + plum = HTTPSServerConnection.new(sock) assert_connection_error(:inadequate_security) { run = true plum.run diff --git a/test/utils/server.rb b/test/utils/server.rb index 8d1c81d..82eb00f 100644 --- a/test/utils/server.rb +++ b/test/utils/server.rb @@ -3,7 +3,7 @@ require "timeout" module ServerUtils def open_server_connection(scheme = :https) io = StringIO.new - @_con = (scheme == :https ? HTTPSConnection : HTTPConnection).new(io) + @_con = (scheme == :https ? HTTPSServerConnection : HTTPServerConnection).new(io) @_con << Connection::CLIENT_CONNECTION_PREFACE @_con << Frame.new(type: :settings, stream_id: 0).assemble if block_given? @@ -14,7 +14,7 @@ module ServerUtils end def open_new_stream(arg1 = nil, **kwargs) - if arg1.is_a?(Connection) + if arg1.is_a?(ServerConnection) con = arg1 else con = open_server_connection |