mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-12 18:59:06 +01:00
Unidirectional transports and connections are now called simplex rather than batch. Bidirectional transports and connections are now called duplex rather than stream.
44 lines
1.4 KiB
Java
44 lines
1.4 KiB
Java
package net.sf.briar.plugins.bluetooth;
|
|
|
|
import java.util.Collections;
|
|
import java.util.Map;
|
|
import java.util.concurrent.Executor;
|
|
import java.util.concurrent.ExecutorService;
|
|
import java.util.concurrent.Executors;
|
|
|
|
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 BluetoothClientTest extends DuplexClientTest {
|
|
|
|
private BluetoothClientTest(Executor executor, String serverAddress) {
|
|
// Store the server's Bluetooth address and UUID
|
|
TransportProperties p = new TransportProperties();
|
|
p.put("address", serverAddress);
|
|
p.put("uuid", BluetoothTest.UUID);
|
|
Map<ContactId, TransportProperties> remote =
|
|
Collections.singletonMap(contactId, p);
|
|
// Create the plugin
|
|
callback = new ClientCallback(new TransportConfig(),
|
|
new TransportProperties(), remote);
|
|
plugin = new BluetoothPlugin(executor, callback, 0L);
|
|
}
|
|
|
|
public static void main(String[] args) throws Exception {
|
|
if(args.length != 1) {
|
|
System.err.println("Please specify the server's Bluetooth address");
|
|
System.exit(1);
|
|
}
|
|
ExecutorService executor = Executors.newCachedThreadPool();
|
|
try {
|
|
new BluetoothClientTest(executor, args[0]).run();
|
|
} finally {
|
|
executor.shutdown();
|
|
}
|
|
}
|
|
}
|