     }
 
     func close() {
-        if !proxySocket.disconnected {
+        if !proxySocket.isDisconnected {
             proxySocket.disconnect()
         }
         if let adapterSocket = adapterSocket {
-            if !adapterSocket.disconnected {
+            if !adapterSocket.isDisconnected {
                 adapterSocket.disconnect()
             }
         }


    var delegateQueue = dispatch_queue_create("TunnelQueue", DISPATCH_QUEUE_SERIAL) {
        didSet {
            self.proxySocket.delegateQueue = delegateQueue
            self.adapterSocket?.delegateQueue = delegateQueue
        }
    }

    var readySignal = 0

    var closed: Bool {
        return proxySocket.disconnected && (adapterSocket?.disconnected ?? true)
    }

    init(proxySocket: ProxySocket) {
        self.proxySocket = proxySocket
        self.proxySocket.delegateQueue = delegateQueue
        super.init()
        self.proxySocket.delegate = self
    }

        let manager = RuleManager.currentManager
        let factory = manager.match(request)
        adapterSocket = factory.getAdapter(request)
        adapterSocket!.queue = delegateQueue
        adapterSocket!.delegate = self
        adapterSocket!.openSocketWithRequest(request)
    }

    func readyToForward(socket: SocketProtocol) {
        readySignal += 1
        if readySignal == 2 {
            proxySocket.readDataWithTag(SocketTag.Forward)
