finish(acceptAlreadyClosed:)

Asynchronously closes the NIOAsyncTestingChannel.

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

Parameters

acceptAlreadyClosed

Whether finish should throw if the NIOAsyncTestingChannel has been previously closed.

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:).

Errors in the NIOAsyncTestingChannel can be consumed using throwIfErrorCaught.