File tree 1 file changed +9
-1
lines changed
Tests/AsyncHTTPClientTests
1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -104,6 +104,7 @@ class HTTPClientNIOTSTests: XCTestCase {
104
104
105
105
func testConnectionFailError( ) {
106
106
guard isTestingNIOTS ( ) else { return }
107
+ #if canImport(Network)
107
108
let httpBin = HTTPBin ( . http1_1( ssl: false ) )
108
109
let httpClient = HTTPClient ( eventLoopGroupProvider: . shared( self . clientGroup) ,
109
110
configuration: . init( timeout: . init( connect: . milliseconds( 100 ) ,
@@ -117,8 +118,15 @@ class HTTPClientNIOTSTests: XCTestCase {
117
118
XCTAssertNoThrow ( try httpBin. shutdown ( ) )
118
119
119
120
XCTAssertThrowsError ( try httpClient. get ( url: " http://localhost: \( port) /get " ) . wait ( ) ) {
120
- XCTAssertEqual ( $0 as? HTTPClientError , . connectTimeout)
121
+ if let httpClientError = $0 as? HTTPClientError {
122
+ XCTAssertEqual ( httpClientError, . connectTimeout)
123
+ } else if let posixError = $0 as? HTTPClient . NWPOSIXError {
124
+ XCTAssertEqual ( posixError. errorCode, . ECONNREFUSED)
125
+ } else {
126
+ XCTFail ( " unexpected error \( $0) " )
127
+ }
121
128
}
129
+ #endif
122
130
}
123
131
124
132
func testTLSVersionError( ) {
You can’t perform that action at this time.
0 commit comments