Moved reliability layer into its own package.

This commit is contained in:
akwizgran
2012-12-15 02:07:46 +00:00
parent f5628e5581
commit 5876583f7c
24 changed files with 68 additions and 114 deletions

View File

@@ -1,47 +0,0 @@
package net.sf.briar.plugins.modem;
import static java.util.logging.Level.INFO;
import java.util.Collections;
import java.util.Map;
import java.util.concurrent.Executor;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.logging.Logger;
import net.sf.briar.api.ContactId;
import net.sf.briar.api.TransportConfig;
import net.sf.briar.api.TransportProperties;
import net.sf.briar.plugins.DuplexClientTest;
//This is not a JUnit test - it has to be run manually while the server test
//is running on another machine
public class ModemClientTest extends DuplexClientTest {
private ModemClientTest(Executor executor, String number) {
// Store the server's phone number
TransportProperties p = new TransportProperties();
p.put("number", number);
Map<ContactId, TransportProperties> remote =
Collections.singletonMap(contactId, p);
// Create the plugin
callback = new ClientCallback(new TransportConfig(),
new TransportProperties(), remote);
plugin = new ModemPlugin(executor, new ModemFactoryImpl(executor,
new ReliabilityLayerFactoryImpl(executor)), callback, 0L);
}
public static void main(String[] args) throws Exception {
if(args.length != 1) {
System.err.println("Please specify the server's phone number");
System.exit(1);
}
Logger.getLogger("net.sf.briar").setLevel(INFO);
ExecutorService executor = Executors.newCachedThreadPool();
try {
new ModemClientTest(executor, args[0]).run();
} finally {
executor.shutdown();
}
}
}

View File

@@ -1,37 +0,0 @@
package net.sf.briar.plugins.modem;
import static java.util.logging.Level.INFO;
import java.util.Collections;
import java.util.concurrent.Executor;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.logging.Logger;
import net.sf.briar.api.TransportConfig;
import net.sf.briar.api.TransportProperties;
import net.sf.briar.plugins.DuplexServerTest;
//This is not a JUnit test - it has to be run manually while the client test
//is running on another machine
public class ModemServerTest extends DuplexServerTest {
private ModemServerTest(Executor executor) {
// Create the plugin
callback = new ServerCallback(new TransportConfig(),
new TransportProperties(), Collections.singletonMap(contactId,
new TransportProperties()));
plugin = new ModemPlugin(executor, new ModemFactoryImpl(executor,
new ReliabilityLayerFactoryImpl(executor)), callback, 0L);
}
public static void main(String[] args) throws Exception {
Logger.getLogger("net.sf.briar").setLevel(INFO);
ExecutorService executor = Executors.newCachedThreadPool();
try {
new ModemServerTest(executor).run();
} finally {
executor.shutdown();
}
}
}