1212//
1313//===----------------------------------------------------------------------===//
1414
15- // TODO: remove @testable once we officially support HTTP/2
16- @testable import AsyncHTTPClient // Tests that really need @testable go into HTTP2ClientInternalTests.swift
15+ /* NOT @testable */ import AsyncHTTPClient // Tests that really need @testable go into HTTP2ClientInternalTests.swift
1716#if canImport(Network)
1817 import Network
1918#endif
@@ -28,14 +27,13 @@ class HTTP2ClientTests: XCTestCase {
2827 func makeDefaultHTTPClient(
2928 eventLoopGroupProvider: HTTPClient . EventLoopGroupProvider = . createNew
3029 ) -> HTTPClient {
31- var tlsConfig = TLSConfiguration . makeClientConfiguration ( )
32- tlsConfig. certificateVerification = . none
30+ var config = HTTPClient . Configuration ( )
31+ config. tlsConfiguration = . clientDefault
32+ config. tlsConfiguration? . certificateVerification = . none
33+ config. httpVersion = . automatic
3334 return HTTPClient (
3435 eventLoopGroupProvider: eventLoopGroupProvider,
35- configuration: HTTPClient . Configuration (
36- tlsConfiguration: tlsConfig,
37- httpVersion: . automatic
38- ) ,
36+ configuration: config,
3937 backgroundActivityLogger: Logger ( label: " HTTPClient " , factory: StreamLogHandler . standardOutput ( label: ) )
4038 )
4139 }
@@ -138,14 +136,13 @@ class HTTP2ClientTests: XCTestCase {
138136
139137 let localHTTPBin = HTTPBin ( . http2( compress: false ) )
140138 let elg = MultiThreadedEventLoopGroup ( numberOfThreads: numberOfWorkers)
141- var tlsConfig = TLSConfiguration . makeClientConfiguration ( )
142- tlsConfig. certificateVerification = . none
139+ var config = HTTPClient . Configuration ( )
140+ config. tlsConfiguration = . clientDefault
141+ config. tlsConfiguration? . certificateVerification = . none
142+ config. httpVersion = . automatic
143143 let localClient = HTTPClient (
144144 eventLoopGroupProvider: . shared( elg) ,
145- configuration: HTTPClient . Configuration (
146- tlsConfiguration: tlsConfig,
147- httpVersion: . automatic
148- ) ,
145+ configuration: config,
149146 backgroundActivityLogger: Logger ( label: " HTTPClient " , factory: StreamLogHandler . standardOutput ( label: ) )
150147 )
151148 defer {
@@ -303,15 +300,14 @@ class HTTP2ClientTests: XCTestCase {
303300 let el1 = clientGroup. next ( )
304301 let el2 = clientGroup. next ( )
305302 defer { XCTAssertNoThrow ( try clientGroup. syncShutdownGracefully ( ) ) }
306- var tlsConfig = TLSConfiguration . makeClientConfiguration ( )
307- tlsConfig. certificateVerification = . none
303+ var config = HTTPClient . Configuration ( )
304+ config. tlsConfiguration = . clientDefault
305+ config. tlsConfiguration? . certificateVerification = . none
306+ config. httpVersion = . automatic
307+ config. timeout. connect = . milliseconds( 1000 )
308308 let client = HTTPClient (
309309 eventLoopGroupProvider: . shared( clientGroup) ,
310- configuration: HTTPClient . Configuration (
311- tlsConfiguration: tlsConfig,
312- timeout: . init( connect: . milliseconds( 1000 ) ) ,
313- httpVersion: . automatic
314- ) ,
310+ configuration: config,
315311 backgroundActivityLogger: Logger ( label: " HTTPClient " , factory: StreamLogHandler . standardOutput ( label: ) )
316312 )
317313 defer { XCTAssertNoThrow ( try client. syncShutdown ( ) ) }
0 commit comments