readInbound(as:)

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.

AsyncTestingChannel.swift:452
iOS
13.0+
macOS
10.15+
tvOS
13.0+
watchOS
6.0+
func readInbound<T>(as type: T.Type = T.self) async throws -> T? where T : Sendable

Data hits the NIOAsyncTestingChannel’s inbound buffer when data was send through the pipeline using fireChannelRead and then travelled the ChannelPipeline all the way to the back. For data to hit the inbound buffer, the last ChannelHandler must have send the event either explicitly (by calling ChannelHandlerContext.fireChannelRead) or implicitly by not implementing channelRead.