     }
 
     private static let dataCallback: CFSocketCallBack = { (socket, type, address, data, info)  in
-        let client = unsafeBitCast(info, SNTPConnection.self)
+        let client = Unmanaged<SNTPConnection>.fromOpaque(COpaquePointer(info))
+                                              .takeUnretainedValue()
         guard CFSocketIsValid(socket) else { return }
 
         // Can't use switch here as these aren't defined as an enum.
         if type == .DataCallBack {
-            client.handleResponse(unsafeBitCast(data, CFData.self))
+            let data = Unmanaged<CFData>.fromOpaque(COpaquePointer(data)).takeUnretainedValue()
+            client.handleResponse(data)
         } else if type == .WriteCallBack {
             debugLog("Buffer \(client.socketAddress) writable - requesting time")
             client.requestTime()

        let callbackTypes: [CFSocketCallBackType] = [.DataCallBack, .WriteCallBack]
        var ctx = CFSocketContext(
            version: 0,
            info: unsafeBitCast(self, UnsafeMutablePointer<Void>.self),
            retain: nil,
            release: nil,
            copyDescription: unsafeBitCast(0, CFAllocatorCopyDescriptionCallBack.self)

        let host = CFHostCreateWithName(nil, hostURL.absoluteString).takeUnretainedValue()
        var ctx = CFHostClientContext(
            version: 0,
            info: UnsafeMutablePointer(Unmanaged.passUnretained(self).toOpaque()),
            retain: nil,
            release: nil,
            copyDescription: unsafeBitCast(0, CFAllocatorCopyDescriptionCallBack.self)
