public static function build($host, $username = null, $password = null, $timeout = 90, $port = 21, $ssl = false)
    {
        $connector = new Connector($host, $timeout, $port, $ssl);

        if (!$connector->connect()) {
            throw new RuntimeException('Cannot connect to remote FTP server');
        }

        if ($username !== null && $password !== null) {
            if (!$connector->login($username, $password)) {
                throw new LogicException('Invalid combination of username and password provided');
            }
        }

        return new FtpManager($connector);
    }