public static String transferResultsToLocal(final String privateKey, final URL url, final String fileName)
	{
		Assert.hasText(privateKey, "The Acceptance Test, can not be empty nor null.");
		Assert.notNull(url, "The remote machine's URL must be specified.");
		Assert.hasText(fileName, "The remote file name must be specified.");

		File file = new File(fileName);
		FileOutputStream fileOutputStream = null;
		InputStream inputStream = null;

		try {
			File tmpFile = createTmpDir();
			String fileLocation = tmpFile.getAbsolutePath() + file.getName();
			fileOutputStream = new FileOutputStream(fileLocation);

			final SshjSshClient client = getSSHClient(url, privateKey);
			inputStream = client.get(fileName).openStream();

			FileCopyUtils.copy(inputStream, fileOutputStream);
			return fileLocation;
		}
		catch (IOException ioException) {
			throw new IllegalStateException(ioException.getMessage(), ioException);
		}
	}
Copies the specified file from a remote machine to local machine.

@param privateKey the ssh private key to the remote machine
@param url The remote machine's url.
@param fileName The fully qualified file name of the file to be transferred.
@return The location to the fully qualified file name where the remote file was copied.
spring-xd-integration-test/src/main/java/org/springframework/xd/integration/util/StreamUtils.java