     import Cocoa
 #endif
 
-internal final class ConnectionObserver {
+protocol ConnectionObserver {
+    func setUp(onConnect: @escaping () -> (), onDisconnect: @escaping () -> ())
+}
+
+internal final class ConnectionObserverImpl: ConnectionObserver {
     
-    private let defaultCenter: VKNotificationCenter?
-    private let workspaceCenter: VKNotificationCenter?
+    private let appStateCenter: VKNotificationCenter
+    private let reachabilityCenter: VKNotificationCenter
     private let reachability: VKReachability
+    
+    private let activeNotificationName: Notification.Name
+    private let inactiveNotificationName: Notification.Name
+    private let reachabilityNotificationName: Notification.Name
     
     private var appIsActive = true
     private var onConnect: (() -> ())?

            }
        )
        
        let resignActiveObserver = workspaceCenter?.addObserver(
            forName: NSWorkspace.screensDidSleepNotification,
            object: self,
            queue: nil,
            using: { [weak self] notification in
                self?.handleAppInnactive(notification)
            }
        )
        
        observers.append(contentsOf: [becomeActiveObserver, resignActiveObserver])
    }
    
    @available(iOS 1.0, *)
    private func setUpIosObservers() {
        let becomeActiveObserver = defaultCenter?.addObserver(
            forName: NSWorkspace.screensDidWakeNotification,
            object: self,
            queue: nil,
            using: { [weak self] notification in
                self?.handleAppActive(notification)
            }
        )
        
        let resignActiveObserver = defaultCenter?.addObserver(
            forName: NSWorkspace.screensDidSleepNotification,
            object: self,
            queue: nil,
            using: { [weak self] notification in

    private var observers = [NSObjectProtocol?]()
    
    init(
        appStateCenter: VKNotificationCenter,
        reachabilityCenter: VKNotificationCenter,
        reachability: VKReachability,
        activeNotificationName: Notification.Name,
        inactiveNotificationName: Notification.Name,
        reachabilityNotificationName: Notification.Name
        ) {
        self.appStateCenter = appStateCenter
        self.reachabilityCenter = reachabilityCenter
        self.reachability = reachability
        self.activeNotificationName = activeNotificationName
        self.inactiveNotificationName = inactiveNotificationName
        self.reachabilityNotificationName = reachabilityNotificationName

    }
    
    public func setUp(onConnect: @escaping () -> (), onDisconnect: @escaping () -> ()) {
        self.onConnect = onConnect
        self.onDisconnect = onDisconnect
        
        setUpAppStateObservers()
        setUpReachabilityObserver()
    }
    
    private func setUpAppStateObservers() {
        let becomeActiveObserver = appStateCenter.addObserver(
            forName: activeNotificationName,
            object: self,
            queue: nil,
            using: { [weak self] notification in
