1 package net.pterodactylus.fcp.quelaton;
3 import static org.hamcrest.MatcherAssert.assertThat;
4 import static org.hamcrest.Matchers.containsInAnyOrder;
5 import static org.hamcrest.Matchers.hasSize;
6 import static org.hamcrest.Matchers.is;
7 import static org.hamcrest.Matchers.notNullValue;
9 import java.io.ByteArrayInputStream;
11 import java.io.IOException;
12 import java.nio.charset.StandardCharsets;
13 import java.util.Collection;
14 import java.util.List;
15 import java.util.Optional;
16 import java.util.concurrent.ExecutionException;
17 import java.util.concurrent.ExecutorService;
18 import java.util.concurrent.Executors;
19 import java.util.concurrent.Future;
20 import java.util.stream.Collectors;
22 import net.pterodactylus.fcp.FcpKeyPair;
23 import net.pterodactylus.fcp.Key;
24 import net.pterodactylus.fcp.NodeData;
25 import net.pterodactylus.fcp.Peer;
26 import net.pterodactylus.fcp.Priority;
27 import net.pterodactylus.fcp.fake.FakeTcpServer;
28 import net.pterodactylus.fcp.quelaton.ClientGetCommand.Data;
30 import com.google.common.io.ByteStreams;
31 import com.google.common.io.Files;
32 import org.hamcrest.Description;
33 import org.hamcrest.Matcher;
34 import org.hamcrest.TypeSafeDiagnosingMatcher;
35 import org.junit.After;
36 import org.junit.Test;
39 * Unit test for {@link DefaultFcpClient}.
41 * @author <a href="bombe@freenetproject.org">David ‘Bombe’ Roden</a>
43 public class DefaultFcpClientTest {
45 private static final String INSERT_URI =
46 "SSK@RVCHbJdkkyTCeNN9AYukEg76eyqmiosSaNKgE3U9zUw,7SHH53gletBVb9JD7nBsyClbLQsBubDPEIcwg908r7Y,AQECAAE/";
47 private static final String REQUEST_URI =
48 "SSK@wtbgd2loNcJCXvtQVOftl2tuWBomDQHfqS6ytpPRhfw,7SHH53gletBVb9JD7nBsyClbLQsBubDPEIcwg908r7Y,AQACAAE/";
50 private static int threadCounter = 0;
51 private final ExecutorService threadPool =
52 Executors.newCachedThreadPool(r -> new Thread(r, "Test-Thread-" + threadCounter++));
53 private final FakeTcpServer fcpServer;
54 private final DefaultFcpClient fcpClient;
56 public DefaultFcpClientTest() throws IOException {
57 fcpServer = new FakeTcpServer(threadPool);
58 fcpClient = new DefaultFcpClient(threadPool, "localhost", fcpServer.getPort(), () -> "Test");
62 public void tearDown() throws IOException {
66 @Test(expected = ExecutionException.class)
67 public void defaultFcpClientThrowsExceptionIfItCanNotConnect()
68 throws IOException, ExecutionException, InterruptedException {
69 Future<FcpKeyPair> keyPairFuture = fcpClient.generateKeypair().execute();
70 fcpServer.connect().get();
71 fcpServer.collectUntil(is("EndMessage"));
73 "CloseConnectionDuplicateClientName",
79 @Test(expected = ExecutionException.class)
80 public void defaultFcpClientThrowsExceptionIfConnectionIsClosed()
81 throws IOException, ExecutionException, InterruptedException {
82 Future<FcpKeyPair> keyPairFuture = fcpClient.generateKeypair().execute();
83 fcpServer.connect().get();
84 fcpServer.collectUntil(is("EndMessage"));
90 public void defaultFcpClientCanGenerateKeypair() throws ExecutionException, InterruptedException, IOException {
91 Future<FcpKeyPair> keyPairFuture = fcpClient.generateKeypair().execute();
93 List<String> lines = fcpServer.collectUntil(is("EndMessage"));
94 String identifier = extractIdentifier(lines);
95 fcpServer.writeLine("SSKKeypair",
96 "InsertURI=" + INSERT_URI + "",
97 "RequestURI=" + REQUEST_URI + "",
98 "Identifier=" + identifier,
100 FcpKeyPair keyPair = keyPairFuture.get();
101 assertThat(keyPair.getPublicKey(), is(REQUEST_URI));
102 assertThat(keyPair.getPrivateKey(), is(INSERT_URI));
105 private void connectNode() throws InterruptedException, ExecutionException, IOException {
106 fcpServer.connect().get();
107 fcpServer.collectUntil(is("EndMessage"));
108 fcpServer.writeLine("NodeHello",
109 "CompressionCodecs=4 - GZIP(0), BZIP2(1), LZMA(2), LZMA_NEW(3)",
110 "Revision=build01466",
112 "Version=Fred,0.7,1.0,1466",
114 "ConnectionIdentifier=14318898267048452a81b36e7f13a3f0",
118 "NodeLanguage=ENGLISH",
125 public void clientGetCanDownloadData() throws InterruptedException, ExecutionException, IOException {
126 Future<Optional<Data>> dataFuture = fcpClient.clientGet().uri("KSK@foo.txt").execute();
128 List<String> lines = fcpServer.collectUntil(is("EndMessage"));
129 assertThat(lines, matchesFcpMessage("ClientGet", "ReturnType=direct", "URI=KSK@foo.txt"));
130 String identifier = extractIdentifier(lines);
133 "Identifier=" + identifier,
135 "StartupTime=1435610539000",
136 "CompletionTime=1435610540000",
137 "Metadata.ContentType=text/plain;charset=utf-8",
141 Optional<Data> data = dataFuture.get();
142 assertThat(data.get().getMimeType(), is("text/plain;charset=utf-8"));
143 assertThat(data.get().size(), is(6L));
144 assertThat(ByteStreams.toByteArray(data.get().getInputStream()),
145 is("Hello\n".getBytes(StandardCharsets.UTF_8)));
148 private String extractIdentifier(List<String> lines) {
149 return lines.stream()
150 .filter(s -> s.startsWith("Identifier="))
151 .map(s -> s.substring(s.indexOf('=') + 1))
157 public void clientGetDownloadsDataForCorrectIdentifier()
158 throws InterruptedException, ExecutionException, IOException {
159 Future<Optional<Data>> dataFuture = fcpClient.clientGet().uri("KSK@foo.txt").execute();
161 List<String> lines = fcpServer.collectUntil(is("EndMessage"));
162 assertThat(lines, matchesFcpMessage("ClientGet", "URI=KSK@foo.txt"));
163 String identifier = extractIdentifier(lines);
166 "Identifier=not-test",
168 "StartupTime=1435610539000",
169 "CompletionTime=1435610540000",
170 "Metadata.ContentType=text/plain;charset=latin-9",
176 "Identifier=" + identifier,
178 "StartupTime=1435610539000",
179 "CompletionTime=1435610540000",
180 "Metadata.ContentType=text/plain;charset=utf-8",
184 Optional<Data> data = dataFuture.get();
185 assertThat(data.get().getMimeType(), is("text/plain;charset=utf-8"));
186 assertThat(data.get().size(), is(6L));
187 assertThat(ByteStreams.toByteArray(data.get().getInputStream()),
188 is("Hello\n".getBytes(StandardCharsets.UTF_8)));
192 public void clientGetRecognizesGetFailed() throws InterruptedException, ExecutionException, IOException {
193 Future<Optional<Data>> dataFuture = fcpClient.clientGet().uri("KSK@foo.txt").execute();
195 List<String> lines = fcpServer.collectUntil(is("EndMessage"));
196 assertThat(lines, matchesFcpMessage("ClientGet", "URI=KSK@foo.txt"));
197 String identifier = extractIdentifier(lines);
200 "Identifier=" + identifier,
204 Optional<Data> data = dataFuture.get();
205 assertThat(data.isPresent(), is(false));
209 public void clientGetRecognizesGetFailedForCorrectIdentifier()
210 throws InterruptedException, ExecutionException, IOException {
211 Future<Optional<Data>> dataFuture = fcpClient.clientGet().uri("KSK@foo.txt").execute();
213 List<String> lines = fcpServer.collectUntil(is("EndMessage"));
214 assertThat(lines, matchesFcpMessage("ClientGet", "URI=KSK@foo.txt"));
215 String identifier = extractIdentifier(lines);
218 "Identifier=not-test",
224 "Identifier=" + identifier,
228 Optional<Data> data = dataFuture.get();
229 assertThat(data.isPresent(), is(false));
232 @Test(expected = ExecutionException.class)
233 public void clientGetRecognizesConnectionClosed() throws InterruptedException, ExecutionException, IOException {
234 Future<Optional<Data>> dataFuture = fcpClient.clientGet().uri("KSK@foo.txt").execute();
236 List<String> lines = fcpServer.collectUntil(is("EndMessage"));
237 assertThat(lines, matchesFcpMessage("ClientGet", "URI=KSK@foo.txt"));
243 public void defaultFcpClientReusesConnection() throws InterruptedException, ExecutionException, IOException {
244 Future<FcpKeyPair> keyPair = fcpClient.generateKeypair().execute();
246 List<String> lines = fcpServer.collectUntil(is("EndMessage"));
247 String identifier = extractIdentifier(lines);
250 "InsertURI=" + INSERT_URI + "",
251 "RequestURI=" + REQUEST_URI + "",
252 "Identifier=" + identifier,
256 keyPair = fcpClient.generateKeypair().execute();
257 lines = fcpServer.collectUntil(is("EndMessage"));
258 identifier = extractIdentifier(lines);
261 "InsertURI=" + INSERT_URI + "",
262 "RequestURI=" + REQUEST_URI + "",
263 "Identifier=" + identifier,
270 public void clientGetWithIgnoreDataStoreSettingSendsCorrectCommands()
271 throws InterruptedException, ExecutionException, IOException {
272 fcpClient.clientGet().ignoreDataStore().uri("KSK@foo.txt").execute();
274 List<String> lines = fcpServer.collectUntil(is("EndMessage"));
275 assertThat(lines, matchesFcpMessage("ClientGet", "URI=KSK@foo.txt", "IgnoreDS=true"));
279 public void clientGetWithDataStoreOnlySettingSendsCorrectCommands()
280 throws InterruptedException, ExecutionException, IOException {
281 fcpClient.clientGet().dataStoreOnly().uri("KSK@foo.txt").execute();
283 List<String> lines = fcpServer.collectUntil(is("EndMessage"));
284 assertThat(lines, matchesFcpMessage("ClientGet", "URI=KSK@foo.txt", "DSonly=true"));
288 public void clientGetWithMaxSizeSettingSendsCorrectCommands()
289 throws InterruptedException, ExecutionException, IOException {
290 fcpClient.clientGet().maxSize(1048576).uri("KSK@foo.txt").execute();
292 List<String> lines = fcpServer.collectUntil(is("EndMessage"));
293 assertThat(lines, matchesFcpMessage("ClientGet", "URI=KSK@foo.txt", "MaxSize=1048576"));
297 public void clientGetWithPrioritySettingSendsCorrectCommands()
298 throws InterruptedException, ExecutionException, IOException {
299 fcpClient.clientGet().priority(Priority.interactive).uri("KSK@foo.txt").execute();
301 List<String> lines = fcpServer.collectUntil(is("EndMessage"));
302 assertThat(lines, matchesFcpMessage("ClientGet", "URI=KSK@foo.txt", "PriorityClass=1"));
306 public void clientGetWithRealTimeSettingSendsCorrectCommands()
307 throws InterruptedException, ExecutionException, IOException {
308 fcpClient.clientGet().realTime().uri("KSK@foo.txt").execute();
310 List<String> lines = fcpServer.collectUntil(is("EndMessage"));
311 assertThat(lines, matchesFcpMessage("ClientGet", "URI=KSK@foo.txt", "RealTimeFlag=true"));
315 public void clientGetWithGlobalSettingSendsCorrectCommands()
316 throws InterruptedException, ExecutionException, IOException {
317 fcpClient.clientGet().global().uri("KSK@foo.txt").execute();
319 List<String> lines = fcpServer.collectUntil(is("EndMessage"));
320 assertThat(lines, matchesFcpMessage("ClientGet", "URI=KSK@foo.txt", "Global=true"));
323 private Matcher<List<String>> matchesFcpMessage(String name, String... requiredLines) {
324 return new TypeSafeDiagnosingMatcher<List<String>>() {
326 protected boolean matchesSafely(List<String> item, Description mismatchDescription) {
327 if (!item.get(0).equals(name)) {
328 mismatchDescription.appendText("FCP message is named ").appendValue(item.get(0));
331 for (String requiredLine : requiredLines) {
332 if (item.indexOf(requiredLine) < 1) {
333 mismatchDescription.appendText("FCP message does not contain ").appendValue(requiredLine);
341 public void describeTo(Description description) {
342 description.appendText("FCP message named ").appendValue(name);
343 description.appendValueList(", containing the lines ", ", ", "", requiredLines);
349 public void clientPutWithDirectDataSendsCorrectCommand()
350 throws IOException, ExecutionException, InterruptedException {
351 fcpClient.clientPut()
352 .from(new ByteArrayInputStream("Hello\n".getBytes()))
357 List<String> lines = fcpServer.collectUntil(is("Hello"));
358 assertThat(lines, matchesFcpMessage("ClientPut", "UploadFrom=direct", "DataLength=6", "URI=KSK@foo.txt"));
362 public void clientPutWithDirectDataSucceedsOnCorrectIdentifier()
363 throws InterruptedException, ExecutionException, IOException {
364 Future<Optional<Key>> key = fcpClient.clientPut()
365 .from(new ByteArrayInputStream("Hello\n".getBytes()))
370 List<String> lines = fcpServer.collectUntil(is("Hello"));
371 String identifier = extractIdentifier(lines);
374 "Identifier=not-the-right-one",
380 "Identifier=" + identifier,
383 assertThat(key.get().get().getKey(), is("KSK@foo.txt"));
387 public void clientPutWithDirectDataFailsOnCorrectIdentifier()
388 throws InterruptedException, ExecutionException, IOException {
389 Future<Optional<Key>> key = fcpClient.clientPut()
390 .from(new ByteArrayInputStream("Hello\n".getBytes()))
395 List<String> lines = fcpServer.collectUntil(is("Hello"));
396 String identifier = extractIdentifier(lines);
399 "Identifier=not-the-right-one",
405 "Identifier=" + identifier,
408 assertThat(key.get().isPresent(), is(false));
412 public void clientPutWithRenamedDirectDataSendsCorrectCommand()
413 throws InterruptedException, ExecutionException, IOException {
414 fcpClient.clientPut()
415 .named("otherName.txt")
416 .from(new ByteArrayInputStream("Hello\n".getBytes()))
421 List<String> lines = fcpServer.collectUntil(is("Hello"));
422 assertThat(lines, matchesFcpMessage("ClientPut", "TargetFilename=otherName.txt", "UploadFrom=direct",
423 "DataLength=6", "URI=KSK@foo.txt"));
427 public void clientPutWithRedirectSendsCorrectCommand()
428 throws IOException, ExecutionException, InterruptedException {
429 fcpClient.clientPut().redirectTo("KSK@bar.txt").uri("KSK@foo.txt").execute();
431 List<String> lines = fcpServer.collectUntil(is("EndMessage"));
433 matchesFcpMessage("ClientPut", "UploadFrom=redirect", "URI=KSK@foo.txt", "TargetURI=KSK@bar.txt"));
437 public void clientPutWithFileSendsCorrectCommand() throws InterruptedException, ExecutionException, IOException {
438 fcpClient.clientPut().from(new File("/tmp/data.txt")).uri("KSK@foo.txt").execute();
440 List<String> lines = fcpServer.collectUntil(is("EndMessage"));
442 matchesFcpMessage("ClientPut", "UploadFrom=disk", "URI=KSK@foo.txt", "Filename=/tmp/data.txt"));
446 public void clientPutWithFileCanCompleteTestDdaSequence()
447 throws IOException, ExecutionException, InterruptedException {
448 File tempFile = createTempFile();
449 fcpClient.clientPut().from(new File(tempFile.getParent(), "test.dat")).uri("KSK@foo.txt").execute();
451 List<String> lines = fcpServer.collectUntil(is("EndMessage"));
452 String identifier = extractIdentifier(lines);
455 "Identifier=" + identifier,
459 lines = fcpServer.collectUntil(is("EndMessage"));
460 assertThat(lines, matchesFcpMessage(
462 "Directory=" + tempFile.getParent(),
463 "WantReadDirectory=true",
464 "WantWriteDirectory=false",
469 "Directory=" + tempFile.getParent(),
470 "ReadFilename=" + tempFile,
473 lines = fcpServer.collectUntil(is("EndMessage"));
474 assertThat(lines, matchesFcpMessage(
476 "Directory=" + tempFile.getParent(),
477 "ReadContent=test-content",
482 "Directory=" + tempFile.getParent(),
483 "ReadDirectoryAllowed=true",
486 lines = fcpServer.collectUntil(is("EndMessage"));
488 matchesFcpMessage("ClientPut", "UploadFrom=disk", "URI=KSK@foo.txt",
489 "Filename=" + new File(tempFile.getParent(), "test.dat")));
492 private File createTempFile() throws IOException {
493 File tempFile = File.createTempFile("test-dda-", ".dat");
494 tempFile.deleteOnExit();
495 Files.write("test-content", tempFile, StandardCharsets.UTF_8);
500 public void clientPutDoesNotReactToProtocolErrorForDifferentIdentifier()
501 throws InterruptedException, ExecutionException, IOException {
502 Future<Optional<Key>> key = fcpClient.clientPut().from(new File("/tmp/data.txt")).uri("KSK@foo.txt").execute();
504 List<String> lines = fcpServer.collectUntil(is("EndMessage"));
505 String identifier = extractIdentifier(lines);
508 "Identifier=not-the-right-one",
514 "Identifier=" + identifier,
518 assertThat(key.get().get().getKey(), is("KSK@foo.txt"));
522 public void clientPutAbortsOnProtocolErrorOtherThan25()
523 throws InterruptedException, ExecutionException, IOException {
524 Future<Optional<Key>> key = fcpClient.clientPut().from(new File("/tmp/data.txt")).uri("KSK@foo.txt").execute();
526 List<String> lines = fcpServer.collectUntil(is("EndMessage"));
527 String identifier = extractIdentifier(lines);
530 "Identifier=" + identifier,
534 assertThat(key.get().isPresent(), is(false));
538 public void clientPutDoesNotReplyToWrongTestDdaReply() throws IOException, ExecutionException,
539 InterruptedException {
540 File tempFile = createTempFile();
541 fcpClient.clientPut().from(new File(tempFile.getParent(), "test.dat")).uri("KSK@foo.txt").execute();
543 List<String> lines = fcpServer.collectUntil(is("EndMessage"));
544 String identifier = extractIdentifier(lines);
547 "Identifier=" + identifier,
551 lines = fcpServer.collectUntil(is("EndMessage"));
552 assertThat(lines, matchesFcpMessage(
554 "Directory=" + tempFile.getParent(),
555 "WantReadDirectory=true",
556 "WantWriteDirectory=false",
561 "Directory=/some-other-directory",
562 "ReadFilename=" + tempFile,
567 "Directory=" + tempFile.getParent(),
568 "ReadFilename=" + tempFile,
571 lines = fcpServer.collectUntil(is("EndMessage"));
572 assertThat(lines, matchesFcpMessage(
574 "Directory=" + tempFile.getParent(),
575 "ReadContent=test-content",
581 public void clientPutSendsResponseEvenIfFileCanNotBeRead()
582 throws IOException, ExecutionException, InterruptedException {
583 File tempFile = createTempFile();
584 fcpClient.clientPut().from(new File(tempFile.getParent(), "test.dat")).uri("KSK@foo.txt").execute();
586 List<String> lines = fcpServer.collectUntil(is("EndMessage"));
587 String identifier = extractIdentifier(lines);
590 "Identifier=" + identifier,
594 lines = fcpServer.collectUntil(is("EndMessage"));
595 assertThat(lines, matchesFcpMessage(
597 "Directory=" + tempFile.getParent(),
598 "WantReadDirectory=true",
599 "WantWriteDirectory=false",
604 "Directory=" + tempFile.getParent(),
605 "ReadFilename=" + tempFile + ".foo",
608 lines = fcpServer.collectUntil(is("EndMessage"));
609 assertThat(lines, matchesFcpMessage(
611 "Directory=" + tempFile.getParent(),
612 "ReadContent=failed-to-read",
618 public void clientPutDoesNotResendOriginalClientPutOnTestDDACompleteWithWrongDirectory()
619 throws IOException, ExecutionException, InterruptedException {
620 File tempFile = createTempFile();
621 fcpClient.clientPut().from(new File(tempFile.getParent(), "test.dat")).uri("KSK@foo.txt").execute();
623 List<String> lines = fcpServer.collectUntil(is("EndMessage"));
624 String identifier = extractIdentifier(lines);
627 "Directory=/some-other-directory",
632 "Identifier=" + identifier,
636 lines = fcpServer.collectUntil(is("EndMessage"));
637 assertThat(lines, matchesFcpMessage(
639 "Directory=" + tempFile.getParent(),
640 "WantReadDirectory=true",
641 "WantWriteDirectory=false",
647 public void clientCanListPeers() throws IOException, ExecutionException, InterruptedException {
648 Future<Collection<Peer>> peers = fcpClient.listPeers().execute();
650 List<String> lines = fcpServer.collectUntil(is("EndMessage"));
651 assertThat(lines, matchesFcpMessage(
653 "WithVolatile=false",
654 "WithMetadata=false",
657 String identifier = extractIdentifier(lines);
660 "Identifier=" + identifier,
666 "Identifier=" + identifier,
672 "Identifier=" + identifier,
675 assertThat(peers.get(), hasSize(2));
676 assertThat(peers.get().stream().map(Peer::getIdentity).collect(Collectors.toList()),
677 containsInAnyOrder("id1", "id2"));
681 public void clientCanListPeersWithMetadata() throws IOException, ExecutionException, InterruptedException {
682 Future<Collection<Peer>> peers = fcpClient.listPeers().includeMetadata().execute();
684 List<String> lines = fcpServer.collectUntil(is("EndMessage"));
685 assertThat(lines, matchesFcpMessage(
687 "WithVolatile=false",
691 String identifier = extractIdentifier(lines);
694 "Identifier=" + identifier,
701 "Identifier=" + identifier,
708 "Identifier=" + identifier,
711 assertThat(peers.get(), hasSize(2));
712 assertThat(peers.get().stream().map(peer -> peer.getMetadata("foo")).collect(Collectors.toList()),
713 containsInAnyOrder("bar1", "bar2"));
717 public void clientCanListPeersWithVolatiles() throws IOException, ExecutionException, InterruptedException {
718 Future<Collection<Peer>> peers = fcpClient.listPeers().includeVolatile().execute();
720 List<String> lines = fcpServer.collectUntil(is("EndMessage"));
721 assertThat(lines, matchesFcpMessage(
724 "WithMetadata=false",
727 String identifier = extractIdentifier(lines);
730 "Identifier=" + identifier,
737 "Identifier=" + identifier,
744 "Identifier=" + identifier,
747 assertThat(peers.get(), hasSize(2));
748 assertThat(peers.get().stream().map(peer -> peer.getVolatile("foo")).collect(Collectors.toList()),
749 containsInAnyOrder("bar1", "bar2"));
753 public void defaultFcpClientCanGetNodeInformation() throws InterruptedException, ExecutionException, IOException {
754 Future<NodeData> nodeData = fcpClient.getNode().execute();
756 List<String> lines = fcpServer.collectUntil(is("EndMessage"));
757 String identifier = extractIdentifier(lines);
758 assertThat(lines, matchesFcpMessage(
760 "Identifier=" + identifier,
761 "GiveOpennetRef=false",
763 "WithVolatile=false",
768 "Identifier=" + identifier,
769 "ark.pubURI=SSK@3YEf.../ark",
772 "version=Fred,0.7,1.0,1466",
773 "lastGoodVersion=Fred,0.7,1.0,1466",
776 assertThat(nodeData.get(), notNullValue());
780 public void defaultFcpClientCanGetNodeInformationWithOpennetRef()
781 throws InterruptedException, ExecutionException, IOException {
782 Future<NodeData> nodeData = fcpClient.getNode().opennetRef().execute();
784 List<String> lines = fcpServer.collectUntil(is("EndMessage"));
785 String identifier = extractIdentifier(lines);
786 assertThat(lines, matchesFcpMessage(
788 "Identifier=" + identifier,
789 "GiveOpennetRef=true",
791 "WithVolatile=false",
796 "Identifier=" + identifier,
798 "ark.pubURI=SSK@3YEf.../ark",
801 "version=Fred,0.7,1.0,1466",
802 "lastGoodVersion=Fred,0.7,1.0,1466",
805 assertThat(nodeData.get().getVersion().toString(), is("Fred,0.7,1.0,1466"));
809 public void defaultFcpClientCanGetNodeInformationWithPrivateData()
810 throws InterruptedException, ExecutionException, IOException {
811 Future<NodeData> nodeData = fcpClient.getNode().includePrivate().execute();
813 List<String> lines = fcpServer.collectUntil(is("EndMessage"));
814 String identifier = extractIdentifier(lines);
815 assertThat(lines, matchesFcpMessage(
817 "Identifier=" + identifier,
818 "GiveOpennetRef=false",
820 "WithVolatile=false",
825 "Identifier=" + identifier,
827 "ark.pubURI=SSK@3YEf.../ark",
830 "version=Fred,0.7,1.0,1466",
831 "lastGoodVersion=Fred,0.7,1.0,1466",
832 "ark.privURI=SSK@XdHMiRl",
835 assertThat(nodeData.get().getARK().getPrivateURI(), is("SSK@XdHMiRl"));