Package org.jclouds.sshj

Examples of org.jclouds.sshj.SshjSshClient$ExecChannelConnection


  private static SshjSshClient getSSHClient(String host, String privateKey) {
    final LoginCredentials credential = LoginCredentials
        .fromCredentials(new Credentials("ubuntu", privateKey));
    final HostAndPort socket = HostAndPort.fromParts(host, 22);
    final SshjSshClient client = new SshjSshClient(
        new BackoffLimitedRetryHandler(), socket, credential, 5000);
    return client;
  }
View Full Code Here


      RetryablePredicate<IPSocket> socketOpen = new RetryablePredicate<IPSocket>(new InetSocketAddressConnect(), 180,
               5, TimeUnit.SECONDS);

      socketOpen.apply(socket);

      SshClient ssh = new SshjSshClient(new BackoffLimitedRetryHandler(), socket, 60000, credentials.identity, null,
               credentials.credential.getBytes());
      try {
         ssh.connect();
         ExecResponse hello = ssh.exec("echo hello");
         assertEquals(hello.getOutput().trim(), "hello");
         ExecResponse exec = ssh.exec("df");
         assertTrue(exec.getOutput().contains("Filesystem"),
                  "The output should've contained filesystem information, but it didn't. Output: " + exec);
      } finally {
         if (ssh != null)
            ssh.disconnect();
      }
   }
View Full Code Here

         this.injector = injector;
      }

      @Override
      public SshClient create(HostAndPort socket, LoginCredentials credentials) {
         SshClient client = new SshjSshClient(backoffLimitedRetryHandler, socket, credentials, timeout);
         injector.injectMembers(client);// add logger
         return client;
      }
View Full Code Here

         this.injector = injector;
      }

      @Override
      public SshClient create(HostAndPort socket, LoginCredentials credentials) {
         SshClient client = new SshjSshClient(backoffLimitedRetryHandler, socket, credentials, timeout, getAgentConnector());
         injector.injectMembers(client)// add logger
         return client;
      }
View Full Code Here

TOP

Related Classes of org.jclouds.sshj.SshjSshClient$ExecChannelConnection

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.