@@ -511,6 +511,54 @@ class Mqtt5ClientTests: XCBaseTestCase, @unchecked Sendable {
511511 try await disconnectClientCleanup ( client: client, testContext: testContext)
512512 }
513513
514+ /*
515+ * [ConnDC-UC5-1] HttpProxy options failed on iOS
516+ */
517+ func testMqtt5HttpProxyFailedOnApple( ) async throws {
518+ #if !os(iOS) && !os(tvOS)
519+ throw XCTSkip ( " Http proxy config should only fail on iOS or tvOS " )
520+ #endif
521+ let inputHost = try getEnvironmentVarOrSkipTest (
522+ environmentVarName: " AWS_TEST_MQTT5_DIRECT_MQTT_TLS_HOST " )
523+ let inputPort = try getEnvironmentVarOrSkipTest (
524+ environmentVarName: " AWS_TEST_MQTT5_DIRECT_MQTT_TLS_PORT " )
525+ let inputProxyHost = try getEnvironmentVarOrSkipTest (
526+ environmentVarName: " AWS_TEST_MQTT5_PROXY_HOST " )
527+ let inputProxyPort = try getEnvironmentVarOrSkipTest (
528+ environmentVarName: " AWS_TEST_MQTT5_PROXY_PORT " )
529+
530+ let tlsOptions = TLSContextOptions ( )
531+ tlsOptions. setVerifyPeer ( false )
532+ let tlsContext = try TLSContext ( options: tlsOptions, mode: . client)
533+
534+ let httpProxyOptions = HTTPProxyOptions (
535+ hostName: inputProxyHost,
536+ port: UInt32 ( inputProxyPort) !,
537+ connectionType: HTTPProxyConnectionType . tunnel)
538+
539+ let clientOptions = MqttClientOptions (
540+ hostName: inputHost,
541+ port: UInt32 ( inputPort) !,
542+ tlsCtx: tlsContext,
543+ httpProxyOptions: httpProxyOptions)
544+
545+ let testContext = MqttTestContext ( )
546+ let client = try createClient ( clientOptions: clientOptions, testContext: testContext)
547+
548+ try client. start ( )
549+ await awaitExpectation ( [ testContext. connectionFailureExpectation] , 5 )
550+
551+ if let failureData = testContext. lifecycleConnectionFailureData {
552+ XCTAssertEqual ( failureData. crtError. code, Int32 ( AWS_ERROR_PLATFORM_NOT_SUPPORTED . rawValue) )
553+ } else {
554+ XCTFail ( " lifecycleConnectionFailureData Missing " )
555+ return
556+ }
557+
558+ try await stopClient ( client: client, testContext: testContext)
559+
560+ }
561+
514562 /*
515563 * [ConnDC-UC6] Direct Connection with all options set
516564 */
0 commit comments