keepalive.socket.sim
Class SimServerSocket
java.lang.Object
|
+--keepalive.socket.sim.SimServerSocket
- All Implemented Interfaces:
- ServerSocketIfc
- public class SimServerSocket
- extends java.lang.Object
- implements ServerSocketIfc
A simulated ServerSocket.
Constructor Summary |
SimServerSocket(int port)
Create a new ServerSocket to listen on the given port |
Method Summary |
AbstractSocket |
accept()
Accept a new connection and spin off a new socket |
void |
close()
Close this SimServerSocket. |
int |
getPort()
Get the port to which this ServerSocket is bound. |
static java.util.Iterator |
getServerSocketIterator()
Get Iterator all SimServerSockets in this simulated
networking system (on "server" and "client" hosts). |
boolean |
isPluggedIn()
|
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
SimServerSocket
public SimServerSocket(int port)
throws java.io.IOException
- Create a new ServerSocket to listen on the given port
- Parameters:
port
- - Throws:
java.io.IOException
- if an I/O error occurs (for example, if the
simulated port is already bound.)
getPort
public int getPort()
- Get the port to which this ServerSocket is bound.
getServerSocketIterator
public static java.util.Iterator getServerSocketIterator()
- Get Iterator all SimServerSockets in this simulated
networking system (on "server" and "client" hosts).
- Returns:
- an Iterator of all SimServerSockets in this
simulated networking system (on "server" and "client" hosts).
accept
public AbstractSocket accept()
throws java.io.IOException
- Accept a new connection and spin off a new socket
- Specified by:
accept
in interface ServerSocketIfc
- Returns:
- the spun-off socket.
- Throws:
java.io.IOException
- if there is an I/O error.
close
public void close()
throws java.io.IOException
- Close this SimServerSocket.
- Specified by:
close
in interface ServerSocketIfc
- Throws:
java.io.IOException
-
isPluggedIn
public boolean isPluggedIn()
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object