2005-04-18 17:03:21 +00:00
|
|
|
// runs EchoServer and EchoClient as threads
|
|
|
|
|
|
|
|
package net.i2p.aum;
|
|
|
|
|
2008-07-16 13:42:54 +00:00
|
|
|
import java.io.IOException;
|
2005-04-18 17:03:21 +00:00
|
|
|
|
2008-07-16 13:42:54 +00:00
|
|
|
import net.i2p.I2PException;
|
|
|
|
import net.i2p.data.Destination;
|
2005-04-18 17:03:21 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* A simple program which runs the EchoServer and EchoClient
|
|
|
|
* demos as threads
|
|
|
|
*/
|
|
|
|
|
|
|
|
public class EchoTest
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* create one instance each of EchoServer and EchoClient,
|
|
|
|
* run the server as a thread, run the client in foreground,
|
|
|
|
* display detailed results
|
|
|
|
*/
|
|
|
|
public static void main(String [] args)
|
|
|
|
{
|
|
|
|
EchoServer server;
|
|
|
|
EchoClient client;
|
|
|
|
|
|
|
|
try {
|
|
|
|
server = new EchoServer();
|
|
|
|
Destination serverDest = server.getDest();
|
|
|
|
|
|
|
|
System.out.println("EchoTest: serverDest=" + serverDest.toBase64());
|
|
|
|
|
|
|
|
client = new EchoClient(serverDest);
|
|
|
|
|
|
|
|
} catch (I2PException e) {
|
|
|
|
e.printStackTrace(); return;
|
|
|
|
} catch (IOException e) {
|
|
|
|
e.printStackTrace(); return;
|
|
|
|
}
|
|
|
|
|
|
|
|
System.out.println("Starting server...");
|
|
|
|
//server.start();
|
|
|
|
|
|
|
|
System.out.println("Starting client...");
|
|
|
|
client.run();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|