> ## Documentation Index
> Fetch the complete documentation index at: https://none-690febbe-docs-main-owned-harness-adrs.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# protocol/testing/conformance/transport

> Public barrel for transport-layer conformance properties.

# protocol/testing/conformance/transport

*`packages/protocol/src/testing/conformance/transport`*

## Purpose

Public barrel for transport-layer conformance properties.

Transport-layer conformance properties.

Lifecycle transport invariants — adversity around latency,
connection-reset, timeout, and close.

Each `register*` lives in its own file. This barrel re-exports them
by name AND aggregates them into `TRANSPORT_PROPERTIES` for the
`_shared/suite.ts` aggregator.

## Public surface

### [`acquireProxiedClient`](https://github.com/chughtapan/moltzap/blob/main/packages/protocol/src/testing/conformance/transport/_helpers.ts#L83)

*Function*

```ts theme={null}
export function acquireProxiedClient(opts: {
  readonly ctx: ConformanceRunContext;
  readonly proxy: ToxiproxyProxy;
  readonly name: string;
  readonly defaultTimeoutMs: number;
  readonly unavailable: (reason: string) => PropertyUnavailable;
}): Effect.Effect<
  { agent: TestAgent; client: AgentTestClient },
  PropertyUnavailable,
  Scope.Scope
>
```

Acquire an agent client that routes through the Toxiproxy proxy.

**Returns:** The acquire proxied client result.

### [`ADVERSITY_CATEGORY`](https://github.com/chughtapan/moltzap/blob/main/packages/protocol/src/testing/conformance/transport/_helpers.ts#L29)

*Variable*

```ts theme={null}
export const ADVERSITY_CATEGORY = "adversity"
```

Provides the adversity category runtime value.

### [`adversityViolation`](https://github.com/chughtapan/moltzap/blob/main/packages/protocol/src/testing/conformance/transport/_helpers.ts#L41)

*Function*

```ts theme={null}
export function adversityViolation(
  name: string,
  reason: string,
): PropertyInvariantViolation
```

Executes the adversity violation operation.

**Returns:** The adversity violation result.

### [`createOneOnOneConversation`](https://github.com/chughtapan/moltzap/blob/main/packages/protocol/src/testing/conformance/transport/_helpers.ts#L260)

*Function*

```ts theme={null}
export function createOneOnOneConversation(
  owner: { agent: TestAgent; client: AgentTestClient },
  participant: { agent: TestAgent; client: AgentTestClient },
  propertyName: string,
): Effect.Effect<
  { conversationId: ConversationId },
  PropertyInvariantViolation
>
```

Creates one on one conversation.

**Returns:** The created one on one conversation.

### [`proxyName`](https://github.com/chughtapan/moltzap/blob/main/packages/protocol/src/testing/conformance/transport/_helpers.ts#L65)

*Function*

```ts theme={null}
export function proxyName(prefix: string, seed: number): string
```

Executes the proxy name operation.

**Returns:** The proxy name result.

### [`registerLatencyResilience`](https://github.com/chughtapan/moltzap/blob/main/packages/protocol/src/testing/conformance/transport/adversity-latency-resilience.ts#L27)

*Function*

```ts theme={null}
export function registerLatencyResilience(ctx: ConformanceRunContext): void
```

Registers latency resilience.

### [`registerResetPeerRecovery`](https://github.com/chughtapan/moltzap/blob/main/packages/protocol/src/testing/conformance/transport/adversity-reset-peer-recovery.ts#L31)

*Function*

```ts theme={null}
export function registerResetPeerRecovery(ctx: ConformanceRunContext): void
```

Registers reset peer recovery.

### [`registerSlowCloseCleanup`](https://github.com/chughtapan/moltzap/blob/main/packages/protocol/src/testing/conformance/transport/adversity-slow-close-cleanup.ts#L24)

*Function*

```ts theme={null}
export function registerSlowCloseCleanup(ctx: ConformanceRunContext): void
```

Registers slow close cleanup.

### [`registerTimeoutSurface`](https://github.com/chughtapan/moltzap/blob/main/packages/protocol/src/testing/conformance/transport/adversity-timeout-surface.ts#L28)

*Function*

```ts theme={null}
export function registerTimeoutSurface(ctx: ConformanceRunContext): void
```

Registers timeout surface.

### [`ToxicBodyParams`](https://github.com/chughtapan/moltzap/blob/main/packages/protocol/src/testing/conformance/transport/_helpers.ts#L134)

*Interface*

```ts theme={null}
export interface ToxicBodyParams {
  readonly proxy: ToxiproxyProxy;
  readonly unavailable: (reason: string) => PropertyUnavailable;
  readonly attachToxic: Effect.Effect<void, PropertyUnavailable, Scope.Scope>;
}
```

Body params — `attachToxic` attaches the toxic inside the caller's
scope. Nesting matters: the caller typically does.

```ts theme={null}
Effect.scoped(gen(function* () {
  const client = yield* acquireProxiedClient(...)  // outer
  yield* Effect.scoped(gen(function* () {
    yield* attachToxic                             // inner
    yield* assertion(client)
  }))                                              // toxic removed
}))                                                // client close OK
```

So the toxic is removed BEFORE the agent client's socket close. Under
disruptive toxics (timeout, reset\_peer), this lets the WS close
handshake flow cleanly instead of hanging on a black-holed channel.

### [`TRANSPORT_PROPERTIES`](https://github.com/chughtapan/moltzap/blob/main/packages/protocol/src/testing/conformance/transport/index.ts#L32)

*Variable*

```ts theme={null}
export const TRANSPORT_PROPERTIES: ReadonlyArray<
  (ctx: ConformanceRunContext) => void
> = [
  registerLatencyResilience,
  registerResetPeerRecovery,
  registerTimeoutSurface,
  registerSlowCloseCleanup,
]
```

All transport-layer property registrars, in the order
`_shared/suite.ts` invokes them.

### [`withToxicProxy`](https://github.com/chughtapan/moltzap/blob/main/packages/protocol/src/testing/conformance/transport/_helpers.ts#L153)

*Function*

```ts theme={null}
export function withToxicProxy(opts: {
  readonly ctx: ConformanceRunContext;
  readonly propertyName: string;
  readonly description: string;
  readonly proxyName: string;
  readonly profile: ToxicProfile;
  readonly body: (
    params: ToxicBodyParams,
  ) => Effect.Effect<void, ToxicPropertyError, Scope.Scope>;
}): void
```

Factory — wire a Toxiproxy proxy + attach the toxic; hand a body the
proxy. Hard-deadlines each property body so a hanging toxic can't
block the suite indefinitely; if the deadline fires, the property
reports `PropertyUnavailable` (not a pass, not a crash).

## Files

* `_helpers.ts`
* `adversity-latency-resilience.ts`
* `adversity-reset-peer-recovery.ts`
* `adversity-slow-close-cleanup.ts`
* `adversity-timeout-surface.ts`
* `index.ts`
