Class Http2FlowControlBodies
Why this exists. Four HTTP/2 defects (GitHub #2641, #2667, #2669, #2683) all shipped while
every HTTP/2 test was green, for one structural reason: every HTTP/2 test used a response body
smaller than the 65535-byte flow-control window — including the one
literally named shouldForwardHttp2RequestWithLargeBodyViaConnectProxy at 50,000 bytes. A body
that fits in the peer's first window is delivered without any WINDOW_UPDATE, so the
writePendingBytes() flush those defects live in is never exercised, and the whole family of
bugs — whose failure mode is a silent hang, not a wrong answer — is invisible. See
docs/code/netty-pipeline.md ("Testing convention: an HTTP/2 test MUST use a response body
larger than the flow-control window").
What this gives you. A named set of sizes (Http2FlowControlBodies.Size.SMALL, Http2FlowControlBodies.Size.OVER_WINDOW,
Http2FlowControlBodies.Size.LARGE) so a new HTTP/2 test crosses the window by construction — the author picks
OVER_WINDOW without having to know the 65,535-byte history or type a magic number. Bodies are
deterministic and distinguishable: the content is stamped throughout with a caller-supplied
marker, so a mis-routed body (delivered on the wrong h2 stream) or a truncated body fails an
equality assertion, not merely a length check.
Lives in mockserver-testing (package org.mockserver.test) rather than in a single
test tree because it is a compile-scope dependency of mockserver-integration-testing and a
test dependency of mockserver-netty, mockserver-war and the rest — so every module
with HTTP/2 tests can reach it. It has no dependency beyond the JDK.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumNamed body sizes for HTTP/2 tests. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intThe HTTP/2 initial flow-control window in bytes, per RFC 7540 / 9113 §6.9.2. -
Method Summary
Modifier and TypeMethodDescriptionstatic Stringbody(Http2FlowControlBodies.Size size, String marker) A deterministic body of exactlysizebytes whose filler is stamped throughout withmarker, so a mis-routed or truncated body cannot equal the expected one anywhere along its length.
-
Field Details
-
FLOW_CONTROL_WINDOW_BYTES
public static final int FLOW_CONTROL_WINDOW_BYTESThe HTTP/2 initial flow-control window in bytes, per RFC 7540 / 9113 §6.9.2. A response at or under this size is delivered inside the peer's first window and never drives aWINDOW_UPDATE, so it cannot exercise the flow-control flush. This is the threshold everyHttp2FlowControlBodies.Size.OVER_WINDOWbody must clear.- See Also:
-
-
Method Details
-
body
A deterministic body of exactlysizebytes whose filler is stamped throughout withmarker, so a mis-routed or truncated body cannot equal the expected one anywhere along its length. Give each concurrently-multiplexed stream a distinct marker so a body delivered on the wrong stream fails an equality assertion.- Parameters:
size- the named body size (useHttp2FlowControlBodies.Size.OVER_WINDOWfor any real HTTP/2 assertion)marker- a short label stamped throughout the body; must be non-empty- Returns:
- a String of exactly
Http2FlowControlBodies.Size.bytes()characters
-