summaryrefslogtreecommitdiff
path: root/same/src/test/java
diff options
context:
space:
mode:
Diffstat (limited to 'same/src/test/java')
-rw-r--r--same/src/test/java/com/orbekk/net/BroadcastListenerTest.java32
1 files changed, 32 insertions, 0 deletions
diff --git a/same/src/test/java/com/orbekk/net/BroadcastListenerTest.java b/same/src/test/java/com/orbekk/net/BroadcastListenerTest.java
new file mode 100644
index 0000000..67d4ece
--- /dev/null
+++ b/same/src/test/java/com/orbekk/net/BroadcastListenerTest.java
@@ -0,0 +1,32 @@
+package com.orbekk.net;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class BroadcastListenerTest {
+ private Logger logger = LoggerFactory.getLogger(getClass());
+
+ @Test
+ public void interruptWorks() throws Exception {
+ final BroadcastListener listener = new BroadcastListener(0);
+
+ Thread t = new Thread() {
+ @Override public void run() {
+ listener.listen();
+ }
+ };
+ t.start();
+
+ while (listener.socket == null) {
+ logger.info("Waiting for listener to start.");
+ Thread.sleep(100);
+ }
+
+ listener.interrupt();
+ t.join();
+ }
+
+}