Make half-closure tests more robust.
Make half-closure tests more robust.

Motivation:

Out half-closure tests did not wait for the actual event to be received before trying to tear-down the Channel which could lead to test-failures if the event was received not fast enough. We need to ensure we wait until we receive the event before closing the Channel and assert the received events.

Modifications:

Ensure we wait for the events before we try to close the Channel and assert the received events.

Result:

Less flaky tests.

apple/swift-nio,apple/swift-nio,apple/swift-nio,apple/swift-nio,apple/swift-nio