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, IAsyncDisposableInheritance
Section titled “Inheritance”object ← FaultInjectingRpcChannel
Implements
Section titled “Implements”Inherited Members
Section titled “Inherited Members”object.Equals(object), object.Equals(object, object), object.GetHashCode(), object.GetType(), object.ReferenceEquals(object, object), object.ToString()
Constructors
Section titled “Constructors”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)Parameters
Section titled “Parameters”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)Parameters
Section titled “Parameters”inner IRpcChannel
beforeOperation Func<RpcChannelOperation, int, CancellationToken, ValueTask>
transformSend Func<ReadOnlyMemory<byte>, int, CancellationToken, ValueTask<ReadOnlyMemory<byte>>>
Properties
Section titled “Properties”IsConnected
Section titled “ IsConnected”Gets whether the channel is currently connected.
public bool IsConnected { get; }Property Value
Section titled “Property Value”RemoteEndpoint
Section titled “ RemoteEndpoint”Gets a string representation of the remote endpoint.
public string RemoteEndpoint { get; }Property Value
Section titled “Property Value”Methods
Section titled “Methods”DisposeAsync()
Section titled “ DisposeAsync()”Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources asynchronously.
public ValueTask DisposeAsync()Returns
Section titled “Returns”A task that represents the asynchronous dispose operation.
ReceiveAsync(CancellationToken)
Section titled “ ReceiveAsync(CancellationToken)”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)Parameters
Section titled “Parameters”Returns
Section titled “Returns”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)Parameters
Section titled “Parameters”data ReadOnlyMemory<byte>