@Test(expected = LoginCanceledException.class) public void testConnectNoValidCredentials() throws Exception { final Host host = new Host(new SFTPProtocol(), "test.cyberduck.ch", new Credentials("user")); final Session session = new SFTPSession(host, new DisabledX509TrustManager(), new DefaultX509KeyManager()); final LoginConnectionService login = new LoginConnectionService(new DisabledLoginCallback() { @Override public Credentials prompt(final Host bookmark, String username, String title, String reason, LoginOptions options) throws LoginCanceledException { throw new LoginCanceledException(); } }, new DisabledHostKeyCallback(), new DisabledPasswordStore(), new DisabledProgressListener()); login.connect(session, PathCache.empty(), new DisabledCancelCallback()); }
@Override public SSHClient connect(final Proxy proxy, final HostKeyCallback key, final LoginCallback prompt) throws BackgroundException { try { final DefaultConfig configuration = new DefaultConfig(); if("zlib".equals(preferences.getProperty("ssh.compression"))) { configuration.setCompressionFactories(Arrays.asList( new DelayedZlibCompression.Factory(), new ZlibCompression.Factory(), new NoneCompression.Factory())); } else { configuration.setCompressionFactories(Collections.singletonList(new NoneCompression.Factory())); } configuration.setVersion(new PreferencesUseragentProvider().get()); final KeepAliveProvider heartbeat; if(preferences.getProperty("ssh.heartbeat.provider").equals("keep-alive")) { heartbeat = KeepAliveProvider.KEEP_ALIVE; } else { heartbeat = KeepAliveProvider.HEARTBEAT; } configuration.setKeepAliveProvider(heartbeat); return this.connect(key, configuration); } catch(IOException e) { throw new SFTPExceptionMappingService().map(e); } }
SFTPSession extends Session<SSHClient> { @Override public SSHClient connect(final Proxy proxy, final HostKeyCallback key, final LoginCallback prompt) throws BackgroundException { try { final DefaultConfig configuration = new DefaultConfig(); if("zlib".equals(preferences.getProperty("ssh.compression"))) { configuration.setCompressionFactories(Arrays.asList( new DelayedZlibCompression.Factory(), new ZlibCompression.Factory(), new NoneCompression.Factory())); } else { configuration.setCompressionFactories(Collections.singletonList(new NoneCompression.Factory())); } configuration.setVersion(new PreferencesUseragentProvider().get()); final KeepAliveProvider heartbeat; if(preferences.getProperty("ssh.heartbeat.provider").equals("keep-alive")) { heartbeat = KeepAliveProvider.KEEP_ALIVE; } else { heartbeat = KeepAliveProvider.HEARTBEAT; } configuration.setKeepAliveProvider(heartbeat); return this.connect(key, configuration); } catch(IOException e) { throw new SFTPExceptionMappingService().map(e); } } }
SFTPSession extends Session<SSHClient> { @Override public SSHClient connect(final Proxy proxy, final HostKeyCallback key, final LoginCallback prompt) throws BackgroundException { try { final DefaultConfig configuration = new DefaultConfig(); if("zlib".equals(preferences.getProperty("ssh.compression"))) { configuration.setCompressionFactories(Arrays.asList( new DelayedZlibCompression.Factory(), new ZlibCompression.Factory(), new NoneCompression.Factory())); } else { configuration.setCompressionFactories(Collections.singletonList(new NoneCompression.Factory())); } configuration.setVersion(new PreferencesUseragentProvider().get()); final KeepAliveProvider heartbeat; if(preferences.getProperty("ssh.heartbeat.provider").equals("keep-alive")) { heartbeat = KeepAliveProvider.KEEP_ALIVE; } else { heartbeat = KeepAliveProvider.HEARTBEAT; } configuration.setKeepAliveProvider(heartbeat); return this.connect(key, configuration); } catch(IOException e) { throw new SFTPExceptionMappingService().map(e); } } SFTPSession(final Host h, final X509TrustManager trust, final X509KeyManager key); }
SFTPSession extends Session<SSHClient> { @Override public SSHClient connect(final Proxy proxy, final HostKeyCallback key, final LoginCallback prompt) throws BackgroundException { try { final DefaultConfig configuration = new DefaultConfig(); if("zlib".equals(preferences.getProperty("ssh.compression"))) { configuration.setCompressionFactories(Arrays.asList( new DelayedZlibCompression.Factory(), new ZlibCompression.Factory(), new NoneCompression.Factory())); } else { configuration.setCompressionFactories(Collections.singletonList(new NoneCompression.Factory())); } configuration.setVersion(new PreferencesUseragentProvider().get()); final KeepAliveProvider heartbeat; if(preferences.getProperty("ssh.heartbeat.provider").equals("keep-alive")) { heartbeat = KeepAliveProvider.KEEP_ALIVE; } else { heartbeat = KeepAliveProvider.HEARTBEAT; } configuration.setKeepAliveProvider(heartbeat); return this.connect(key, configuration); } catch(IOException e) { throw new SFTPExceptionMappingService().map(e); } } SFTPSession(final Host h, final X509TrustManager trust, final X509KeyManager key); @Override boolean isConnected(); @Override SSHClient connect(final Proxy proxy, final HostKeyCallback key, final LoginCallback prompt); @Override boolean alert(final ConnectionCallback prompt); @Override void login(final Proxy proxy, final LoginCallback prompt, final CancelCallback cancel); SFTPEngine sftp(); @Override void disconnect(); @Override @SuppressWarnings("unchecked") T _getFeature(final Class<T> type); }
SFTPSession extends Session<SSHClient> { @Override public SSHClient connect(final Proxy proxy, final HostKeyCallback key, final LoginCallback prompt) throws BackgroundException { try { final DefaultConfig configuration = new DefaultConfig(); if("zlib".equals(preferences.getProperty("ssh.compression"))) { configuration.setCompressionFactories(Arrays.asList( new DelayedZlibCompression.Factory(), new ZlibCompression.Factory(), new NoneCompression.Factory())); } else { configuration.setCompressionFactories(Collections.singletonList(new NoneCompression.Factory())); } configuration.setVersion(new PreferencesUseragentProvider().get()); final KeepAliveProvider heartbeat; if(preferences.getProperty("ssh.heartbeat.provider").equals("keep-alive")) { heartbeat = KeepAliveProvider.KEEP_ALIVE; } else { heartbeat = KeepAliveProvider.HEARTBEAT; } configuration.setKeepAliveProvider(heartbeat); return this.connect(key, configuration); } catch(IOException e) { throw new SFTPExceptionMappingService().map(e); } } SFTPSession(final Host h, final X509TrustManager trust, final X509KeyManager key); @Override boolean isConnected(); @Override SSHClient connect(final Proxy proxy, final HostKeyCallback key, final LoginCallback prompt); @Override boolean alert(final ConnectionCallback prompt); @Override void login(final Proxy proxy, final LoginCallback prompt, final CancelCallback cancel); SFTPEngine sftp(); @Override void disconnect(); @Override @SuppressWarnings("unchecked") T _getFeature(final Class<T> type);  }