rouse-context/core/mcp
monkopedia-coder 625329436b
Some checks failed
Android CI / test (push) Has been cancelled
CI / Lint (push) Has been cancelled
CI / Build & Test (push) Has been cancelled
Test the read timeout, the other half of #761 (#767)
Review on #763 found the cap half of that fix pinned six ways and the timeout
half implemented but untested -- the "fix the half that is easier to test"
shape. #763 merged before this landed, so it follows here.

A cap without a timeout still admits a slowloris: a client that declares a
body comfortably UNDER the cap and then stops sending holds the request
coroutine open indefinitely, and the cap cannot catch it because by
construction the body is small.

Adds a raw-socket test that declares `Content-Length: 200` (under the cap, so
the cheap pre-check cannot fire), sends 20 bytes and goes silent. The only
thing that can end that request is the 5s read timeout. It asserts both that
the server answered and that the answer took at least three quarters of the
timeout -- the elapsed time is what separates "the timeout fired" from "the
body parsed instantly and the status means something unrelated".

Paired with a control sending the same declared body in full, which must be
answered in well under the timeout. Without it, a server that simply waited
5s before answering everything would pass.

Pinned by mutation rather than asserted: raising TOKEN_BODY_TIMEOUT_MS from
5s to 600s fails the stall test with `java.net.SocketTimeoutException: Read
timed out` -- the server hanging, which is the slowloris the timeout exists
to prevent.

Tests only; no production change.


Claude-Session: https://claude.ai/code/session_01YYSPuh9bZEJkrzvnEpY1QK

Co-authored-by: monkopedia-coder <monkopedia-coder@users.noreply.github.com>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-09-15 10:49:19 -04:00
..
src Test the read timeout, the other half of #761 (#767) 2026-09-15 10:49:19 -04:00
build.gradle.kts Fix #248: Add Kover coverage measurement + CI aggregated report (#254) 2026-04-18 17:11:09 -04:00