put connection Listener and report listener as seperate threads.
[phpeclipse.git] / net.sourceforge.phpeclipse.phpunit / src / net / sourceforge / phpeclipse / phpunit / ConnectionListener.java
diff --git a/net.sourceforge.phpeclipse.phpunit/src/net/sourceforge/phpeclipse/phpunit/ConnectionListener.java b/net.sourceforge.phpeclipse.phpunit/src/net/sourceforge/phpeclipse/phpunit/ConnectionListener.java
new file mode 100644 (file)
index 0000000..e947753
--- /dev/null
@@ -0,0 +1,51 @@
+/*
+ * Created on Jul 24, 2004
+ *
+ * To change the template for this generated file go to
+ * Window>Preferences>Java>Code Generation>Code and Comments
+ */
+package net.sourceforge.phpeclipse.phpunit;
+
+import java.net.ServerSocket;
+import java.net.Socket;
+
+/**
+ * @author Ali Echihabi
+ *
+ * To change the template for this generated type comment go to
+ * Window>Preferences>Java>Code Generation>Code and Comments
+ */
+public class ConnectionListener extends Thread {
+
+       private ServerSocket sSocket = null;
+       private Socket serviceSocket = null;
+       
+       public void run() {
+
+               try {
+
+                       //reportArea.append("listening at port 12345");
+
+                       sSocket = new ServerSocket(12345);
+
+                       // accept connection from test reporter.
+                       serviceSocket = sSocket.accept();
+
+                       (new ReportListener(serviceSocket)).start();
+
+                       sSocket.close();
+
+               } catch (Exception e) {
+
+                       e.printStackTrace();
+
+               }
+
+       } // end of run()
+
+       public static void main(String[] args) {
+               
+               (new ConnectionListener()).start();
+       }
+
+}