Skip to content

Commit 27191f0

Browse files
committed
Add test for maximum_concurrent_streams setting change.
1 parent 1c870bc commit 27191f0

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

test/protocol/http2/connection.rb

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,44 @@ def before
242242
expect(frame).to be(:acknowledgement?)
243243
end
244244

245+
it "can update concurrent streams" do
246+
initial_maximum_concurrent_streams = server.maximum_concurrent_streams
247+
inform "Initial maximum concurrent streams: #{initial_maximum_concurrent_streams}"
248+
249+
server.send_settings([
250+
[Protocol::HTTP2::Settings::MAXIMUM_CONCURRENT_STREAMS, 1]
251+
])
252+
253+
# It's not acknowledged until the client sends an acknowledgement:
254+
expect(server).to have_attributes(
255+
maximum_concurrent_streams: be == initial_maximum_concurrent_streams
256+
)
257+
258+
expect(client).to have_attributes(
259+
maximum_concurrent_streams: be == initial_maximum_concurrent_streams
260+
)
261+
262+
frame = client.read_frame
263+
expect(frame).to be_a(Protocol::HTTP2::SettingsFrame)
264+
265+
expect(client).to have_attributes(
266+
maximum_concurrent_streams: be == 1
267+
)
268+
269+
frame = server.read_frame
270+
expect(frame).to be_a(Protocol::HTTP2::SettingsFrame)
271+
expect(frame).to be(:acknowledgement?)
272+
273+
expect(server.local_settings).to have_attributes(
274+
maximum_concurrent_streams: be == 1
275+
)
276+
277+
# The client maximum concurrent streams was not changed because the client did not `send_settings`:
278+
expect(server).to have_attributes(
279+
maximum_concurrent_streams: be == initial_maximum_concurrent_streams
280+
)
281+
end
282+
245283
it "doesn't accept headers for an existing stream" do
246284
stream.send_headers(nil, request_headers)
247285
expect(stream.id).to be == 1

0 commit comments

Comments
 (0)