X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fnet%2Fpterodactylus%2Futil%2Ffcp%2FFcpTest.java;fp=src%2Fnet%2Fpterodactylus%2Futil%2Ffcp%2FFcpTest.java;h=c17dadc7c0dbe93897ad344a9f37d4499af21183;hb=cd056778c3f2491efd134588b8335e79231a109d;hp=7aca8676b34a97c7dc984d71331442841e557ac8;hpb=09dc47bc79814f9c6ff59513ab9ee6074b0f829a;p=jSite2.git diff --git a/src/net/pterodactylus/util/fcp/FcpTest.java b/src/net/pterodactylus/util/fcp/FcpTest.java index 7aca867..c17dadc 100644 --- a/src/net/pterodactylus/util/fcp/FcpTest.java +++ b/src/net/pterodactylus/util/fcp/FcpTest.java @@ -55,32 +55,11 @@ public class FcpTest extends TestCase { /** * Tests the FCP connection be simply {@link #setUp() setting it up} and * {@link #tearDown() tearing it down} again. - * - * @throws IOException - * if an I/O error occurs */ - public void testFcpConnection() throws IOException { + public void testFcpConnection() { /* do nothing. */ } -// public void testListPeers() throws FcpException, IOException { -// List> peers = fcpConnection.sendListPeers(true, true); -// for (Map peer: peers) { -// for (Map.Entry entry: peer.entrySet()) { -// System.out.println(entry.getKey() + ": " + entry.getValue()); -// } -// } -// } - -// public void testListPeerNotes() throws FcpException, IOException { -// List> peers = fcpConnection.sendListPeerNotes("AY6rGAGjayoyQD2CkvQibf1Ct3mh6iwqyntzNpfRsiM"); -// for (Map peer: peers) { -// for (Map.Entry entry: peer.entrySet()) { -// System.out.println(entry.getKey() + ": " + entry.getValue()); -// } -// } -// } - /** * Generates an SSK key pair. * @@ -90,37 +69,26 @@ public class FcpTest extends TestCase { * if {@link Object#wait()} wakes up spuriously */ public void testGenerateSSK() throws IOException, InterruptedException { - final boolean[] result = new boolean[1]; + final SSKKeypair[] keypair = new SSKKeypair[1]; FcpAdapter fcpAdapter = new FcpAdapter() { - /** - * @see net.pterodactylus.util.fcp.FcpAdapter#receivedNodeHello(net.pterodactylus.util.fcp.FcpConnection, - * net.pterodactylus.util.fcp.NodeHello) - */ - @Override - public void receivedNodeHello(FcpConnection fcpConnection, NodeHello nodeHello) { - result[0] = true; - synchronized (this) { - notify(); - } - } /** - * @see net.pterodactylus.util.fcp.FcpAdapter#receivedCloseConnectionDuplicateClientName(net.pterodactylus.util.fcp.FcpConnection, - * net.pterodactylus.util.fcp.CloseConnectionDuplicateClientName) + * {@inheritDoc} */ @Override - public void receivedCloseConnectionDuplicateClientName(FcpConnection fcpConnection, CloseConnectionDuplicateClientName closeConnectionDuplicateClientName) { - result[0] = false; + public void receivedSSKKeypair(FcpConnection fcpConnection, SSKKeypair sskKeypair) { + keypair[0] = sskKeypair; synchronized (this) { notify(); } } }; + fcpConnection.addFcpListener(fcpAdapter); synchronized (fcpAdapter) { fcpConnection.sendMessage(new GenerateSSK()); fcpAdapter.wait(); } - assertTrue("received NodeHello", result[0]); + assertNotNull("ssk keypair", keypair[0]); } }