1212//
1313//===----------------------------------------------------------------------===//
1414
15- #if canImport(Network)
16-
1715@testable import AsyncHTTPClient
16+ #if canImport(Network)
1817import Network
18+ #endif
1919import NIO
2020import NIOSSL
2121import NIOTransportServices
@@ -40,31 +40,18 @@ class HTTPClientNIOTSTests: XCTestCase {
4040 defer {
4141 XCTAssertNoThrow ( try httpClient. syncShutdown ( ) )
4242 }
43+ #if canImport(Network)
4344 if #available( macOS 10 . 14 , iOS 12 . 0 , tvOS 12 . 0 , watchOS 6 . 0 , * ) {
4445 XCTAssertTrue ( httpClient. eventLoopGroup is NIOTSEventLoopGroup )
4546 return
4647 }
48+ #endif
4749 XCTAssertTrue ( httpClient. eventLoopGroup is MultiThreadedEventLoopGroup )
4850 }
4951
50- func testDNSFailError( ) {
51- guard isTestingNIOTS ( ) else { return }
52- let httpClient = HTTPClient ( eventLoopGroupProvider: . shared( self . clientGroup) )
53- defer {
54- XCTAssertNoThrow ( try httpClient. syncShutdown ( requiresCleanClose: true ) )
55- }
56-
57- do {
58- _ = try httpClient. get ( url: " http://dnsfail/ " ) . wait ( )
59- XCTFail ( " This should have failed " )
60- } catch ChannelError . connectTimeout {
61- } catch {
62- XCTFail ( " Error should have been ChannelError.connectTimeout not \( error) " )
63- }
64- }
65-
6652 func testTLSFailError( ) {
6753 guard isTestingNIOTS ( ) else { return }
54+ #if canImport(Network)
6855 let httpBin = HTTPBin ( ssl: true )
6956 let httpClient = HTTPClient ( eventLoopGroupProvider: . shared( self . clientGroup) )
7057 defer {
@@ -80,6 +67,7 @@ class HTTPClientNIOTSTests: XCTestCase {
8067 } catch {
8168 XCTFail ( " Error should have been NWTLSError not \( type ( of: error) ) " )
8269 }
70+ #endif
8371 }
8472
8573 func testConnectionFailError( ) {
@@ -103,6 +91,7 @@ class HTTPClientNIOTSTests: XCTestCase {
10391
10492 func testTLSVersionError( ) {
10593 guard isTestingNIOTS ( ) else { return }
94+ #if canImport(Network)
10695 let httpBin = HTTPBin ( ssl: true )
10796 let httpClient = HTTPClient (
10897 eventLoopGroupProvider: . shared( self . clientGroup) ,
@@ -121,7 +110,6 @@ class HTTPClientNIOTSTests: XCTestCase {
121110 } catch {
122111 XCTFail ( " Error should have been NWTLSError not \( type ( of: error) ) " )
123112 }
113+ #endif
124114 }
125115}
126-
127- #endif
0 commit comments