mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-07-27 00:45:23 -04:00
Add server code and comments
This commit is contained in:
parent
c8c5e821b8
commit
4454236264
1 changed files with 27 additions and 5 deletions
|
@ -44,7 +44,6 @@ import net.tomp2p.storage.Data;
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Ignore;
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
@ -52,6 +51,10 @@ import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import static org.junit.Assert.*;
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tests bootstrapping, put/get and sendDirect in WAN environment (auto port forwarding, Relay)
|
||||||
|
* startBootstrappingSeedNode is used as the server side code
|
||||||
|
*/
|
||||||
public class BasicUsecasesInWANTest {
|
public class BasicUsecasesInWANTest {
|
||||||
private static final Logger log = LoggerFactory.getLogger(BasicUsecasesInWANTest.class);
|
private static final Logger log = LoggerFactory.getLogger(BasicUsecasesInWANTest.class);
|
||||||
|
|
||||||
|
@ -64,8 +67,8 @@ public class BasicUsecasesInWANTest {
|
||||||
|
|
||||||
private final static String CLIENT_1_ID = "alice";
|
private final static String CLIENT_1_ID = "alice";
|
||||||
private final static String CLIENT_2_ID = "bob";
|
private final static String CLIENT_2_ID = "bob";
|
||||||
private final static int CLIENT_1_PORT = 6502;
|
private final static int CLIENT_1_PORT = 6500;
|
||||||
private final static int CLIENT_2_PORT = 6503;
|
private final static int CLIENT_2_PORT = 6501;
|
||||||
|
|
||||||
private Thread serverThread;
|
private Thread serverThread;
|
||||||
|
|
||||||
|
@ -129,7 +132,7 @@ public class BasicUsecasesInWANTest {
|
||||||
peer2DHT.shutdown().awaitUninterruptibly();
|
peer2DHT.shutdown().awaitUninterruptibly();
|
||||||
}
|
}
|
||||||
|
|
||||||
// That test is failing because eof timeouts
|
// That test is failing because of timeouts
|
||||||
/*
|
/*
|
||||||
|
|
||||||
server:
|
server:
|
||||||
|
@ -152,7 +155,7 @@ No future set beforehand, probably an early shutdown / timeout, or use setFailed
|
||||||
|
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
@Ignore
|
//@Ignore
|
||||||
public void testSendDirect() throws Exception {
|
public void testSendDirect() throws Exception {
|
||||||
PeerDHT peer1DHT = startClient(CLIENT_1_ID, CLIENT_1_PORT);
|
PeerDHT peer1DHT = startClient(CLIENT_1_ID, CLIENT_1_PORT);
|
||||||
PeerDHT peer2DHT = startClient(CLIENT_2_ID, CLIENT_2_PORT);
|
PeerDHT peer2DHT = startClient(CLIENT_2_ID, CLIENT_2_PORT);
|
||||||
|
@ -247,4 +250,23 @@ No future set beforehand, probably an early shutdown / timeout, or use setFailed
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void startBootstrappingSeedNode() {
|
||||||
|
Peer peer = null;
|
||||||
|
try {
|
||||||
|
peer = new PeerBuilder(Number160.createHash("digitalocean1.bitsquare.io")).ports(5000).start();
|
||||||
|
new PeerBuilderDHT(peer).start();
|
||||||
|
new PeerBuilderNAT(peer).start();
|
||||||
|
|
||||||
|
System.out.println("peer started.");
|
||||||
|
for (; ; ) {
|
||||||
|
for (PeerAddress pa : peer.peerBean().peerMap().all()) {
|
||||||
|
System.out.println("peer online (TCP):" + pa);
|
||||||
|
}
|
||||||
|
Thread.sleep(2000);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue