The server library supports deterministic testing without TLS or
real sockets using Http2ServerTestUtil and ConnCreateTest.
VAR cp: ConnPtr;
ConnCreateTest(NIL, 1, cp); (* no server, conn id=1 *)
(* ... send frames, check responses ... *)
ConnClose(cp);
PROCEDURE FeedAndCollect(cp: ConnPtr; VAR input: Buf; VAR output: Buf);
Feeds raw bytes into the connection's read buffer, processes them, and collects the server's output frames.
Build client-to-server frames using the Build* procedures:
Init(input, 1024);
BuildClientPreface(input);
BuildSettings(input, settings);
FeedAndCollect(cp, input, output);
Parse server-to-client frames using ReadNextFrame:
v := AsView(output);
WHILE ReadNextFrame(v, hdr, payload) DO
IF hdr.ftype = FrameSettings THEN (* ... *) END;
END;
Send client preface + SETTINGS. Verify server responds with SETTINGS frame and SETTINGS ACK.
After handshake, send GET HEADERS on stream 1.
Verify stream allocation (lastPeerStream = 1).
Send POST headers + split DATA frames. Verify WINDOW_UPDATE sent after each DATA frame.
Open 3 streams (1, 3, 5) simultaneously. Verify all accepted.
Send 1000-byte DATA frame. Verify both connection-level and stream-level WINDOW_UPDATE frames.
Send PING with 8 bytes. Verify PING ACK with same data.
- Invalid preface → GOAWAY
- HEADERS on stream 0 → GOAWAY
- HEADERS on even stream → GOAWAY