@@ -430,7 +430,7 @@ class HTTP1ConnectionTests: XCTestCase {
430
430
XCTAssertEqual ( response? . body, nil )
431
431
}
432
432
433
- func testConnectionDoesntCrashAfterConnectionCloseAndEarlyHints ( ) {
433
+ func testConnectionDropAfterEarlyHints ( ) {
434
434
let embedded = EmbeddedChannel ( )
435
435
let logger = Logger ( label: " test.http1.connection " )
436
436
@@ -481,25 +481,15 @@ class HTTP1ConnectionTests: XCTestCase {
481
481
XCTAssertEqual ( connectionDelegate. hitConnectionReleased, 0 )
482
482
XCTAssertNoThrow ( try embedded. writeInbound ( ByteBuffer ( string: responseString) ) )
483
483
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 )
484
+ XCTAssertTrue ( embedded. isActive, " The connection remains active after the informational response head " )
485
+ XCTAssertNoThrow ( try embedded. close ( ) . wait ( ) , " the connection was closed " )
489
486
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
- }
487
+ embedded. embeddedEventLoop. run ( ) // tick once to run futures.
488
+ XCTAssertEqual ( connectionDelegate. hitConnectionClosed, 1 )
489
+ XCTAssertEqual ( connectionDelegate. hitConnectionReleased, 0 )
490
+
491
+ XCTAssertThrowsError ( try requestBag. task. futureResult. wait ( ) ) {
492
+ XCTAssertEqual ( $0 as? HTTPClientError , . remoteConnectionClosed)
503
493
}
504
494
}
505
495
0 commit comments