mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-18 13:49:53 +01:00
Check that the socket is passed to the callback.
This commit is contained in:
@@ -52,7 +52,10 @@ public class SimpleSocketPluginTest extends TestCase {
|
|||||||
// The plugin should be listening on the port
|
// The plugin should be listening on the port
|
||||||
InetSocketAddress addr = new InetSocketAddress(host, port);
|
InetSocketAddress addr = new InetSocketAddress(host, port);
|
||||||
Socket s = new Socket();
|
Socket s = new Socket();
|
||||||
|
assertEquals(0, callback.incomingConnections);
|
||||||
s.connect(addr, 100);
|
s.connect(addr, 100);
|
||||||
|
Thread.sleep(100);
|
||||||
|
assertEquals(1, callback.incomingConnections);
|
||||||
s.close();
|
s.close();
|
||||||
// Stop the plugin
|
// Stop the plugin
|
||||||
plugin.stop();
|
plugin.stop();
|
||||||
@@ -73,6 +76,7 @@ public class SimpleSocketPluginTest extends TestCase {
|
|||||||
private static class StubCallback implements StreamTransportCallback {
|
private static class StubCallback implements StreamTransportCallback {
|
||||||
|
|
||||||
private Map<String, String> localProperties = null;
|
private Map<String, String> localProperties = null;
|
||||||
|
private volatile int incomingConnections = 0;
|
||||||
|
|
||||||
public void setLocalProperties(Map<String, String> properties) {
|
public void setLocalProperties(Map<String, String> properties) {
|
||||||
localProperties = properties;
|
localProperties = properties;
|
||||||
@@ -93,6 +97,7 @@ public class SimpleSocketPluginTest extends TestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void incomingConnectionCreated(StreamTransportConnection c) {
|
public void incomingConnectionCreated(StreamTransportConnection c) {
|
||||||
|
incomingConnections++;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void outgoingConnectionCreated(ContactId contactId,
|
public void outgoingConnectionCreated(ContactId contactId,
|
||||||
|
|||||||
Reference in New Issue
Block a user