Add test for protocol error 25 for different identifier
authorDavid ‘Bombe’ Roden <bombe@freenetproject.org>
Thu, 9 Jul 2015 05:09:49 +0000 (07:09 +0200)
committerDavid ‘Bombe’ Roden <bombe@freenetproject.org>
Thu, 9 Jul 2015 05:09:49 +0000 (07:09 +0200)
src/test/java/net/pterodactylus/fcp/quelaton/DefaultFcpClientTest.java

index f26fff4..0fbb7b8 100644 (file)
@@ -435,4 +435,26 @@ public class DefaultFcpClientTest {
                return tempFile;
        }
 
+       @Test
+       public void clientPutDoesNotReactToProtocolErrorForDifferentIdentifier()
+       throws InterruptedException, ExecutionException, IOException {
+               Future<Optional<Key>> key = fcpClient.clientPut().from(new File("/tmp/data.txt")).key(new Key("KSK@foo.txt"));
+               connectNode();
+               List<String> lines = fcpServer.collectUntil(is("EndMessage"));
+               String identifier = extractIdentifier(lines);
+               fcpServer.writeLine(
+                       "ProtocolError",
+                       "Identifier=not-the-right-one",
+                       "Code=25",
+                       "EndMessage"
+               );
+               fcpServer.writeLine(
+                       "PutSuccessful",
+                       "Identifier=" + identifier,
+                       "URI=KSK@foo.txt",
+                       "EndMessage"
+               );
+               assertThat(key.get().get().getKey(), is("KSK@foo.txt"));
+       }
+
 }