@Override
    public boolean check(final Session<?> session, final CancelCallback callback) throws BackgroundException {
        final Host bookmark = session.getHost();
        if(bookmark.getProtocol().isHostnameConfigurable() && StringUtils.isBlank(bookmark.getHostname())) {
            throw new ConnectionCanceledException();
        }
        if(session.isConnected()) {
            if(log.isDebugEnabled()) {
                log.debug(String.format("Skip opening connection for session %s", session));
            }
            // Connection already open
            return false;
        }
        // Obtain password from keychain or prompt
        synchronized(login) {
            login.validate(bookmark, prompt, new LoginOptions(bookmark.getProtocol()));
        }
        this.connect(session, callback);
        return true;
    }
@Test(expected = LoginCanceledException.class)
    public void testNoResolveForHTTPProxy() throws Exception {
        final Session session = new NullSession(new Host(new TestProtocol(), "unknownhost.local", new Credentials("user", ""))) {
            @Override
            public boolean isConnected() {
                return false;
            }
        };
        final LoginConnectionService s = new LoginConnectionService(new DisabledLoginCallback(), new DisabledHostKeyCallback(), new DisabledPasswordStore(), new DisabledProgressListener(),
            new DisabledProxyFinder() {
                @Override
                public Proxy find(final String target) {
                    return new Proxy(Proxy.Type.HTTP, "proxy.local", 6666);
                }
            });
        s.check(session, new DisabledCancelCallback());
    }