swift-nio/Tests/NIOTLSTests
Franz Busch d836d6bef5
Add `AsyncChannel` based `ServerBootstrap.bind()` methods (#2403)
* Add `AsyncChannel` based `ServerBootstrap.bind()` methods

# Motivation
In my previous PR, we added a new async bridge from a NIO `Channel` to Swift Concurrency primitives in the from of the `NIOAsyncChannel`. This type alone is already helpful in bridging `Channel`s to Concurrency; however, it is hard to use since it requires to wrap the `Channel` at the right time otherwise we will drop reads. Furthermore, in the case of protocol negotiation this becomes even trickier since we need to wait until it finishes and then wrap the `Channel`.

# Modification
This PR introduces a few things:
1. New methods on the `ServerBootstrap` which allow the creation of `NIOAsyncChannel` based channels. This can be used in all cases where no protocol negotiation is involved.
2. A new protocol and type called `NIOProtocolNegotiationHandler` and `NIOProtocolNegotiationResult` which is used to identify channel handlers that are doing protocol negotiation.
3. New methods on the `ServerBootstrap` that are aware of protocol negotiation.

# Result
We can now easily and safely create new `AsyncChannel`s from the `ServerBootstrap`

* Code review

* Fix typo

* Fix up tests

* Stop finishing the writer when an error is caught

* Code review

* Fix up writer tests

* Introduce shared protocol negotiation handler state machine

* Correctly handle multi threaded event loops

* Adapt test to assert the channel was closed correctly.

* Code review
2023-04-26 07:17:07 -07:00
..
ApplicationProtocolNegotiationHandlerTests.swift Handle reentranct reads in ALPNHandler (#2402) 2023-04-13 05:06:15 -07:00
NIOTypedApplicationProtocolNegotiationHandlerTests.swift Add `AsyncChannel` based `ServerBootstrap.bind()` methods (#2403) 2023-04-26 07:17:07 -07:00
SNIHandlerTests.swift Clean up dependencies and imports. (#1935) 2021-08-12 13:49:46 +01:00