 class OpenOBDConnectionOperation: StreamHandleOperation {
     
     class func keyPathsForValuesAffectingIsFinished() -> Set<NSObject> {
-        return ["inputOpen" as NSObject, "outOpen" as NSObject]
+        return ["inputOpen" as NSObject, "outOpen" as NSObject, "error" as NSObject]
+    }
+    
+    class func keyPathsForValuesAffectingIsExecuting() -> Set<NSObject> {
+        return ["inputOpen" as NSObject, "outOpen" as NSObject, "error" as NSObject]
     }
     
     private var inputOpen = false {

    override func inputStremEvent(event: Stream.Event) {
        if event == .openCompleted {
            inputOpen = true
        }
    }
    
    override func outputStremEvent(event: Stream.Event) {
        if event == .openCompleted {
            outOpen = true
        }
    }
}

        }
    }
    
    private var error:Error? {
        didSet {
            input.remove(from: .current, forMode: .defaultRunLoopMode)
            output.remove(from: .current, forMode: .defaultRunLoopMode)
        }
    }
    
    override var isExecuting: Bool {
        let value = !(inputOpen && outOpen) && error == nil
        print("isExecuting \(value)")
        return value
    }
    
    override var isFinished: Bool {
        let value = (inputOpen && outOpen) || error != nil
        print("isFinished \(value)")
        return value
    }
    
    override func main() {
