Added getMaxLatency() method to transport plugins.

This commit is contained in:
akwizgran
2013-02-01 20:19:23 +00:00
parent 14177e51f6
commit a73d9d05f2
24 changed files with 101 additions and 51 deletions

View File

@@ -26,7 +26,8 @@ public class BluetoothClientTest extends DuplexClientTest {
// Create the plugin
callback = new ClientCallback(new TransportConfig(),
new TransportProperties(), remote);
plugin = new BluetoothPlugin(executor, new SystemClock(), callback, 0L);
plugin = new BluetoothPlugin(executor, new SystemClock(), callback, 0L,
0L);
}
public static void main(String[] args) throws Exception {

View File

@@ -21,7 +21,8 @@ public class BluetoothServerTest extends DuplexServerTest {
// Create the plugin
callback = new ServerCallback(new TransportConfig(), local,
Collections.singletonMap(contactId, new TransportProperties()));
plugin = new BluetoothPlugin(executor, new SystemClock(), callback, 0L);
plugin = new BluetoothPlugin(executor, new SystemClock(), callback, 0L,
0L);
}
public static void main(String[] args) throws Exception {

View File

@@ -54,7 +54,7 @@ public class RemovableDrivePluginTest extends BriarTestCase {
}});
RemovableDrivePlugin plugin = new RemovableDrivePlugin(executor,
callback, finder, monitor);
callback, finder, monitor, 0L);
plugin.start();
assertNull(plugin.createWriter(contactId));
@@ -89,7 +89,7 @@ public class RemovableDrivePluginTest extends BriarTestCase {
}});
RemovableDrivePlugin plugin = new RemovableDrivePlugin(executor,
callback, finder, monitor);
callback, finder, monitor, 0L);
plugin.start();
assertNull(plugin.createWriter(contactId));
@@ -126,7 +126,7 @@ public class RemovableDrivePluginTest extends BriarTestCase {
}});
RemovableDrivePlugin plugin = new RemovableDrivePlugin(executor,
callback, finder, monitor);
callback, finder, monitor, 0L);
plugin.start();
assertNull(plugin.createWriter(contactId));
@@ -165,7 +165,7 @@ public class RemovableDrivePluginTest extends BriarTestCase {
}});
RemovableDrivePlugin plugin = new RemovableDrivePlugin(executor,
callback, finder, monitor);
callback, finder, monitor, 0L);
plugin.start();
assertNull(plugin.createWriter(contactId));
@@ -204,7 +204,7 @@ public class RemovableDrivePluginTest extends BriarTestCase {
}});
RemovableDrivePlugin plugin = new RemovableDrivePlugin(executor,
callback, finder, monitor);
callback, finder, monitor, 0L);
plugin.start();
assertNotNull(plugin.createWriter(contactId));
@@ -247,7 +247,7 @@ public class RemovableDrivePluginTest extends BriarTestCase {
}});
RemovableDrivePlugin plugin = new RemovableDrivePlugin(executor,
callback, finder, monitor);
callback, finder, monitor, 0L);
plugin.start();
SimplexTransportWriter writer = plugin.createWriter(contactId);
@@ -286,7 +286,7 @@ public class RemovableDrivePluginTest extends BriarTestCase {
}});
RemovableDrivePlugin plugin = new RemovableDrivePlugin(executor,
callback, finder, monitor);
callback, finder, monitor, 0L);
plugin.start();
plugin.driveInserted(testDir);
@@ -306,7 +306,7 @@ public class RemovableDrivePluginTest extends BriarTestCase {
context.mock(RemovableDriveMonitor.class);
RemovableDrivePlugin plugin = new RemovableDrivePlugin(executor,
callback, finder, monitor);
callback, finder, monitor, 0L);
assertFalse(plugin.isPossibleConnectionFilename("abcdefg.dat"));
assertFalse(plugin.isPossibleConnectionFilename("abcdefghi.dat"));
@@ -334,7 +334,7 @@ public class RemovableDrivePluginTest extends BriarTestCase {
}});
RemovableDrivePlugin plugin = new RemovableDrivePlugin(
new ImmediateExecutor(), callback, finder, monitor);
new ImmediateExecutor(), callback, finder, monitor, 0L);
plugin.start();
File f = new File(testDir, "abcdefgh.dat");

View File

@@ -37,7 +37,7 @@ public class ModemPluginTest extends BriarTestCase {
final SerialPortList serialPortList =
context.mock(SerialPortList.class);
final ModemPlugin plugin = new ModemPlugin(null, modemFactory,
serialPortList, null, 0L, true);
serialPortList, null, 0L, 0L, true);
final Modem modem = context.mock(Modem.class);
context.checking(new Expectations() {{
oneOf(serialPortList).getPortNames();
@@ -71,7 +71,7 @@ public class ModemPluginTest extends BriarTestCase {
final DuplexPluginCallback callback =
context.mock(DuplexPluginCallback.class);
final ModemPlugin plugin = new ModemPlugin(null, modemFactory,
serialPortList, callback, 0L, true);
serialPortList, callback, 0L, 0L, true);
final Modem modem = context.mock(Modem.class);
final TransportProperties local = new TransportProperties();
local.put("iso3166", ISO_1336);
@@ -112,7 +112,7 @@ public class ModemPluginTest extends BriarTestCase {
final DuplexPluginCallback callback =
context.mock(DuplexPluginCallback.class);
final ModemPlugin plugin = new ModemPlugin(null, modemFactory,
serialPortList, callback, 0L, true);
serialPortList, callback, 0L, 0L, true);
final Modem modem = context.mock(Modem.class);
final TransportProperties local = new TransportProperties();
local.put("iso3166", ISO_1336);
@@ -153,7 +153,7 @@ public class ModemPluginTest extends BriarTestCase {
final DuplexPluginCallback callback =
context.mock(DuplexPluginCallback.class);
final ModemPlugin plugin = new ModemPlugin(null, modemFactory,
serialPortList, callback, 0L, true);
serialPortList, callback, 0L, 0L, true);
final Modem modem = context.mock(Modem.class);
final TransportProperties local = new TransportProperties();
local.put("iso3166", ISO_1336);
@@ -204,7 +204,7 @@ public class ModemPluginTest extends BriarTestCase {
context.mock(DuplexPluginCallback.class);
// Disable shuffling for this test, it confuses jMock
final ModemPlugin plugin = new ModemPlugin(pluginExecutor, modemFactory,
serialPortList, callback, 0L, false);
serialPortList, callback, 0L, 0L, false);
final Modem modem = context.mock(Modem.class);
final TransportProperties local = new TransportProperties();
local.put("iso3166", ISO_1336);

View File

@@ -27,7 +27,7 @@ public class LanTcpClientTest extends DuplexClientTest {
// Create the plugin
callback = new ClientCallback(new TransportConfig(),
new TransportProperties(), remote);
plugin = new LanTcpPlugin(executor, new SystemClock(), callback, 0L);
plugin = new LanTcpPlugin(executor, new SystemClock(), callback, 0, 0);
}
public static void main(String[] args) throws Exception {

View File

@@ -36,7 +36,7 @@ public class LanTcpPluginTest extends BriarTestCase {
callback.local.put("port", "0");
Executor executor = Executors.newCachedThreadPool();
Clock clock = new SystemClock();
DuplexPlugin plugin = new LanTcpPlugin(executor, clock, callback, 0L);
DuplexPlugin plugin = new LanTcpPlugin(executor, clock, callback, 0, 0);
plugin.start();
// The plugin should have bound a socket and stored the port number
assertTrue(callback.propertiesLatch.await(5, SECONDS));
@@ -62,7 +62,7 @@ public class LanTcpPluginTest extends BriarTestCase {
Callback callback = new Callback();
Executor executor = Executors.newCachedThreadPool();
Clock clock = new SystemClock();
DuplexPlugin plugin = new LanTcpPlugin(executor, clock, callback, 0L);
DuplexPlugin plugin = new LanTcpPlugin(executor, clock, callback, 0, 0);
plugin.start();
// Listen on a local port
final ServerSocket ss = new ServerSocket();

View File

@@ -18,7 +18,7 @@ public class LanTcpServerTest extends DuplexServerTest {
callback = new ServerCallback(new TransportConfig(),
new TransportProperties(),
Collections.singletonMap(contactId, new TransportProperties()));
plugin = new LanTcpPlugin(executor, new SystemClock(), callback, 0L);
plugin = new LanTcpPlugin(executor, new SystemClock(), callback, 0, 0);
}
public static void main(String[] args) throws Exception {

View File

@@ -31,7 +31,7 @@ public class TorPluginTest extends BriarTestCase {
try {
// Create a plugin instance for the server
Callback serverCallback = new Callback();
serverPlugin = new TorPlugin(e, serverCallback, 0L);
serverPlugin = new TorPlugin(e, serverCallback, 0, 0);
System.out.println("Starting server plugin");
serverPlugin.start();
// The plugin should create a hidden service... eventually
@@ -46,7 +46,7 @@ public class TorPluginTest extends BriarTestCase {
TransportProperties p = new TransportProperties();
p.put("onion", onion);
clientCallback.remote.put(contactId, p);
clientPlugin = new TorPlugin(e, clientCallback, 0L);
clientPlugin = new TorPlugin(e, clientCallback, 0, 0);
System.out.println("Starting client plugin");
clientPlugin.start();
// The plugin should start without creating a hidden service
@@ -87,7 +87,7 @@ public class TorPluginTest extends BriarTestCase {
try {
// Start a plugin instance with no private key
Callback callback = new Callback();
plugin = new TorPlugin(e, callback, 0L);
plugin = new TorPlugin(e, callback, 0, 0);
System.out.println("Starting plugin without private key");
plugin.start();
// The plugin should create a hidden service... eventually
@@ -106,7 +106,7 @@ public class TorPluginTest extends BriarTestCase {
// Start another instance, reusing the private key
callback = new Callback();
callback.config.put("privateKey", privateKey);
plugin = new TorPlugin(e, callback, 0L);
plugin = new TorPlugin(e, callback, 0, 0);
System.out.println("Starting plugin with private key");
plugin.start();
// The plugin should create a hidden service... eventually