use of org.apache.sshd.SshClient in project fabric8 by jboss-fuse.
the class ContainerConnectAction method createClient.
protected SshClient createClient() {
// must create a new client for each usage
SshClient client = SshClient.setUpDefaultClient();
client.setAgentFactory(agentFactory);
// must start client
client.start();
log.trace("Created SshClient: {}", client);
return client;
}
use of org.apache.sshd.SshClient in project ovirt-engine by oVirt.
the class TimeoutTest method testConnectTimeout.
@Test(expected = TimeLimitExceededException.class)
public void testConnectTimeout() throws Exception {
SSHClient client = spy(this.client);
SshClient ssh = spy(SshClient.setUpDefaultClient());
ConnectFuture future = mock(ConnectFuture.class);
doReturn(ssh).when(client).createSshClient();
doReturn(future).when(ssh).connect(any(), anyInt());
when(future.await(anyLong())).thenReturn(false);
client.connect();
}
Aggregations