     init(host: String, port: Int) {
         session = RawSocketFactory.TunnelProvider.createUDPSessionToEndpoint(NWHostEndpoint(hostname: host, port: "\(port)"), fromEndpoint: nil)
         session.setReadHandler({ [ unowned self ] dataArray, error in
-            self.lastActive = NSDate()
+            self.updateActivityTimer()
 
             guard error == nil else {
                 DDLogError("Error when reading from remote server. \(error)")

        }
    }

}


    private func checkWrite() {
        dispatch_async(queue) {
            self.updateActivityTimer()

            guard !self.writing else {
                return
