Skip to content
This repository was archived by the owner on Jan 13, 2021. It is now read-only.

Commit 4bdd0e3

Browse files
committed
Make sure GoAway frame is sent when tearing down the connection
1 parent adc6418 commit 4bdd0e3

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

test/test_hyper.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,8 @@ def test_connections_handle_too_small_max_frame_size_properly(self):
273273
c._sock = sock
274274

275275
# 'Receive' the SETTINGS frame.
276-
c.receive_frame(f)
276+
with pytest.raises(ConnectionError):
277+
c.receive_frame(f)
277278

278279
# The value advertised by an endpoint MUST be between 2^14 and
279280
# 2^24-1 octets. Confirm that the max frame size did not increase.
@@ -283,6 +284,10 @@ def test_connections_handle_too_small_max_frame_size_properly(self):
283284
# the spec dictates to tear down the connection.
284285
assert c._sock == None
285286

287+
# Check if GoAway frame was correctly sent to the endpoint
288+
f = decode_frame(sock.queue[0])
289+
assert isinstance(f, GoAwayFrame)
290+
286291
def test_connections_handle_too_big_max_frame_size_properly(self):
287292
sock = DummySocket()
288293
f = SettingsFrame(0)
@@ -291,7 +296,8 @@ def test_connections_handle_too_big_max_frame_size_properly(self):
291296
c._sock = sock
292297

293298
# 'Receive' the SETTINGS frame.
294-
c.receive_frame(f)
299+
with pytest.raises(ConnectionError):
300+
c.receive_frame(f)
295301

296302
# The value advertised by an endpoint MUST be between 2^14 and
297303
# 2^24-1 octets. Confirm that the max frame size did not increase.
@@ -301,6 +307,10 @@ def test_connections_handle_too_big_max_frame_size_properly(self):
301307
# the spec dictates to tear down the connection.
302308
assert c._sock == None
303309

310+
# Check if GoAway frame was correctly sent to the endpoint
311+
f = decode_frame(sock.queue[0])
312+
assert isinstance(f, GoAwayFrame)
313+
304314
def test_connections_handle_resizing_header_tables_properly(self):
305315
sock = DummySocket()
306316
f = SettingsFrame(0)

0 commit comments

Comments
 (0)