finish

Asynchronously closes the NIOAsyncTestingChannel.

AsyncTestingChannel.swift:383
iOS
13.0+
macOS
10.15+
tvOS
13.0+
watchOS
6.0+
func finish() async throws -> LeftOverState

Returns

The LeftOverState of the NIOAsyncTestingChannel. If all the inbound and outbound events have been consumed (using readInbound(as:) / readOutbound(as:)) and there are no pending outbound events (unflushed writes) this will be clean. If there are any unconsumed inbound, outbound, or pending outbound events, the NIOAsyncTestingChannel will returns those as leftOvers(inbound:outbound:pendingOutbound:).

This method will throw if the Channel hit any unconsumed errors or if the close fails. Errors in the NIOAsyncTestingChannel can be consumed using throwIfErrorCaught.