mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-13 11:19:04 +01:00
Bluetooth-only invitations: simpler and more reliable.
Of course, not all devices support Bluetooth...
This commit is contained in:
@@ -9,9 +9,7 @@ import java.util.concurrent.Executors;
|
||||
import org.briarproject.api.ContactId;
|
||||
import org.briarproject.api.TransportConfig;
|
||||
import org.briarproject.api.TransportProperties;
|
||||
import org.briarproject.api.system.Clock;
|
||||
import org.briarproject.plugins.DuplexClientTest;
|
||||
import org.briarproject.system.SystemClock;
|
||||
|
||||
// This is not a JUnit test - it has to be run manually while the server test
|
||||
// is running on another machine
|
||||
@@ -21,15 +19,14 @@ public class LanTcpClientTest extends DuplexClientTest {
|
||||
String serverPort) {
|
||||
// Store the server's internal address and port
|
||||
TransportProperties p = new TransportProperties();
|
||||
p.put("internal", serverAddress);
|
||||
p.put("address", serverAddress);
|
||||
p.put("port", serverPort);
|
||||
Map<ContactId, TransportProperties> remote =
|
||||
Collections.singletonMap(contactId, p);
|
||||
// Create the plugin
|
||||
callback = new ClientCallback(new TransportConfig(),
|
||||
new TransportProperties(), remote);
|
||||
Clock clock = new SystemClock();
|
||||
plugin = new LanTcpPlugin(executor, clock, callback, 0, 0, 0);
|
||||
plugin = new LanTcpPlugin(executor, callback, 0, 0, 0);
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
|
||||
@@ -20,9 +20,6 @@ import org.briarproject.api.TransportProperties;
|
||||
import org.briarproject.api.plugins.duplex.DuplexPlugin;
|
||||
import org.briarproject.api.plugins.duplex.DuplexPluginCallback;
|
||||
import org.briarproject.api.plugins.duplex.DuplexTransportConnection;
|
||||
import org.briarproject.api.system.Clock;
|
||||
import org.briarproject.system.SystemClock;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
public class LanTcpPluginTest extends BriarTestCase {
|
||||
@@ -35,9 +32,7 @@ public class LanTcpPluginTest extends BriarTestCase {
|
||||
callback.local.put("address", "127.0.0.1");
|
||||
callback.local.put("port", "0");
|
||||
Executor executor = Executors.newCachedThreadPool();
|
||||
Clock clock = new SystemClock();
|
||||
DuplexPlugin plugin =
|
||||
new LanTcpPlugin(executor, clock, callback, 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));
|
||||
@@ -62,9 +57,7 @@ public class LanTcpPluginTest extends BriarTestCase {
|
||||
public void testOutgoingConnection() throws Exception {
|
||||
Callback callback = new Callback();
|
||||
Executor executor = Executors.newCachedThreadPool();
|
||||
Clock clock = new SystemClock();
|
||||
DuplexPlugin plugin =
|
||||
new LanTcpPlugin(executor, clock, callback, 0, 0, 0);
|
||||
DuplexPlugin plugin = new LanTcpPlugin(executor, callback, 0, 0, 0);
|
||||
plugin.start();
|
||||
// Listen on a local port
|
||||
final ServerSocket ss = new ServerSocket();
|
||||
|
||||
@@ -7,9 +7,7 @@ import java.util.concurrent.Executors;
|
||||
|
||||
import org.briarproject.api.TransportConfig;
|
||||
import org.briarproject.api.TransportProperties;
|
||||
import org.briarproject.api.system.Clock;
|
||||
import org.briarproject.plugins.DuplexServerTest;
|
||||
import org.briarproject.system.SystemClock;
|
||||
|
||||
// This is not a JUnit test - it has to be run manually while the client test
|
||||
// is running on another machine
|
||||
@@ -19,8 +17,7 @@ public class LanTcpServerTest extends DuplexServerTest {
|
||||
callback = new ServerCallback(new TransportConfig(),
|
||||
new TransportProperties(),
|
||||
Collections.singletonMap(contactId, new TransportProperties()));
|
||||
Clock clock = new SystemClock();
|
||||
plugin = new LanTcpPlugin(executor, clock, callback, 0, 0, 0);
|
||||
plugin = new LanTcpPlugin(executor, callback, 0, 0, 0);
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user