JGitSSHConfigSessionFactory extends org.eclipse.jgit.transport.JschConfigSessionFactory { @Override protected void configure(final OpenSshConfig.Host hc, final Session session) { final CredentialsProvider provider = new CredentialsProvider() { @Override public boolean isInteractive() { return false; } @Override public boolean supports(final CredentialItem... items) { return true; } @Override public boolean get(final URIish uri, final CredentialItem... items) throws UnsupportedCredentialItem { for (CredentialItem item : items) { if (item instanceof CredentialItem.YesNoType) { ((CredentialItem.YesNoType) item).setValue(true); } else if (item instanceof CredentialItem.StringType) { ((CredentialItem.StringType) item).setValue(config.getSshPassphrase()); } } return true; } }; final UserInfo userInfo = new CredentialsProviderUserInfo(session, provider); session.setUserInfo(userInfo); if (config.isSshOverHttpProxy() || config.isSshOverHttpsProxy()) { session.setProxy(buildProxy(config)); } } JGitSSHConfigSessionFactory(final JGitFileSystemProviderConfiguration config);   }
@Test public void testNoProxy() { JGitFileSystemProviderConfiguration config = new JGitFileSystemProviderConfiguration() { }; config.load(new ConfigProperties(Collections.emptyMap())); final JGitSSHConfigSessionFactory instance = new JGitSSHConfigSessionFactory(config) { @Override ProxyHTTP buildProxy(final JGitFileSystemProviderConfiguration config) { fail("no proxy should be set"); return null; } }; instance.configure(mock(OpenSshConfig.Host.class), mock(Session.class)); }