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