      - parameter tunnel: The closed tunnel.
      */
     func tunnelDidClose(tunnel: Tunnel) {
-        tunnelPool.withBox { tunnels in
+        tunnels.withBox { tunnels in
             guard let index = tunnels.value.indexOf(tunnel) else {
                 // things went strange
-                DDLogError("Encountered an unknown tunnel.")
+                DDLogError("Encountered an unknown tunnel \(tunnel) when tries to remove it.")
                 return
             }
             tunnels.value.removeAtIndex(index)
             DDLogVerbose("Removed a closed tunnel, now there are \(tunnels.value.count) tunnels active.")
-            //            DDLogDebug("Active Tunnel Info:")
-            //            for tunnel in self.tunnels {
-            //                DDLogDebug("Tunnel to \(tunnel.proxySocket.request?.host), proxy socket state: \(tunnel.proxySocket.state), adapter socket state: \(tunnel.adapterSocket?.state), closed: \(tunnel.closed).")
-            //
+            DDLogDebug("Current active tunnels: \(tunnels.value)")
         }
     }
 }

    /// The address of proxy server.
    public let address: IPv4Address

    private var tunnelPool: TunnelPool = Atomic([])

    /**
     Create an instance of proxy server.

     Stop the proxy server.
     */
    public func stop() {
        tunnels.value.removeAll(keepCapacity: true)
    }

    /**
