Instance Propertyswift-nio 2.72.0NIOEmbedded
localAddress
AsyncTestingChannel.swift:243- iOS
- 13.0+
- macOS
- 10.15+
- tvOS
- 13.0+
- watchOS
- 6.0+
var localAddress: SocketAddress? { get set }
see:
Channel.localAddress
Other members in extension
Types
enum BufferState
BufferState
represents the state of either the inbound, or the outboundNIOAsyncTestingChannel
buffer.enum LeftOverState
LeftOverState
represents any left-over inbound, outbound, and pending outbound events that hit theNIOAsyncTestingChannel
and were not consumed whenfinish
was called on theNIOAsyncTestingChannel
.struct SynchronousOptions
struct WrongTypeError
WrongTypeError
is thrown if you usereadInbound(as:)
orreadOutbound(as:)
and request a certain type but the first item in the respective buffer is of a different type.
Type members
init(handler: ChannelHandler, loop: NIOAsyncTestingEventLoop
) async Create a new instance.
init(handlers: [ChannelHandler], loop: NIOAsyncTestingEventLoop
) async Create a new instance.
init(loop: NIOAsyncTestingEventLoop
) Create a new instance.
Instance members
let allocator: ByteBufferAllocator
var allowRemoteHalfClosure: Bool
var closeFuture: EventLoopFuture<Void>
var eventLoop: EventLoop
var isActive: Bool
Returns
true
if theNIOAsyncTestingChannel
is ‘active’.var isWritable: Bool
let parent: Channel?
nil
becauseNIOAsyncTestingChannel
s don’t have parents.var pipeline: ChannelPipeline
var remoteAddress: SocketAddress?
var syncOptions: NIOSynchronousChannelOptions?
let testingEventLoop: NIOAsyncTestingEventLoop
Returns the
NIOAsyncTestingEventLoop
that thisNIOAsyncTestingChannel
uses. This will return the same instance aseventLoop
but as the concreteNIOAsyncTestingEventLoop
rather than asEventLoop
existential.func bind(to: SocketAddress, promise: EventLoopPromise<Void>?
) Fires the (outbound)
bind
event through theChannelPipeline
. If the event hits theNIOAsyncTestingChannel
which happens when it travels theChannelPipeline
all the way to the front, this will also set theNIOAsyncTestingChannel
’slocalAddress
.func connect(to: SocketAddress, promise: EventLoopPromise<Void>?
) Fires the (outbound)
connect
event through theChannelPipeline
. If the event hits theNIOAsyncTestingChannel
which happens when it travels theChannelPipeline
all the way to the front, this will also set theNIOAsyncTestingChannel
’sremoteAddress
.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 theNIOAsyncTestingChannel
’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 theNIOAsyncTestingChannel
’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 typeT
out of theNIOAsyncTestingChannel
’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 typeT
out of theNIOAsyncTestingChannel
’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 achannelReadComplete
event through theChannelPipeline
.func writeOutbound<T>(T
) async throws -> BufferState Sends an outbound
writeAndFlush
event through theChannelPipeline
.