Use the same maximum frame length for all transports.

This commit is contained in:
akwizgran
2015-01-05 16:24:44 +00:00
parent 358166bc12
commit d3bf2d59a1
60 changed files with 194 additions and 321 deletions

View File

@@ -23,12 +23,12 @@ public class BluetoothClientTest extends DuplexClientTest {
p.put("address", serverAddress);
p.put("uuid", BluetoothTest.EMPTY_UUID);
Map<ContactId, TransportProperties> remote =
Collections.singletonMap(contactId, p);
Collections.singletonMap(contactId, p);
// Create the plugin
callback = new ClientCallback(new TransportConfig(),
new TransportProperties(), remote);
plugin = new BluetoothPlugin(executor, new SystemClock(),
new SecureRandom(), callback, 0, 0, 0);
new SecureRandom(), callback, 0, 0);
}
public static void main(String[] args) throws Exception {

View File

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

View File

@@ -1,6 +1,5 @@
package org.briarproject.plugins.file;
import static org.briarproject.api.transport.TransportConstants.MAX_FRAME_LENGTH;
import static org.briarproject.api.transport.TransportConstants.MIN_STREAM_LENGTH;
import java.io.File;
@@ -58,7 +57,7 @@ public class RemovableDrivePluginTest extends BriarTestCase {
}});
RemovableDrivePlugin plugin = new RemovableDrivePlugin(executor,
fileUtils, callback, finder, monitor, MAX_FRAME_LENGTH, 0);
fileUtils, callback, finder, monitor, 0);
plugin.start();
assertNull(plugin.createWriter(contactId));
@@ -93,7 +92,7 @@ public class RemovableDrivePluginTest extends BriarTestCase {
}});
RemovableDrivePlugin plugin = new RemovableDrivePlugin(executor,
fileUtils, callback, finder, monitor, MAX_FRAME_LENGTH, 0);
fileUtils, callback, finder, monitor, 0);
plugin.start();
assertNull(plugin.createWriter(contactId));
@@ -130,7 +129,7 @@ public class RemovableDrivePluginTest extends BriarTestCase {
}});
RemovableDrivePlugin plugin = new RemovableDrivePlugin(executor,
fileUtils, callback, finder, monitor, MAX_FRAME_LENGTH, 0);
fileUtils, callback, finder, monitor, 0);
plugin.start();
assertNull(plugin.createWriter(contactId));
@@ -169,7 +168,7 @@ public class RemovableDrivePluginTest extends BriarTestCase {
}});
RemovableDrivePlugin plugin = new RemovableDrivePlugin(executor,
fileUtils, callback, finder, monitor, MAX_FRAME_LENGTH, 0);
fileUtils, callback, finder, monitor, 0);
plugin.start();
assertNull(plugin.createWriter(contactId));
@@ -208,7 +207,7 @@ public class RemovableDrivePluginTest extends BriarTestCase {
}});
RemovableDrivePlugin plugin = new RemovableDrivePlugin(executor,
fileUtils, callback, finder, monitor, MAX_FRAME_LENGTH, 0);
fileUtils, callback, finder, monitor, 0);
plugin.start();
assertNotNull(plugin.createWriter(contactId));
@@ -251,7 +250,7 @@ public class RemovableDrivePluginTest extends BriarTestCase {
}});
RemovableDrivePlugin plugin = new RemovableDrivePlugin(executor,
fileUtils, callback, finder, monitor, MAX_FRAME_LENGTH, 0);
fileUtils, callback, finder, monitor, 0);
plugin.start();
TransportConnectionWriter writer = plugin.createWriter(contactId);
@@ -290,7 +289,7 @@ public class RemovableDrivePluginTest extends BriarTestCase {
}});
RemovableDrivePlugin plugin = new RemovableDrivePlugin(executor,
fileUtils, callback, finder, monitor, MAX_FRAME_LENGTH, 0);
fileUtils, callback, finder, monitor, 0);
plugin.start();
plugin.driveInserted(testDir);
@@ -310,7 +309,7 @@ public class RemovableDrivePluginTest extends BriarTestCase {
context.mock(RemovableDriveMonitor.class);
RemovableDrivePlugin plugin = new RemovableDrivePlugin(executor,
fileUtils, callback, finder, monitor, MAX_FRAME_LENGTH, 0);
fileUtils, callback, finder, monitor, 0);
assertFalse(plugin.isPossibleConnectionFilename("abcdefg.dat"));
assertFalse(plugin.isPossibleConnectionFilename("abcdefghi.dat"));
@@ -339,7 +338,7 @@ public class RemovableDrivePluginTest extends BriarTestCase {
RemovableDrivePlugin plugin = new RemovableDrivePlugin(
new ImmediateExecutor(), fileUtils, callback, finder, monitor,
MAX_FRAME_LENGTH, 0);
0);
plugin.start();
File f = new File(testDir, "abcdefgh.dat");

View File

@@ -24,7 +24,7 @@ public class ModemPluginTest extends BriarTestCase {
final SerialPortList serialPortList =
context.mock(SerialPortList.class);
final ModemPlugin plugin = new ModemPlugin(modemFactory,
serialPortList, null, 0, 0);
serialPortList, null, 0);
final Modem modem = context.mock(Modem.class);
context.checking(new Expectations() {{
oneOf(serialPortList).getPortNames();
@@ -58,7 +58,7 @@ public class ModemPluginTest extends BriarTestCase {
final DuplexPluginCallback callback =
context.mock(DuplexPluginCallback.class);
final ModemPlugin plugin = new ModemPlugin(modemFactory,
serialPortList, callback, 0, 0);
serialPortList, callback, 0);
final Modem modem = context.mock(Modem.class);
final TransportProperties local = new TransportProperties();
local.put("iso3166", ISO_1336);
@@ -99,7 +99,7 @@ public class ModemPluginTest extends BriarTestCase {
final DuplexPluginCallback callback =
context.mock(DuplexPluginCallback.class);
final ModemPlugin plugin = new ModemPlugin(modemFactory,
serialPortList, callback, 0, 0);
serialPortList, callback, 0);
final Modem modem = context.mock(Modem.class);
final TransportProperties local = new TransportProperties();
local.put("iso3166", ISO_1336);
@@ -140,7 +140,7 @@ public class ModemPluginTest extends BriarTestCase {
final DuplexPluginCallback callback =
context.mock(DuplexPluginCallback.class);
final ModemPlugin plugin = new ModemPlugin(modemFactory,
serialPortList, callback, 0, 0);
serialPortList, callback, 0);
final Modem modem = context.mock(Modem.class);
final TransportProperties local = new TransportProperties();
local.put("iso3166", ISO_1336);

View File

@@ -15,7 +15,6 @@ import org.briarproject.plugins.DuplexClientTest;
// is running on another machine
public class LanTcpClientTest extends DuplexClientTest {
private static final int MAX_FRAME_LENGTH = 1024;
private static final int MAX_LATENCY = 60 * 1000;
private static final int MAX_IDLE_TIME = 30 * 1000;
private static final int POLLING_INTERVAL = 60 * 1000;
@@ -31,8 +30,8 @@ public class LanTcpClientTest extends DuplexClientTest {
// Create the plugin
callback = new ClientCallback(new TransportConfig(),
new TransportProperties(), remote);
plugin = new LanTcpPlugin(executor, callback, MAX_FRAME_LENGTH,
MAX_LATENCY, MAX_IDLE_TIME, POLLING_INTERVAL);
plugin = new LanTcpPlugin(executor, callback, MAX_LATENCY,
MAX_IDLE_TIME, POLLING_INTERVAL);
}
public static void main(String[] args) throws Exception {

View File

@@ -32,7 +32,7 @@ public class LanTcpPluginTest extends BriarTestCase {
@Test
public void testAddressesAreOnSameLan() {
LanTcpPlugin plugin = new LanTcpPlugin(null, null, 0, 0, 0, 0);
LanTcpPlugin plugin = new LanTcpPlugin(null, null, 0, 0, 0);
// Local and remote in 10.0.0.0/8 should return true
assertTrue(plugin.addressesAreOnSameLan(makeAddress(10, 0, 0, 0),
makeAddress(10, 255, 255, 255)));
@@ -81,7 +81,7 @@ public class LanTcpPluginTest extends BriarTestCase {
}
Callback callback = new Callback();
Executor executor = Executors.newCachedThreadPool();
DuplexPlugin plugin = new LanTcpPlugin(executor, callback, 0, 0, 0, 0);
DuplexPlugin plugin = new LanTcpPlugin(executor, callback, 0, 0, 0);
plugin.start();
// The plugin should have bound a socket and stored the port number
assertTrue(callback.propertiesLatch.await(5, SECONDS));
@@ -113,7 +113,7 @@ public class LanTcpPluginTest extends BriarTestCase {
}
Callback callback = new Callback();
Executor executor = Executors.newCachedThreadPool();
DuplexPlugin plugin = new LanTcpPlugin(executor, callback, 0, 0, 0, 0);
DuplexPlugin plugin = new LanTcpPlugin(executor, callback, 0, 0, 0);
plugin.start();
// The plugin should have bound a socket and stored the port number
assertTrue(callback.propertiesLatch.await(5, SECONDS));

View File

@@ -13,7 +13,6 @@ import org.briarproject.plugins.DuplexServerTest;
// is running on another machine
public class LanTcpServerTest extends DuplexServerTest {
private static final int MAX_FRAME_LENGTH = 1024;
private static final int MAX_LATENCY = 60 * 1000;
private static final int MAX_IDLE_TIME = 30 * 1000;
private static final int POLLING_INTERVAL = 60 * 1000;
@@ -22,8 +21,8 @@ public class LanTcpServerTest extends DuplexServerTest {
callback = new ServerCallback(new TransportConfig(),
new TransportProperties(),
Collections.singletonMap(contactId, new TransportProperties()));
plugin = new LanTcpPlugin(executor, callback, MAX_FRAME_LENGTH,
MAX_LATENCY, MAX_IDLE_TIME, POLLING_INTERVAL);
plugin = new LanTcpPlugin(executor, callback, MAX_LATENCY,
MAX_IDLE_TIME, POLLING_INTERVAL);
}
public static void main(String[] args) throws Exception {