Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Static Public Member Functions | Protected Attributes | Static Package Attributes
TestServer Class Reference
Collaboration diagram for TestServer:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 TestServer ()
 TestServer (int port)
void run ()

Static Public Member Functions

static void fail (Exception e, String msg)
static void main (String args[])

Protected Attributes

int port
ServerSocket listen_socket

Static Package Attributes

static final int DEFAULT_PORT = 4321

Detailed Description

Definition at line 41 of file TestServer.java.


Constructor & Destructor Documentation

TestServer.TestServer ( ) [inline]

Definition at line 53 of file TestServer.java.

                           {
              this(DEFAULT_PORT);
       }

Here is the caller graph for this function:

TestServer.TestServer ( int  port) [inline]

Definition at line 57 of file TestServer.java.

                                   {
              this.port = port;
              try {
                     listen_socket = new ServerSocket(port);
              }
              catch (IOException e) {
                     fail(e, "Exception creating server socket");
              }
              System.out.println("Server: listening on port " + port);
              this.start();
       }

Here is the call graph for this function:


Member Function Documentation

static void TestServer.fail ( Exception  e,
String  msg 
) [inline, static]

Definition at line 48 of file TestServer.java.

                                                        {
              System.err.println(msg + ":" + e);
              e.printStackTrace();
       }

Here is the caller graph for this function:

static void TestServer.main ( String  args[]) [inline, static]

Definition at line 81 of file TestServer.java.

                                              {
              int port = DEFAULT_PORT;
              if (args.length == 1) {
                     try {
                            port = Integer.parseInt(args[0]);
                     }
                     catch (NumberFormatException e) {
                            port = DEFAULT_PORT;
                     }
              }
              new TestServer(port);
       }

Here is the call graph for this function:

void TestServer.run ( ) [inline]

Definition at line 69 of file TestServer.java.

                         {
              try {
                     while (true) {
                            Socket client_socket = listen_socket.accept();
                            new Connection(client_socket);
                     }
              }
              catch (IOException e) {
                     fail(e, "Exception while listening");
              }
       }

Here is the call graph for this function:


Member Data Documentation

final int TestServer.DEFAULT_PORT = 4321 [static, package]

Definition at line 43 of file TestServer.java.

ServerSocket TestServer.listen_socket [protected]

Definition at line 46 of file TestServer.java.

int TestServer.port [protected]

Definition at line 45 of file TestServer.java.


The documentation for this class was generated from the following file: