     private var closed: Bool = false
     private var connections: [SNTPConnection] = []
     private static let hostCallback: CFHostClientCallBack = { (host, infoType, error, info)  in
-        let client = unsafeBitCast(info, SNTPHost.self)
+        let client = Unmanaged<SNTPHost>.fromOpaque(COpaquePointer(info)).takeUnretainedValue()
         debugLog("Resolving hosts")
         client.connect(host)
     }

    }

    private static let dataCallback: CFSocketCallBack = { (socket, type, address, data, info)  in
        let client = unsafeBitCast(info, SNTPConnection.self)
        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))
        } else if type == .WriteCallBack {
            debugLog("Buffer \(client.socketAddress) writable - requesting time")
            client.requestTime()

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