public function connect()
    {
        // check for timed out servers and remove them from the connection pool
        foreach ($this->connections as $address => $conn) {
            if ($conn->isTimedOut()) {
                $conn->close();
                unset($this->connections[$address]);
            }
        }

        // attempt to connect/re-connect to any server not actively connected to
        foreach ($this->addresses as $address) {
            if (!isset($this->connections[$address])) {
                try {
                    $this->connections[$address] = new Connection(
                        $address,
                        new $this->streamClass,
                        $this->getTimeout()
                    );

                    // issue certain commands on (re)connection
                    foreach ($this->watching as $tube) {
                        $this->connections[$address]->watchTube($tube);
                    }

                    if ($this->using !== false) {
                        $this->connections[$address]->useTube($this->using);
                    }

                    foreach ($this->ignoring as $tube) {
                        $this->connections[$address]->ignoreTube($tube);
                    }

                // silently fail if a server is offline
                } catch (Exception $e) {
                    unset($this->connections[$address]);
                }
            }
        }

        // no connections!
        if (count($this->connections) === 0) {
            throw new Exception('Could not establish a connection to any beanstalkd server in the pool.');
        }
    }