FakeSeam
A test double for Seam with test-driver helpers for state mutation, frame delivery, and outgoing-frame inspection.
Defaults make FakeSeam() a ready-to-use, single-peer, SeamState.Woven seam in one line:
val seam = FakeSeam()
seam.deliver(PeerId("alice"), byteArrayOf(1, 2, 3))
val frame = seam.incoming.first()For wired two-peer scenarios, prefer fakeSeamPair which cross-wires broadcast delivery between two seams.
Send semantics (matching the Seam contract):
broadcast while SeamState.Weaving or SeamState.Woven with no other peers: no-op, but the payload is still recorded in broadcasts.
sendTo to a peer not in peers: throws PeerNotConnected.
Either send while SeamState.Torn: throws IllegalStateException.
Constructors
Properties
All payloads passed to broadcast, in call order. Each read returns a fresh defensive snapshot; two reads may observe different snapshots if a broadcast lands between them.
Functions
Remove peer from the live peers set.
Transition state to SeamState.Torn with reason.
Transition state from SeamState.Weaving to SeamState.Woven.