@Test public void withEndpoint () { assertSame(chaosSSHClient, chaosSSHClient.withEndpoint(randomUUID().toString())); assertSame(chaosSSHClient, chaosSSHClient.withEndpoint(randomUUID().toString(), 1)); }
@Override public SSHClientWrapper withEndpoint (String hostname) { int chosenPort = SSHConstants.DEFAULT_SSH_PORT; if (hostname.matches(".*:[1-9][0-9]*$")) { log.debug("Parsing hostname with port {}", hostname); int split = hostname.lastIndexOf(':'); chosenPort = Integer.parseInt(hostname.substring(split + 1)); hostname = hostname.substring(0, split); log.debug("Evaluated as {} port {}", hostname, chosenPort); } return withEndpoint(hostname, chosenPort); }
ChaosSSHClient implements SSHClientWrapper { @Override public SSHClientWrapper withEndpoint (String hostname) { int chosenPort = SSHConstants.DEFAULT_SSH_PORT; if (hostname.matches(".*:[1-9][0-9]*$")) { log.debug("Parsing hostname with port {}", hostname); int split = hostname.lastIndexOf(':'); chosenPort = Integer.parseInt(hostname.substring(split + 1)); hostname = hostname.substring(0, split); log.debug("Evaluated as {} port {}", hostname, chosenPort); } return withEndpoint(hostname, chosenPort); } }
ChaosSSHClient implements SSHClientWrapper { @Override public SSHClientWrapper withEndpoint (String hostname) { int chosenPort = SSHConstants.DEFAULT_SSH_PORT; if (hostname.matches(".*:[1-9][0-9]*$")) { log.debug("Parsing hostname with port {}", hostname); int split = hostname.lastIndexOf(':'); chosenPort = Integer.parseInt(hostname.substring(split + 1)); hostname = hostname.substring(0, split); log.debug("Evaluated as {} port {}", hostname, chosenPort); } return withEndpoint(hostname, chosenPort); }  }
ChaosSSHClient implements SSHClientWrapper { @Override public SSHClientWrapper withEndpoint (String hostname) { int chosenPort = SSHConstants.DEFAULT_SSH_PORT; if (hostname.matches(".*:[1-9][0-9]*$")) { log.debug("Parsing hostname with port {}", hostname); int split = hostname.lastIndexOf(':'); chosenPort = Integer.parseInt(hostname.substring(split + 1)); hostname = hostname.substring(0, split); log.debug("Evaluated as {} port {}", hostname, chosenPort); } return withEndpoint(hostname, chosenPort); }  @Override ShellClient connect(int connectionTimeout); @Override void close(); @Override SSHClientWrapper withSSHCredentials(SSHCredentials sshCredentials); @Override SSHClientWrapper withEndpoint(String hostname); @Override SSHClientWrapper withEndpoint(String hostname, Integer portNumber); @Override SSHClientWrapper withRunningDirectory(String runningDirectory); @Override String runResource(Resource resource); @Override ShellOutput runCommand(String command); }
ChaosSSHClient implements SSHClientWrapper { @Override public SSHClientWrapper withEndpoint (String hostname) { int chosenPort = SSHConstants.DEFAULT_SSH_PORT; if (hostname.matches(".*:[1-9][0-9]*$")) { log.debug("Parsing hostname with port {}", hostname); int split = hostname.lastIndexOf(':'); chosenPort = Integer.parseInt(hostname.substring(split + 1)); hostname = hostname.substring(0, split); log.debug("Evaluated as {} port {}", hostname, chosenPort); } return withEndpoint(hostname, chosenPort); }  @Override ShellClient connect(int connectionTimeout); @Override void close(); @Override SSHClientWrapper withSSHCredentials(SSHCredentials sshCredentials); @Override SSHClientWrapper withEndpoint(String hostname); @Override SSHClientWrapper withEndpoint(String hostname, Integer portNumber); @Override SSHClientWrapper withRunningDirectory(String runningDirectory); @Override String runResource(Resource resource); @Override ShellOutput runCommand(String command);  }