From e7b404b7b31c6a6f672d86288cc9681af8d8b557 Mon Sep 17 00:00:00 2001
From: akwizgran <akwizgran@users.sourceforge.net>
Date: Thu, 6 Oct 2011 12:15:55 +0100
Subject: [PATCH] Check that the socket is passed to the callback.

---
 test/net/sf/briar/plugins/socket/SimpleSocketPluginTest.java | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/test/net/sf/briar/plugins/socket/SimpleSocketPluginTest.java b/test/net/sf/briar/plugins/socket/SimpleSocketPluginTest.java
index 33182d0d3d..6741f84011 100644
--- a/test/net/sf/briar/plugins/socket/SimpleSocketPluginTest.java
+++ b/test/net/sf/briar/plugins/socket/SimpleSocketPluginTest.java
@@ -52,7 +52,10 @@ public class SimpleSocketPluginTest extends TestCase {
 		// The plugin should be listening on the port
 		InetSocketAddress addr = new InetSocketAddress(host, port);
 		Socket s = new Socket();
+		assertEquals(0, callback.incomingConnections);
 		s.connect(addr, 100);
+		Thread.sleep(100);
+		assertEquals(1, callback.incomingConnections);
 		s.close();
 		// Stop the plugin
 		plugin.stop();
@@ -73,6 +76,7 @@ public class SimpleSocketPluginTest extends TestCase {
 	private static class StubCallback implements StreamTransportCallback {
 
 		private Map<String, String> localProperties = null;
+		private volatile int incomingConnections = 0;
 
 		public void setLocalProperties(Map<String, String> properties) {
 			localProperties = properties;
@@ -93,6 +97,7 @@ public class SimpleSocketPluginTest extends TestCase {
 		}
 
 		public void incomingConnectionCreated(StreamTransportConnection c) {
+			incomingConnections++;
 		}
 
 		public void outgoingConnectionCreated(ContactId contactId,
-- 
GitLab