diff --git a/Sources/Transport/FoundationTransport.swift b/Sources/Transport/FoundationTransport.swift index 1ef3d018..14baeeae 100644 --- a/Sources/Transport/FoundationTransport.swift +++ b/Sources/Transport/FoundationTransport.swift @@ -66,6 +66,12 @@ public class FoundationTransport: NSObject, Transport, StreamDelegate { inStream.delegate = self outStream.delegate = self + if isTLS { + let key = CFStreamPropertyKey(rawValue: kCFStreamPropertySocketSecurityLevel) + CFReadStreamSetProperty(inStream, key, kCFStreamSocketSecurityLevelNegotiatedSSL) + CFWriteStreamSetProperty(outStream, key, kCFStreamSocketSecurityLevelNegotiatedSSL) + } + onConnect?(inStream, outStream) isOpen = false