let allocator: ByteBufferAllocator
var allowRemoteHalfClosure: Bool
var closeFuture: EventLoopFuture<Void>
var eventLoop: EventLoop
var isWritable: Bool
var localAddress: SocketAddress?
let parent: Channel?
nil
because NIOAsyncTestingChannel
s don’t have parents.
var pipeline: ChannelPipeline
var remoteAddress: SocketAddress?
var syncOptions: NIOSynchronousChannelOptions?
let testingEventLoop: NIOAsyncTestingEventLoop
Returns the NIOAsyncTestingEventLoop
that this NIOAsyncTestingChannel
uses. This will return the same instance as eventLoop
but as the concrete NIOAsyncTestingEventLoop
rather than as EventLoop
existential.
func bind(to: SocketAddress, promise: EventLoopPromise<Void>?)
Fires the (outbound) bind
event through the ChannelPipeline
. If the event hits the NIOAsyncTestingChannel
which happens when it travels the ChannelPipeline
all the way to the front, this will also set the NIOAsyncTestingChannel
’s localAddress
.
func connect(to: SocketAddress, promise: EventLoopPromise<Void>?)
Fires the (outbound) connect
event through the ChannelPipeline
. If the event hits the NIOAsyncTestingChannel
which happens when it travels the ChannelPipeline
all the way to the front, this will also set the NIOAsyncTestingChannel
’s remoteAddress
.
func finish() async throws -> LeftOverState
Asynchronously closes the NIOAsyncTestingChannel
.
func finish(acceptAlreadyClosed: Bool) async throws -> LeftOverState
Asynchronously closes the NIOAsyncTestingChannel
.
func getOption<Option>(Option) -> EventLoopFuture<Option.Value>
func readInbound<T>(as: T.Type) async throws -> T?
If available, this method reads one element of type T
out of the NIOAsyncTestingChannel
’s inbound buffer. If the first element was of a different type than requested, WrongTypeError
will be thrown, if there are no elements in the outbound buffer, nil
will be returned.
func readOutbound<T>(as: T.Type) async throws -> T?
If available, this method reads one element of type T
out of the NIOAsyncTestingChannel
’s outbound buffer. If the first element was of a different type than requested, WrongTypeError
will be thrown, if there are no elements in the outbound buffer, nil
will be returned.
func setOption<Option>(Option, value: Option.Value) -> EventLoopFuture<Void>
func throwIfErrorCaught() async throws
This method will throw the error that is stored in the NIOAsyncTestingChannel
if any.
func waitForInboundWrite<T>(as: T.Type) async throws -> T
This method is similar to readInbound(as:)
but will wait if the inbound buffer is empty. If available, this method reads one element of type T
out of the NIOAsyncTestingChannel
’s inbound buffer. If the first element was of a different type than requested, WrongTypeError
will be thrown, if there are no elements in the outbound buffer, this method will wait until an element is in the inbound buffer.
func waitForOutboundWrite<T>(as: T.Type) async throws -> T
This method is similar to readOutbound(as:)
but will wait if the outbound buffer is empty. If available, this method reads one element of type T
out of the NIOAsyncTestingChannel
’s outbound buffer. If the first element was of a different type than requested, WrongTypeError
will be thrown, if there are no elements in the outbound buffer, nil
will be returned.
func writeInbound<T>(T) async throws -> BufferState
Sends an inbound channelRead
event followed by a channelReadComplete
event through the ChannelPipeline
.
func writeOutbound<T>(T) async throws -> BufferState
Sends an outbound writeAndFlush
event through the ChannelPipeline
.