connectionPair

fun connectionPair(policy: DeliveryPolicy = DeliveryPolicy.Reliable, maxFrameBytes: Int? = null, enforcesFrameCeiling: Boolean = false): Pair<Connection, Connection>

Two Connections whose sends cross to each other's incoming. In-memory, no network.

Each direction is a bounded Spool (default DeliveryPolicy.Reliable); there is no Channel.UNLIMITED path. Spool<ByteArray> because a Connection carries raw byte frames, a layer below the Swatch/Seam abstraction.

Parameters

maxFrameBytes

what each end reports as Connection.maxFrameBytes — the frame ceiling a length-prefixed transport would have. Defaults to null (this in-memory pair has no ceiling of its own); pass a value to drive the payload-budget arithmetic the seams above derive from it. Reported, not enforced by default — an oversize frame still crosses, so a test can assert on the budget without also having to fake a rejection. Pass enforcesFrameCeiling when the rejection is the thing under test.

enforcesFrameCeiling

make Connection.send actually refuse a frame over maxFrameBytes, the way a length-prefixed transport does (:kuilt-stream's framed() throws FrameTooLargeException). Off by default so existing budget-arithmetic tests are unaffected.

A test that asserts a seam pre-checks a payload needs this: without it the fake carries the oversize frame happily, so the seam's own pre-check is the only thing that could refuse it and the test passes whether or not the fabric error it exists to prevent would have fired. With it, the test is red before the pre-check exists — and stays honest about which layer refused (a seam that pre-checks raises us.tractat.kuilt.core.PayloadTooLarge; one that does not lets this fake's error through, into whatever the seam does with a failed send).