2 * jSite2 - FcpTest.java -
3 * Copyright © 2008 David Roden
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 package net.pterodactylus.util.fcp;
22 import java.io.IOException;
23 import java.util.List;
26 import junit.framework.TestCase;
31 * @author David ‘Bombe’ Roden <bombe@freenetproject.org>
34 public class FcpTest extends TestCase {
36 private FcpConnection fcpConnection;
42 protected void setUp() throws Exception {
43 fcpConnection = new FcpConnection("wing", "FcpTest");
44 fcpConnection.connect();
51 protected void tearDown() throws Exception {
52 fcpConnection.disconnect();
55 public void testFcpConnection() throws FcpException, IOException {
58 public void testListPeers() throws FcpException, IOException {
59 List<Map<String, String>> peers = fcpConnection.sendListPeers(true, true);
60 for (Map<String, String> peer: peers) {
61 for (Map.Entry<String, String> entry: peer.entrySet()) {
62 System.out.println(entry.getKey() + ": " + entry.getValue());
67 public void testListPeerNotes() throws FcpException, IOException {
68 List<Map<String, String>> peers = fcpConnection.sendListPeerNotes("AY6rGAGjayoyQD2CkvQibf1Ct3mh6iwqyntzNpfRsiM");
69 for (Map<String, String> peer: peers) {
70 for (Map.Entry<String, String> entry: peer.entrySet()) {
71 System.out.println(entry.getKey() + ": " + entry.getValue());
76 public void testGenerateSSK() throws IOException, FcpException {
77 FcpKeyPair keyPair = fcpConnection.generateSSK();
78 System.out.println("PrivateKey: " + keyPair.getPrivateKey());
79 System.out.println("PublicKey: " + keyPair.getPublicKey());