summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKazuki Yamaguchi <k@rhe.jp>2015-08-09 20:53:22 +0900
committerKazuki Yamaguchi <k@rhe.jp>2015-08-09 20:53:22 +0900
commitf71488ac152c89ad65293643da44d70f2667fe87 (patch)
tree37228e95b02e0f90f722cbea4a05796770466e84
parenta44c391cf861b7bd8331de94026cb21f154b1716 (diff)
downloadplum-f71488ac152c89ad65293643da44d70f2667fe87.tar.gz
connection: reply GOAWAY when received GOAWAY
-rw-r--r--lib/plum/connection.rb1
-rw-r--r--test/plum/connection/test_handle_frame.rb10
-rw-r--r--test/test_helper.rb1
3 files changed, 12 insertions, 0 deletions
diff --git a/lib/plum/connection.rb b/lib/plum/connection.rb
index 776fd32..ca6280d 100644
--- a/lib/plum/connection.rb
+++ b/lib/plum/connection.rb
@@ -154,6 +154,7 @@ module Plum
when :ping
receive_ping(frame)
when :goaway
+ goaway
close
when :data, :headers, :priority, :rst_stream, :push_promise, :continuation
raise Plum::ConnectionError.new(:protocol_error)
diff --git a/test/plum/connection/test_handle_frame.rb b/test/plum/connection/test_handle_frame.rb
index 04573ef..9f8d647 100644
--- a/test/plum/connection/test_handle_frame.rb
+++ b/test/plum/connection/test_handle_frame.rb
@@ -46,4 +46,14 @@ class ServerConnectionHandleFrameTest < Minitest::Test
refute_equal(:ping, last.type) if last
}
end
+
+ ## GOAWAY
+ def test_server_handle_goaway_reply
+ open_server_connection {|con|
+ assert_no_error {
+ con << Frame.goaway(1234, :stream_closed).assemble
+ }
+ assert_equal(:goaway, sent_frames.last.type)
+ }
+ end
end
diff --git a/test/test_helper.rb b/test/test_helper.rb
index fb5aa91..c5fae66 100644
--- a/test/test_helper.rb
+++ b/test/test_helper.rb
@@ -15,6 +15,7 @@ unless ENV["SKIP_COVERAGE"]
end
end
+require "timeout"
require "minitest"
require "minitest/unit"
require "minitest/autorun"