public abstract class AbstractNetIoTest
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static class |
AbstractNetIoTest.ServerMainThread
Implements a simple thread for accepting network connections.
|
static class |
AbstractNetIoTest.ServerWorkThread
Implements a thread which is started on an accepted connection.
|
| Modifier and Type | Field and Description |
|---|---|
private static int |
clientRead
Stores the number of bytes read by the client part.
|
private static int |
clientWrite
Stores the number of bytes written by the client part.
|
private static int |
NET_OVERHEAD_STRING
The overhead of a string over the data in/out streams (size).
|
private static int |
NET_SIZE_INT
The size of an int over the data in/out streams.
|
private static int |
port
Defines the port used for communication operations.
|
private static int |
serverRead
Stores the number of bytes read by the server part.
|
private static int |
serverWrite
Stores the number of bytes written by the server part.
|
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractNetIoTest()
Prevents this class from being instantiated from outside.
|
| Modifier and Type | Method and Description |
|---|---|
protected AbstractNetIoTest.ServerMainThread |
createServerThread()
Factory method for the server main thread.
|
protected void |
executeClient()
Starts the client part and prints out the results.
|
protected void |
executeServer()
Starts the server part.
|
protected static int |
getAllRead()
Returns the total number of bytes read by client and server.
|
protected static int |
getAllWrite()
Returns the total number of bytes written by client and server.
|
protected static int |
getClientRead()
Returns the total number of bytes read by the client part.
|
protected static int |
getClientWrite()
Returns the total number of bytes written by the client part.
|
protected static int |
getServerRead()
Returns the total number of bytes read by the server part.
|
protected static int |
getServerWrite()
Returns the total number of bytes written by the server part.
|
static void |
main(java.lang.String[] args,
AbstractNetIoTest functions)
The main method to be called from the main method of the test with the
appropriate server thread.
|
private static int port
private static final int NET_SIZE_INT
private static final int NET_OVERHEAD_STRING
private static int serverRead
private static int serverWrite
private static int clientRead
private static int clientWrite
protected AbstractNetIoTest()
protected void executeServer()
throws java.io.IOException
java.io.IOException - any kind of network I/O problem in the clientprotected void executeClient()
throws java.io.IOException
java.io.IOException - any kind of network I/O problem in the clientprotected static int getServerRead()
protected static int getServerWrite()
protected static int getClientRead()
protected static int getClientWrite()
protected static int getAllRead()
protected static int getAllWrite()
protected AbstractNetIoTest.ServerMainThread createServerThread()
public static void main(java.lang.String[] args,
AbstractNetIoTest functions)
throws java.io.IOException
args - the command line argumentsfunctions - an instance of this class to be executedjava.io.IOException - thrown in case of read/write problems