@@ -480,13 +480,26 @@ class HTTP1ConnectionTests: XCTestCase {
480480 XCTAssertEqual ( connectionDelegate. hitConnectionClosed, 0 )
481481 XCTAssertEqual ( connectionDelegate. hitConnectionReleased, 0 )
482482 XCTAssertNoThrow ( try embedded. writeInbound ( ByteBuffer ( string: responseString) ) )
483- XCTAssertFalse ( embedded. isActive)
484- ( embedded. eventLoop as! EmbeddedEventLoop ) . run ( ) // tick once to run futures.
485- XCTAssertEqual ( connectionDelegate. hitConnectionClosed, 1 )
486- XCTAssertEqual ( connectionDelegate. hitConnectionReleased, 0 )
487483
488- XCTAssertThrowsError ( try requestBag. task. futureResult. wait ( ) ) {
489- XCTAssertEqual ( $0 as? HTTPClientError , . httpEndReceivedAfterHeadWith1xx)
484+ if !embedded. isActive {
485+ // behavior before https://github.com/apple/swift-nio/pull/1984
486+ embedded. embeddedEventLoop. run ( ) // tick once to run futures.
487+ XCTAssertEqual ( connectionDelegate. hitConnectionClosed, 1 )
488+ XCTAssertEqual ( connectionDelegate. hitConnectionReleased, 0 )
489+
490+ XCTAssertThrowsError ( try requestBag. task. futureResult. wait ( ) ) {
491+ XCTAssertEqual ( $0 as? HTTPClientError , . httpEndReceivedAfterHeadWith1xx)
492+ }
493+ } else {
494+ // behavior after https://github.com/apple/swift-nio/pull/1984
495+ XCTAssertNoThrow ( try embedded. close ( ) . wait ( ) )
496+ embedded. embeddedEventLoop. run ( ) // tick once to run futures.
497+ XCTAssertEqual ( connectionDelegate. hitConnectionClosed, 1 )
498+ XCTAssertEqual ( connectionDelegate. hitConnectionReleased, 0 )
499+
500+ XCTAssertThrowsError ( try requestBag. task. futureResult. wait ( ) ) {
501+ XCTAssertEqual ( $0 as? HTTPClientError , . remoteConnectionClosed)
502+ }
490503 }
491504 }
492505
0 commit comments