@@ -333,6 +333,40 @@ class HTTPClientTests: XCTestCase {
333
333
XCTAssertEqual ( . ok, response. status)
334
334
}
335
335
336
+ func testGetHttpsWithIPv6( ) throws {
337
+ try XCTSkipUnless ( canBindIPv6Loopback, " Requires IPv6 " )
338
+ let localHTTPBin = HTTPBin ( . http1_1( ssl: true ) , bindTarget: . localhostIPv6RandomPort)
339
+ let localClient = HTTPClient ( eventLoopGroupProvider: . shared( self . clientGroup) ,
340
+ configuration: HTTPClient . Configuration ( certificateVerification: . none) )
341
+ defer {
342
+ XCTAssertNoThrow ( try localClient. syncShutdown ( ) )
343
+ XCTAssertNoThrow ( try localHTTPBin. shutdown ( ) )
344
+ }
345
+ var response : HTTPClient . Response ?
346
+ XCTAssertNoThrow ( response = try localClient. get ( url: " https://[::1]: \( localHTTPBin. port) /get " ) . wait ( ) )
347
+ XCTAssertEqual ( . ok, response? . status)
348
+ }
349
+
350
+ func testGetHTTPSWorksOnMTELGWithIPv6( ) throws {
351
+ try XCTSkipUnless ( canBindIPv6Loopback, " Requires IPv6 " )
352
+ // Same test as above but this one will use NIO on Sockets even on Apple platforms, just to make sure
353
+ // this works.
354
+ let group = MultiThreadedEventLoopGroup ( numberOfThreads: 1 )
355
+ defer {
356
+ XCTAssertNoThrow ( try group. syncShutdownGracefully ( ) )
357
+ }
358
+ let localHTTPBin = HTTPBin ( . http1_1( ssl: true ) , bindTarget: . localhostIPv6RandomPort)
359
+ let localClient = HTTPClient ( eventLoopGroupProvider: . shared( group) ,
360
+ configuration: HTTPClient . Configuration ( certificateVerification: . none) )
361
+ defer {
362
+ XCTAssertNoThrow ( try localClient. syncShutdown ( ) )
363
+ XCTAssertNoThrow ( try localHTTPBin. shutdown ( ) )
364
+ }
365
+ var response : HTTPClient . Response ?
366
+ XCTAssertNoThrow ( response = try localClient. get ( url: " https://[::1]: \( localHTTPBin. port) /get " ) . wait ( ) )
367
+ XCTAssertEqual ( . ok, response? . status)
368
+ }
369
+
336
370
func testPostHttps( ) throws {
337
371
let localHTTPBin = HTTPBin ( . http1_1( ssl: true ) )
338
372
let localClient = HTTPClient ( eventLoopGroupProvider: . shared( self . clientGroup) ,
0 commit comments