/**
* 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<Map<String, String>> peers = fcpConnection.sendListPeers(true, true);
-// for (Map<String, String> peer: peers) {
-// for (Map.Entry<String, String> entry: peer.entrySet()) {
-// System.out.println(entry.getKey() + ": " + entry.getValue());
-// }
-// }
-// }
-
-// public void testListPeerNotes() throws FcpException, IOException {
-// List<Map<String, String>> peers = fcpConnection.sendListPeerNotes("AY6rGAGjayoyQD2CkvQibf1Ct3mh6iwqyntzNpfRsiM");
-// for (Map<String, String> peer: peers) {
-// for (Map.Entry<String, String> entry: peer.entrySet()) {
-// System.out.println(entry.getKey() + ": " + entry.getValue());
-// }
-// }
-// }
-
/**
* Generates an SSK key pair.
*
* 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]);
}
}