moving report handling related classes to own package + other minor changes.
[phpeclipse.git] / net.sourceforge.phpeclipse.phpunit / src / net / sourceforge / phpeclipse / phpunit / reporthandling / ConnectionListener.java
1 /*************************************************************************
2  * @author Ali Echihabi (ali_echihabi@ieee.org, ali.echihabi@souss.ca)
3  *
4  * Plugin for PHP unit Testing.
5  * www.phpeclipse.de
6  * 
7  *************************************************************************/
8
9
10
11 package net.sourceforge.phpeclipse.phpunit.reporthandling;
12
13 import java.net.ServerSocket;
14 import java.net.Socket;
15
16 import net.sourceforge.phpeclipse.phpunit.PHPUnitView;
17
18  
19 public class ConnectionListener extends Thread {
20
21         private ServerSocket sSocket = null;
22         private Socket serviceSocket = null;
23         private PHPUnitView view;
24         
25         
26         public void start(PHPUnitView view) {
27                 
28                 this.view = view;
29                 super.start();
30         }
31         
32         public void run() {
33
34                 try {
35
36                         //reportArea.append("listening at port 12345");
37
38                         sSocket = new ServerSocket(12345);
39
40                         // accept connection from test reporter.
41                         serviceSocket = sSocket.accept();
42
43                         (new ReportListener(serviceSocket, this.view)).start();
44
45                         sSocket.close();
46
47                 } catch (Exception e) {
48
49                         e.printStackTrace();
50
51                 }
52
53         } // end of run()
54
55         public static void main(String[] args) {
56                 
57                 (new ConnectionListener()).start(new PHPUnitView());
58         }
59
60 }