class ChaosSSHClient implements SSHClientWrapper {

    @Override
    public String runResource (Resource resource) {
        try {
            log.info("Transferring resource {}", resource);
            getSshClient().newSCPFileTransfer().upload(new JarResourceFile(resource, true), TEMP_DIRECTORY);
        } catch (IOException e) {
            throw new ChaosException(SSH_CLIENT_TRANSFER_ERROR, e);
        }
        String shellCommand = runningDirectory + resource.getFilename();
        moveFileIfNeeded(resource, shellCommand);
        try (Session session = getSshClient().startSession()) {
            log.debug("About to run {}", shellCommand);
            return runCommandInShell(session, shellCommand);
        } catch (IOException e) {
            throw new ChaosException(SSH_CLIENT_COMMAND_ERROR, e);
        }
    }

}