### Question:
SnapshotTransferService { public void pull(StreamRepository localRepo, String localStreamName, RemoteRepository remoteRepo, String remoteStreamName, boolean createStreamIfNecessary) { try { Stream stream = streamService.tryReadStream(localRepo, localStreamName); boolean isNewStream = false; if (stream == null) { if (!createStreamIfNecessary) { throw new DisplayException("Local stream " + localStreamName + " was not found in repository " + localRepo.rootDirectory.toAbsolutePath()); } stream = streamService.createStream(localRepo, localStreamName); isNewStream = true; } SshConnection connection = sshService.sendSnapshots(remoteRepo, remoteStreamName); InputStream input = connection.getInputStream(); log.debug("wait for ready"); Util.waitFor(READY_INDICATOR, input); StreamState streamState = syncService.calculateStreamState(stream, isNewStream); log.debug("Send available snapshots"); Util.send(streamState, connection.getOutputStream()); log.debug("receive missing snapshots"); receiveMissingSnapshots(stream, isNewStream, input); connection.close(); } catch (Exception e) { throw new RuntimeException( "Error while pulling from remote respository", e); } }  void receiveSnapshots(StreamRepository repo, String streamName,
            InputStream input, OutputStream output,
            boolean createStreamIfNecessary); void sendSnapshots(StreamRepository repo, String streamName,
            InputStream input, OutputStream output); void push(Stream stream, RemoteRepository repo,
            String remoteStreamName, boolean createRemoteIfNecessary); void pull(StreamRepository localRepo, String localStreamName,
            RemoteRepository remoteRepo, String remoteStreamName,
            boolean createStreamIfNecessary); static final String READY_INDICATOR; static final String START_COMMAND; }### Answer:
@Test public void transferSnapshotPull() throws Exception { transferService.sshService = new SshServiceTestDouble(repo1); transferService.sshService.setSudoRemoteBtrfs(true); Stream stream = streamService.createStream(repo1, "test"); Stream targetStream = streamService.createStream(repo2, "test2"); Path testFile = repo1.getWorkingDirectory(stream).resolve("test.txt"); Files.copy(new ByteArrayInputStream("Hello".getBytes("UTF-8")), testFile); Snapshot snapshot = streamService.takeSnapshot(stream); transferService.pull(repo2, "test2", null, "test", false); assertThat(targetStream, not(nullValue())); Path snapshotDir = targetStream.getSnapshotsDir().resolve( snapshot.getSnapshotName()); assertThat(Files.exists(snapshotDir), is(true)); assertThat(Files.exists(snapshotDir.resolve("test.txt")), is(true)); assertEquals(stream.id, streamService.getSnapshots(targetStream).get(0).senderStreamId); }