Module 16: In-Memory Testing
Test client-agent communication without subprocesses or I/O.What You’ll Learn
- Using
InMemoryTransportPairfromacp-test - Wiring a client and agent together in-process
- Fast, deterministic testing without external dependencies
The Code
InMemoryTransportPair from the acp-test module creates a pair of connected transports — one for the client, one for the agent. Messages pass through in-memory buffers instead of subprocess stdin/stdout. This makes tests fast, deterministic, and free of external dependencies. The pattern below wires up an agent and client in the same JVM, sends a prompt, and verifies the round-trip:
How It Works
InMemoryTransportPair.create() returns a pair of connected transports:
Messages pass through in-memory buffers. No subprocess launching, no stdin/stdout, no network I/O. This makes tests fast and deterministic.