Skip to content

Class FaultInjectingRpcChannel

Namespace: DotBoxD.Services.Testing
Assembly: DotBoxD.Services.dll

Wraps a channel and invokes a deterministic hook before each send or receive. The hook may delay, cancel, disconnect, or throw to exercise consumer recovery paths.

public sealed class FaultInjectingRpcChannel : IRpcChannel, IAsyncDisposable

objectFaultInjectingRpcChannel

IRpcChannel, IAsyncDisposable

object.Equals(object), object.Equals(object, object), object.GetHashCode(), object.GetType(), object.ReferenceEquals(object, object), object.ToString()

FaultInjectingRpcChannel(IRpcChannel, Func<RpcChannelOperation, int, CancellationToken, ValueTask>)

Section titled “ FaultInjectingRpcChannel(IRpcChannel, Func<RpcChannelOperation, int, CancellationToken, ValueTask>)”
public FaultInjectingRpcChannel(IRpcChannel inner, Func<RpcChannelOperation, int, CancellationToken, ValueTask> beforeOperation)

inner IRpcChannel

beforeOperation Func<RpcChannelOperation, int, CancellationToken, ValueTask>

FaultInjectingRpcChannel(IRpcChannel, Func<RpcChannelOperation, int, CancellationToken, ValueTask>, Func<ReadOnlyMemory<byte>, int, CancellationToken, ValueTask<ReadOnlyMemory<byte>>>)

Section titled “ FaultInjectingRpcChannel(IRpcChannel, Func<RpcChannelOperation, int, CancellationToken, ValueTask>, Func<ReadOnlyMemory<byte>, int, CancellationToken, ValueTask<ReadOnlyMemory<byte>>>)”
public FaultInjectingRpcChannel(IRpcChannel inner, Func<RpcChannelOperation, int, CancellationToken, ValueTask> beforeOperation, Func<ReadOnlyMemory<byte>, int, CancellationToken, ValueTask<ReadOnlyMemory<byte>>> transformSend)

inner IRpcChannel

beforeOperation Func<RpcChannelOperation, int, CancellationToken, ValueTask>

transformSend Func<ReadOnlyMemory<byte>, int, CancellationToken, ValueTask<ReadOnlyMemory<byte>>>

Gets whether the channel is currently connected.

public bool IsConnected { get; }

bool

Gets a string representation of the remote endpoint.

public string RemoteEndpoint { get; }

string

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources asynchronously.

public ValueTask DisposeAsync()

ValueTask

A task that represents the asynchronous dispose operation.

Receives a framed message. The caller owns the returned DotBoxD.Services.Buffers.Payload and must dispose it. A payload with DotBoxD.Services.Buffers.Payload.Length of 0 signals the channel was closed.

public Task<Payload> ReceiveAsync(CancellationToken ct = default)

ct CancellationToken

Task<Payload>

SendAsync(ReadOnlyMemory<byte>, CancellationToken)

Section titled “ SendAsync(ReadOnlyMemory<byte>, CancellationToken)”

Sends a framed message over the channel.

public Task SendAsync(ReadOnlyMemory<byte> data, CancellationToken ct = default)

data ReadOnlyMemory<byte>

ct CancellationToken

Task