diff --git a/drivers/jsch/src/main/java/org/jclouds/ssh/jsch/config/JschSshClientModule.java b/drivers/jsch/src/main/java/org/jclouds/ssh/jsch/config/JschSshClientModule.java index 3f30091ff5..d51788a0ed 100644 --- a/drivers/jsch/src/main/java/org/jclouds/ssh/jsch/config/JschSshClientModule.java +++ b/drivers/jsch/src/main/java/org/jclouds/ssh/jsch/config/JschSshClientModule.java @@ -53,8 +53,14 @@ public class JschSshClientModule extends AbstractModule { Optional agentConnector = getAgentConnector(); Optional getAgentConnector() { + ConnectorFactory sshAgentOverNetcatOnly = new ConnectorFactory() { + { + setPreferredConnectors("ssh-agent"); + setPreferredUSocketFactories("nc"); + } + }; try { - return Optional.of(ConnectorFactory.getDefault().createConnector()); + return Optional.of(sshAgentOverNetcatOnly.createConnector()); } catch (final AgentProxyException e) { return Optional.absent(); } diff --git a/drivers/sshj/src/main/java/org/jclouds/sshj/config/SshjSshClientModule.java b/drivers/sshj/src/main/java/org/jclouds/sshj/config/SshjSshClientModule.java index 20b0767c3a..4daae8eaee 100644 --- a/drivers/sshj/src/main/java/org/jclouds/sshj/config/SshjSshClientModule.java +++ b/drivers/sshj/src/main/java/org/jclouds/sshj/config/SshjSshClientModule.java @@ -42,7 +42,6 @@ public class SshjSshClientModule extends AbstractModule { bind(SshClient.Factory.class).to(Factory.class).in(Scopes.SINGLETON); } - private static class Factory implements SshClient.Factory { @Named(Constants.PROPERTY_CONNECTION_TIMEOUT) @Inject(optional = true) @@ -51,8 +50,14 @@ public class SshjSshClientModule extends AbstractModule { Optional agentConnector = getAgentConnector(); Optional getAgentConnector() { + ConnectorFactory sshAgentOverNetcatOnly = new ConnectorFactory() { + { + setPreferredConnectors("ssh-agent"); + setPreferredUSocketFactories("nc"); + } + }; try { - return Optional.of(ConnectorFactory.getDefault().createConnector()); + return Optional.of(sshAgentOverNetcatOnly.createConnector()); } catch (final AgentProxyException e) { return Optional.absent(); }