30a711d38b29e19c118df226999805480cecb903
[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         private PHPUnitView view;
23         
24         
25         public void start(PHPUnitView view) {
26                 
27                 this.view = view;
28                 super.start();
29         }
30         
31         public void run() {
32
33                 try {
34
35                         //reportArea.append("listening at port 12345");
36
37                         sSocket = new ServerSocket(12345);
38
39                         // accept connection from test reporter.
40                         serviceSocket = sSocket.accept();
41
42                         (new ReportListener(serviceSocket, this.view)).start();
43
44                         sSocket.close();
45
46                 } catch (Exception e) {
47
48                         e.printStackTrace();
49
50                 }
51
52         } // end of run()
53
54         public static void main(String[] args) {
55                 
56                 (new ConnectionListener()).start(new PHPUnitView());
57         }
58
59 }