put connection Listener and report listener as seperate threads.
[phpeclipse.git] / net.sourceforge.phpeclipse.phpunit / src / net / sourceforge / phpeclipse / phpunit / ConnectionListener.java
1 /*
2  * Created on Jul 24, 2004
3  *
4  * To change the template for this generated file go to
5  * Window>Preferences>Java>Code Generation>Code and Comments
6  */
7 package net.sourceforge.phpeclipse.phpunit;
8
9 import java.net.ServerSocket;
10 import java.net.Socket;
11
12 /**
13  * @author Ali Echihabi
14  *
15  * To change the template for this generated type comment go to
16  * Window>Preferences>Java>Code Generation>Code and Comments
17  */
18 public class ConnectionListener extends Thread {
19
20         private ServerSocket sSocket = null;
21         private Socket serviceSocket = null;
22         
23         public void run() {
24
25                 try {
26
27                         //reportArea.append("listening at port 12345");
28
29                         sSocket = new ServerSocket(12345);
30
31                         // accept connection from test reporter.
32                         serviceSocket = sSocket.accept();
33
34                         (new ReportListener(serviceSocket)).start();
35
36                         sSocket.close();
37
38                 } catch (Exception e) {
39
40                         e.printStackTrace();
41
42                 }
43
44         } // end of run()
45
46         public static void main(String[] args) {
47                 
48                 (new ConnectionListener()).start();
49         }
50
51 }