f81201e4b432a2629d1c6a340fa433d7bc1f3a56
[jFCPlib.git] / src / test / java / net / pterodactylus / fcp / quelaton / FcpReplySequenceTest.java
1 package net.pterodactylus.fcp.quelaton;
2
3 import static org.hamcrest.MatcherAssert.assertThat;
4 import static org.hamcrest.Matchers.empty;
5 import static org.hamcrest.Matchers.is;
6 import static org.hamcrest.Matchers.sameInstance;
7 import static org.mockito.Mockito.mock;
8 import static org.mockito.Mockito.verify;
9
10 import java.io.IOException;
11 import java.util.concurrent.ExecutionException;
12 import java.util.concurrent.ExecutorService;
13 import java.util.concurrent.Executors;
14 import java.util.concurrent.Future;
15 import java.util.concurrent.atomic.AtomicBoolean;
16 import java.util.concurrent.atomic.AtomicReference;
17
18 import net.pterodactylus.fcp.AllData;
19 import net.pterodactylus.fcp.BaseMessage;
20 import net.pterodactylus.fcp.CloseConnectionDuplicateClientName;
21 import net.pterodactylus.fcp.ConfigData;
22 import net.pterodactylus.fcp.DataFound;
23 import net.pterodactylus.fcp.EndListPeerNotes;
24 import net.pterodactylus.fcp.EndListPeers;
25 import net.pterodactylus.fcp.EndListPersistentRequests;
26 import net.pterodactylus.fcp.FCPPluginReply;
27 import net.pterodactylus.fcp.FcpConnection;
28 import net.pterodactylus.fcp.FcpMessage;
29 import net.pterodactylus.fcp.FinishedCompression;
30 import net.pterodactylus.fcp.GetFailed;
31 import net.pterodactylus.fcp.IdentifierCollision;
32 import net.pterodactylus.fcp.NodeData;
33 import net.pterodactylus.fcp.NodeHello;
34 import net.pterodactylus.fcp.Peer;
35 import net.pterodactylus.fcp.PeerNote;
36 import net.pterodactylus.fcp.PeerRemoved;
37 import net.pterodactylus.fcp.PersistentGet;
38 import net.pterodactylus.fcp.PersistentPut;
39 import net.pterodactylus.fcp.PersistentPutDir;
40 import net.pterodactylus.fcp.PersistentRequestModified;
41 import net.pterodactylus.fcp.PersistentRequestRemoved;
42 import net.pterodactylus.fcp.PluginInfo;
43 import net.pterodactylus.fcp.ProtocolError;
44 import net.pterodactylus.fcp.PutFailed;
45 import net.pterodactylus.fcp.PutFetchable;
46 import net.pterodactylus.fcp.PutSuccessful;
47 import net.pterodactylus.fcp.ReceivedBookmarkFeed;
48 import net.pterodactylus.fcp.SSKKeypair;
49 import net.pterodactylus.fcp.SentFeed;
50 import net.pterodactylus.fcp.SimpleProgress;
51 import net.pterodactylus.fcp.StartedCompression;
52 import net.pterodactylus.fcp.SubscribedUSKUpdate;
53 import net.pterodactylus.fcp.TestDDAComplete;
54 import net.pterodactylus.fcp.TestDDAReply;
55 import net.pterodactylus.fcp.URIGenerated;
56 import net.pterodactylus.fcp.UnknownNodeIdentifier;
57 import net.pterodactylus.fcp.UnknownPeerNoteType;
58
59 import org.junit.Test;
60
61 /**
62  * Unit test for {@link FcpReplySequence}.
63  *
64  * @author <a href="bombe@freenetproject.org">David ‘Bombe’ Roden</a>
65  */
66 public class FcpReplySequenceTest {
67
68         private final FcpConnection fcpConnection = mock(FcpConnection.class);
69         private final ExecutorService executorService = Executors.newSingleThreadExecutor();
70         private final TestFcpReplySequence replySequence = new TestFcpReplySequence(executorService, fcpConnection);
71         private final FcpMessage fcpMessage = new FcpMessage("Test");
72
73         @Test
74         public void canSendMessage() throws IOException, ExecutionException, InterruptedException {
75                 FcpReplySequence replySequence = createBasicReplySequence();
76                 replySequence.send(fcpMessage).get();
77                 verify(fcpConnection).sendMessage(fcpMessage);
78         }
79
80         private FcpReplySequence createBasicReplySequence() {
81                 return new FcpReplySequence(executorService, fcpConnection) {
82                                 @Override
83                                 protected boolean isFinished() {
84                                         return true;
85                                 }
86                         };
87         }
88
89         @Test
90         public void sendingAMessageRegistersTheWaiterAsFcpListener() throws IOException {
91                 FcpReplySequence replySequence = createBasicReplySequence();
92                 replySequence.send(fcpMessage);
93                 verify(fcpConnection).addFcpListener(replySequence);
94         }
95
96         @Test
97         public void closingTheReplyWaiterRemovesTheFcpListener() throws IOException {
98                 FcpReplySequence replySequence = createBasicReplySequence();
99                 replySequence.send(fcpMessage);
100                 replySequence.close();
101                 verify(fcpConnection).removeFcpListener(replySequence);
102         }
103
104         private <M extends BaseMessage> void waitForASpecificMessage(MessageReceiver<M> messageReceiver, Class<M> messageClass, MessageCreator<M> messageCreator) throws IOException, InterruptedException, ExecutionException {
105                 waitForASpecificMessage(messageReceiver, messageCreator.create(new FcpMessage(messageClass.getSimpleName())));
106         }
107
108         private <M extends BaseMessage> void waitForASpecificMessage(MessageReceiver<M> messageReceiver, M message) throws IOException, InterruptedException, ExecutionException {
109                 replySequence.setExpectedMessage(message.getName());
110                 Future<Boolean> result = replySequence.send(fcpMessage);
111                 messageReceiver.receiveMessage(fcpConnection, message);
112                 assertThat(result.get(), is(true));
113         }
114
115         private <M extends BaseMessage> M createMessage(Class<M> messageClass, MessageCreator<M> messageCreator) {
116                 return messageCreator.create(new FcpMessage(messageClass.getSimpleName()));
117         }
118
119         private interface MessageCreator<M extends BaseMessage> {
120
121                 M create(FcpMessage fcpMessage);
122
123         }
124
125         @Test
126         public void waitingForNodeHelloWorks() throws IOException, ExecutionException, InterruptedException {
127                 waitForASpecificMessage(replySequence::receivedNodeHello, NodeHello.class, NodeHello::new);
128         }
129
130         @Test
131         public void waitingForConnectionClosedDuplicateClientNameWorks() throws IOException, ExecutionException, InterruptedException {
132                 waitForASpecificMessage( replySequence::receivedCloseConnectionDuplicateClientName, CloseConnectionDuplicateClientName.class, CloseConnectionDuplicateClientName::new);
133         }
134
135         @Test
136         public void waitingForSSKKeypairWorks() throws InterruptedException, ExecutionException, IOException {
137                 waitForASpecificMessage(replySequence::receivedSSKKeypair, SSKKeypair.class, SSKKeypair::new);
138         }
139
140         @Test
141         public void waitForPeerWorks() throws InterruptedException, ExecutionException, IOException {
142                 waitForASpecificMessage(replySequence::receivedPeer, Peer.class, Peer::new);
143         }
144
145         @Test
146         public void waitForEndListPeersWorks() throws InterruptedException, ExecutionException, IOException {
147                 waitForASpecificMessage(replySequence::receivedEndListPeers, EndListPeers.class, EndListPeers::new);
148         }
149
150         @Test
151         public void waitForPeerNoteWorks() throws InterruptedException, ExecutionException, IOException {
152                 waitForASpecificMessage(replySequence::receivedPeerNote, PeerNote.class, PeerNote::new);
153         }
154
155         @Test
156         public void waitForEndListPeerNotesWorks() throws InterruptedException, ExecutionException, IOException {
157                 waitForASpecificMessage(replySequence::receivedEndListPeerNotes, EndListPeerNotes.class, EndListPeerNotes::new);
158         }
159
160         @Test
161         public void waitForPeerRemovedWorks() throws InterruptedException, ExecutionException, IOException {
162                 waitForASpecificMessage(replySequence::receivedPeerRemoved, PeerRemoved.class, PeerRemoved::new);
163         }
164
165         @Test
166         public void waitForNodeDataWorks() throws InterruptedException, ExecutionException, IOException {
167                 waitForASpecificMessage(replySequence::receivedNodeData, new NodeData(
168                         new FcpMessage("NodeData").put("ark.pubURI", "")
169                                         .put("ark.number", "0")
170                                         .put("auth.negTypes", "")
171                                         .put("version", "0,0,0,0")
172                                         .put("lastGoodVersion", "0,0,0,0")));
173         }
174
175         @Test
176         public void waitForTestDDAReplyWorks() throws InterruptedException, ExecutionException, IOException {
177                 waitForASpecificMessage(replySequence::receivedTestDDAReply, TestDDAReply.class, TestDDAReply::new);
178         }
179
180         @Test
181         public void waitForTestDDACompleteWorks() throws InterruptedException, ExecutionException, IOException {
182                 waitForASpecificMessage(replySequence::receivedTestDDAComplete, TestDDAComplete.class, TestDDAComplete::new);
183         }
184
185         @Test
186         public void waitForPersistentGetWorks() throws InterruptedException, ExecutionException, IOException {
187                 waitForASpecificMessage(replySequence::receivedPersistentGet, PersistentGet.class, PersistentGet::new);
188         }
189
190         @Test
191         public void waitForPersistentPutWorks() throws InterruptedException, ExecutionException, IOException {
192                 waitForASpecificMessage(replySequence::receivedPersistentPut, PersistentPut.class, PersistentPut::new);
193         }
194
195         @Test
196         public void waitForEndListPersistentRequestsWorks() throws InterruptedException, ExecutionException, IOException {
197                 waitForASpecificMessage(replySequence::receivedEndListPersistentRequests, EndListPersistentRequests.class, EndListPersistentRequests::new);
198         }
199
200         @Test
201         public void waitForURIGeneratedWorks() throws InterruptedException, ExecutionException, IOException {
202                 waitForASpecificMessage(replySequence::receivedURIGenerated, URIGenerated.class, URIGenerated::new);
203         }
204
205         @Test
206         public void waitForDataFoundWorks() throws InterruptedException, ExecutionException, IOException {
207                 waitForASpecificMessage(replySequence::receivedDataFound, DataFound.class, DataFound::new);
208         }
209
210         @Test
211         public void waitForAllDataWorks() throws InterruptedException, ExecutionException, IOException {
212                 waitForASpecificMessage(replySequence::receivedAllData, new AllData(new FcpMessage("AllData"), null));
213         }
214
215         @Test
216         public void waitForSimpleProgressWorks() throws InterruptedException, ExecutionException, IOException {
217                 waitForASpecificMessage(replySequence::receivedSimpleProgress, SimpleProgress.class, SimpleProgress::new);
218         }
219
220         @Test
221         public void waitForStartedCompressionWorks() throws InterruptedException, ExecutionException, IOException {
222                 waitForASpecificMessage(replySequence::receivedStartedCompression, StartedCompression.class, StartedCompression::new);
223         }
224
225         @Test
226         public void waitForFinishedCompressionWorks() throws InterruptedException, ExecutionException, IOException {
227                 waitForASpecificMessage(replySequence::receivedFinishedCompression, FinishedCompression.class, FinishedCompression::new);
228         }
229
230         @Test
231         public void waitForUnknownPeerNoteTypeWorks() throws InterruptedException, ExecutionException, IOException {
232                 waitForASpecificMessage(replySequence::receivedUnknownPeerNoteType, UnknownPeerNoteType.class, UnknownPeerNoteType::new);
233         }
234
235         @Test
236         public void waitForUnknownNodeIdentifierWorks() throws InterruptedException, ExecutionException, IOException {
237                 waitForASpecificMessage(replySequence::receivedUnknownNodeIdentifier, UnknownNodeIdentifier.class, UnknownNodeIdentifier::new);
238         }
239
240         @Test
241         public void waitForConfigDataWorks() throws InterruptedException, ExecutionException, IOException {
242                 waitForASpecificMessage(replySequence::receivedConfigData, ConfigData.class, ConfigData::new);
243         }
244
245         @Test
246         public void waitForGetFailedWorks() throws InterruptedException, ExecutionException, IOException {
247                 waitForASpecificMessage(replySequence::receivedGetFailed, GetFailed.class, GetFailed::new);
248         }
249
250         @Test
251         public void waitForPutFailedWorks() throws InterruptedException, ExecutionException, IOException {
252                 waitForASpecificMessage(replySequence::receivedPutFailed, PutFailed.class, PutFailed::new);
253         }
254
255         @Test
256         public void waitForIdentifierCollisionWorks() throws InterruptedException, ExecutionException, IOException {
257                 waitForASpecificMessage(replySequence::receivedIdentifierCollision, IdentifierCollision.class, IdentifierCollision::new);
258         }
259
260         @Test
261         public void waitForPersistentPutDirWorks() throws InterruptedException, ExecutionException, IOException {
262                 waitForASpecificMessage(replySequence::receivedPersistentPutDir, PersistentPutDir.class, PersistentPutDir::new);
263         }
264
265         @Test
266         public void waitForPersistentRequestRemovedWorks() throws InterruptedException, ExecutionException, IOException {
267                 waitForASpecificMessage(replySequence::receivedPersistentRequestRemoved, PersistentRequestRemoved.class, PersistentRequestRemoved::new);
268         }
269
270         @Test
271         public void waitForSubscribedUSKUpdateWorks() throws InterruptedException, ExecutionException, IOException {
272                 waitForASpecificMessage(replySequence::receivedSubscribedUSKUpdate, SubscribedUSKUpdate.class, SubscribedUSKUpdate::new);
273         }
274
275         @Test
276         public void waitForPluginInfoWorks() throws InterruptedException, ExecutionException, IOException {
277                 waitForASpecificMessage(replySequence::receivedPluginInfo, PluginInfo.class, PluginInfo::new);
278         }
279
280         @Test
281         public void waitForFCPPluginReply() throws InterruptedException, ExecutionException, IOException {
282                 waitForASpecificMessage(replySequence::receivedFCPPluginReply, new FCPPluginReply(new FcpMessage("FCPPluginReply"), null));
283         }
284
285         @Test
286         public void waitForPersistentRequestModifiedWorks() throws InterruptedException, ExecutionException, IOException {
287                 waitForASpecificMessage(replySequence::receivedPersistentRequestModified, PersistentRequestModified.class, PersistentRequestModified::new);
288         }
289
290         @Test
291         public void waitForPutSuccessfulWorks() throws InterruptedException, ExecutionException, IOException {
292                 waitForASpecificMessage(replySequence::receivedPutSuccessful, PutSuccessful.class, PutSuccessful::new);
293         }
294
295         @Test
296         public void waitForPutFetchableWorks() throws InterruptedException, ExecutionException, IOException {
297                 waitForASpecificMessage(replySequence::receivedPutFetchable, PutFetchable.class, PutFetchable::new);
298         }
299
300         @Test
301         public void waitForSentFeedWorks() throws InterruptedException, ExecutionException, IOException {
302                 waitForASpecificMessage(replySequence::receivedSentFeed, SentFeed.class, SentFeed::new);
303         }
304
305         @Test
306         public void waitForReceivedBookmarkFeedWorks() throws InterruptedException, ExecutionException, IOException {
307                 waitForASpecificMessage(replySequence::receivedBookmarkFeed, ReceivedBookmarkFeed.class, ReceivedBookmarkFeed::new);
308         }
309
310         @Test
311         public void waitForProtocolErrorWorks() throws InterruptedException, ExecutionException, IOException {
312                 waitForASpecificMessage(replySequence::receivedProtocolError, ProtocolError.class, ProtocolError::new);
313         }
314
315         @Test
316         public void waitForUnknownMessageWorks() throws IOException, ExecutionException, InterruptedException {
317                 replySequence.setExpectedMessage("SomeFcpMessage");
318                 Future<Boolean> result = replySequence.send(fcpMessage);
319                 replySequence.receivedMessage(fcpConnection, new FcpMessage("SomeFcpMessage"));
320                 assertThat(result.get(), is(true));
321         }
322
323         @Test
324         public void waitingForMultipleMessagesWorks() throws IOException, ExecutionException, InterruptedException {
325                 TestFcpReplySequence replySequence = new TestFcpReplySequence(executorService, fcpConnection) {
326                         private final AtomicBoolean gotPutFailed = new AtomicBoolean();
327                         private final AtomicBoolean gotGetFailed = new AtomicBoolean();
328
329                         @Override
330                         protected boolean isFinished() {
331                                 return gotPutFailed.get() && gotGetFailed.get();
332                         }
333
334                         @Override
335                         protected Boolean getResult() {
336                                 return isFinished();
337                         }
338
339                         @Override
340                         protected void consumePutFailed(PutFailed putFailed) {
341                                 gotPutFailed.set(true);
342                         }
343
344                         @Override
345                         protected void consumeGetFailed(GetFailed getFailed) {
346                                 gotGetFailed.set(true);
347                         }
348                 };
349                 Future<?> result = replySequence.send(fcpMessage);
350                 assertThat(result.isDone(), is(false));
351                 replySequence.receivedGetFailed(fcpConnection, new GetFailed(new FcpMessage("GetFailed")));
352                 assertThat(result.isDone(), is(false));
353                 replySequence.receivedPutFailed(fcpConnection, new PutFailed(new FcpMessage("PutFailed")));
354                 assertThat(result.get(), is(true));
355         }
356
357         @Test
358         public void waitingForConnectionClosureWorks() throws IOException, ExecutionException, InterruptedException {
359                 replySequence.setExpectedMessage("none");
360                 Future<Boolean> result = replySequence.send(fcpMessage);
361                 Throwable throwable = new Throwable();
362                 replySequence.connectionClosed(fcpConnection, throwable);
363                 try {
364                         result.get();
365                 } catch (ExecutionException e) {
366                         Throwable t = e;
367                         while (t.getCause() != null) {
368                                 t = t.getCause();
369                         }
370                         assertThat(t, sameInstance(throwable));
371                 }
372         }
373
374         @FunctionalInterface
375         private interface MessageReceiver<M> {
376
377                 void receiveMessage(FcpConnection fcpConnection, M message);
378
379         }
380
381         private static class TestFcpReplySequence extends FcpReplySequence<Boolean> {
382
383                 private final AtomicReference<String> gotMessage = new AtomicReference<>();
384                 private final AtomicReference<String> expectedMessage = new AtomicReference<>();
385
386                 public TestFcpReplySequence(ExecutorService executorService, FcpConnection fcpConnection) {
387                         super(executorService, fcpConnection);
388                 }
389
390                 public void setExpectedMessage(String expectedMessage) {
391                         this.expectedMessage.set(expectedMessage);
392                 }
393
394                 @Override
395                 protected boolean isFinished() {
396                         return getResult();
397                 }
398
399                 @Override
400                 protected Boolean getResult() {
401                         return expectedMessage.get().equals(gotMessage.get());
402                 }
403
404                 @Override
405                 protected void consumeNodeHello(NodeHello nodeHello) {
406                         gotMessage.set(nodeHello.getName());
407                 }
408
409                 @Override
410                 protected void consumeCloseConnectionDuplicateClientName(
411                         CloseConnectionDuplicateClientName closeConnectionDuplicateClientName) {
412                         gotMessage.set(closeConnectionDuplicateClientName.getName());
413                 }
414
415                 @Override
416                 protected void consumeSSKKeypair(SSKKeypair sskKeypair) {
417                         gotMessage.set(sskKeypair.getName());
418                 }
419
420                 @Override
421                 protected void consumePeer(Peer peer) {
422                         gotMessage.set(peer.getName());
423                 }
424
425                 @Override
426                 protected void consumeEndListPeers(EndListPeers endListPeers) {
427                         gotMessage.set(endListPeers.getName());
428                 }
429
430                 @Override
431                 protected void consumePeerNote(PeerNote peerNote) {
432                         gotMessage.set(peerNote.getName());
433                 }
434
435                 @Override
436                 protected void consumeEndListPeerNotes(EndListPeerNotes endListPeerNotes) {
437                         gotMessage.set(endListPeerNotes.getName());
438                 }
439
440                 @Override
441                 protected void consumePeerRemoved(PeerRemoved peerRemoved) {
442                         gotMessage.set(peerRemoved.getName());
443                 }
444
445                 @Override
446                 protected void consumeNodeData(NodeData nodeData) {
447                         gotMessage.set(nodeData.getName());
448                 }
449
450                 @Override
451                 protected void consumeTestDDAReply(TestDDAReply testDDAReply) {
452                         gotMessage.set(testDDAReply.getName());
453                 }
454
455                 @Override
456                 protected void consumeTestDDAComplete(TestDDAComplete testDDAComplete) {
457                         gotMessage.set(testDDAComplete.getName());
458                 }
459
460                 @Override
461                 protected void consumePersistentGet(PersistentGet persistentGet) {
462                         gotMessage.set(persistentGet.getName());
463                 }
464
465                 @Override
466                 protected void consumePersistentPut(PersistentPut persistentPut) {
467                         gotMessage.set(persistentPut.getName());
468                 }
469
470                 @Override
471                 protected void consumeEndListPersistentRequests(EndListPersistentRequests endListPersistentRequests) {
472                         gotMessage.set(endListPersistentRequests.getName());
473                 }
474
475                 @Override
476                 protected void consumeURIGenerated(URIGenerated uriGenerated) {
477                         gotMessage.set(uriGenerated.getName());
478                 }
479
480                 @Override
481                 protected void consumeDataFound(DataFound dataFound) {
482                         gotMessage.set(dataFound.getName());
483                 }
484
485                 @Override
486                 protected void consumeAllData(AllData allData) {
487                         gotMessage.set(allData.getName());
488                 }
489
490                 @Override
491                 protected void consumeSimpleProgress(SimpleProgress simpleProgress) {
492                         gotMessage.set(simpleProgress.getName());
493                 }
494
495                 @Override
496                 protected void consumeStartedCompression(StartedCompression startedCompression) {
497                         gotMessage.set(startedCompression.getName());
498                 }
499
500                 @Override
501                 protected void consumeFinishedCompression(FinishedCompression finishedCompression) {
502                         gotMessage.set(finishedCompression.getName());
503                 }
504
505                 @Override
506                 protected void consumeUnknownPeerNoteType(UnknownPeerNoteType unknownPeerNoteType) {
507                         gotMessage.set(unknownPeerNoteType.getName());
508                 }
509
510                 @Override
511                 protected void consumeUnknownNodeIdentifier(UnknownNodeIdentifier unknownNodeIdentifier) {
512                         gotMessage.set(unknownNodeIdentifier.getName());
513                 }
514
515                 @Override
516                 protected void consumeConfigData(ConfigData configData) {
517                         gotMessage.set(configData.getName());
518                 }
519
520                 @Override
521                 protected void consumeGetFailed(GetFailed getFailed) {
522                         gotMessage.set(getFailed.getName());
523                 }
524
525                 @Override
526                 protected void consumePutFailed(PutFailed putFailed) {
527                         gotMessage.set(putFailed.getName());
528                 }
529
530                 @Override
531                 protected void consumeIdentifierCollision(IdentifierCollision identifierCollision) {
532                         gotMessage.set(identifierCollision.getName());
533                 }
534
535                 @Override
536                 protected void consumePersistentPutDir(PersistentPutDir persistentPutDir) {
537                         gotMessage.set(persistentPutDir.getName());
538                 }
539
540                 @Override
541                 protected void consumePersistentRequestRemoved(PersistentRequestRemoved persistentRequestRemoved) {
542                         gotMessage.set(persistentRequestRemoved.getName());
543                 }
544
545                 @Override
546                 protected void consumeSubscribedUSKUpdate(SubscribedUSKUpdate subscribedUSKUpdate) {
547                         gotMessage.set(subscribedUSKUpdate.getName());
548                 }
549
550                 @Override
551                 protected void consumePluginInfo(PluginInfo pluginInfo) {
552                         gotMessage.set(pluginInfo.getName());
553                 }
554
555                 @Override
556                 protected void consumeFCPPluginReply(FCPPluginReply fcpPluginReply) {
557                         gotMessage.set(fcpPluginReply.getName());
558                 }
559
560                 @Override
561                 protected void consumePersistentRequestModified(PersistentRequestModified persistentRequestModified) {
562                         gotMessage.set(persistentRequestModified.getName());
563                 }
564
565                 @Override
566                 protected void consumePutSuccessful(PutSuccessful putSuccessful) {
567                         gotMessage.set(putSuccessful.getName());
568                 }
569
570                 @Override
571                 protected void consumePutFetchable(PutFetchable putFetchable) {
572                         gotMessage.set(putFetchable.getName());
573                 }
574
575                 @Override
576                 protected void consumeSentFeed(SentFeed sentFeed) {
577                         gotMessage.set(sentFeed.getName());
578                 }
579
580                 @Override
581                 protected void consumeReceivedBookmarkFeed(ReceivedBookmarkFeed receivedBookmarkFeed) {
582                         gotMessage.set(receivedBookmarkFeed.getName());
583                 }
584
585                 @Override
586                 protected void consumeProtocolError(ProtocolError protocolError) {
587                         gotMessage.set(protocolError.getName());
588                 }
589
590                 @Override
591                 protected void consumeUnknownMessage(FcpMessage fcpMessage) {
592                         gotMessage.set(fcpMessage.getName());
593                 }
594
595         }
596
597 }