From 879ff57789231d36a865b2716b96e8bafa13054d Mon Sep 17 00:00:00 2001 From: Chris Beams Date: Mon, 10 Nov 2014 13:12:45 +0100 Subject: [PATCH] Remove obsolete SeedNodeForTesting class --- .../io/bitsquare/msg/SeedNodeForTesting.java | 80 ------------------- .../java/io/bitsquare/msg/TomP2PTests.java | 2 +- 2 files changed, 1 insertion(+), 81 deletions(-) delete mode 100644 src/test/java/io/bitsquare/msg/SeedNodeForTesting.java diff --git a/src/test/java/io/bitsquare/msg/SeedNodeForTesting.java b/src/test/java/io/bitsquare/msg/SeedNodeForTesting.java deleted file mode 100644 index 4d39f76fb5..0000000000 --- a/src/test/java/io/bitsquare/msg/SeedNodeForTesting.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * This file is part of Bitsquare. - * - * Bitsquare is free software: you can redistribute it and/or modify it - * under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or (at - * your option) any later version. - * - * Bitsquare is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public - * License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with Bitsquare. If not, see . - */ - -package io.bitsquare.msg; - -import io.bitsquare.network.Node; - -import net.tomp2p.connection.Bindings; -import net.tomp2p.connection.ChannelServerConfiguration; -import net.tomp2p.connection.Ports; -import net.tomp2p.connection.StandardProtocolFamily; -import net.tomp2p.dht.PeerBuilderDHT; -import net.tomp2p.nat.PeerBuilderNAT; -import net.tomp2p.p2p.Peer; -import net.tomp2p.p2p.PeerBuilder; -import net.tomp2p.peers.Number160; -import net.tomp2p.peers.PeerAddress; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * Used for testing with {@link TomP2PTests} - */ -public class SeedNodeForTesting { - private static final Logger log = LoggerFactory.getLogger(SeedNodeForTesting.class); - - public static void main(String[] args) throws Exception { - Peer peer = null; - try { - ChannelServerConfiguration csc = PeerBuilder.createDefaultChannelServerConfiguration(); - csc.ports(new Ports(Node.DEFAULT_PORT, Node.DEFAULT_PORT)); - csc.portsForwarding(new Ports(Node.DEFAULT_PORT, Node.DEFAULT_PORT)); - csc.connectionTimeoutTCPMillis(10 * 1000); - csc.idleTCPSeconds(10); - csc.idleUDPSeconds(10); - - Bindings bindings = new Bindings(); - bindings.addProtocol(StandardProtocolFamily.INET); - - peer = new PeerBuilder(Number160.createHash("localhost")).bindings(bindings) - .channelServerConfiguration(csc).ports(Node.DEFAULT_PORT).start(); - - peer.objectDataReply((sender, request) -> { - log.trace("received request: ", request.toString()); - return "pong"; - }); - - // Needed for DHT support - new PeerBuilderDHT(peer).start(); - // Needed for NAT support - new PeerBuilderNAT(peer).start(); - - log.debug("SeedNode started."); - for (; ; ) { - for (PeerAddress pa : peer.peerBean().peerMap().all()) { - log.debug("peer online:" + pa); - } - Thread.sleep(2000); - } - } catch (Exception e) { - if (peer != null) - peer.shutdown().awaitUninterruptibly(); - } - } -} diff --git a/src/test/java/io/bitsquare/msg/TomP2PTests.java b/src/test/java/io/bitsquare/msg/TomP2PTests.java index 35b2b65519..4814f9f98a 100644 --- a/src/test/java/io/bitsquare/msg/TomP2PTests.java +++ b/src/test/java/io/bitsquare/msg/TomP2PTests.java @@ -70,7 +70,7 @@ import static org.junit.Assert.*; * Test bootstrapping, DHT operations like put/get/add/remove and sendDirect in both LAN and WAN environment * Test scenarios in direct connection, auto port forwarding or relay mode. *

- * The start a seed node code use the {@link SeedNodeForTesting} class. + * To start a seed node code use the {@link io.bitsquare.app.cli.SeedNode} class. *

* To configure your test environment edit the static fields for id, IP and port. * In the configure method and the connectionType you can define your test scenario.