| java.lang.Object test.TestService
All known Subclasses: test.TestClient,
TestService | public class TestService implements Runnable(Code) | | Server to used perform tests for SOCKS library.
|
Constructor Summary | |
public | TestService(Socket s, int service) Creates new TestService object, which will perform particular
service on given socket. | public | TestService() Default constructor. |
Method Summary | |
public static void | chargen(Socket s, long wait_time, long max_wait) Generates characters and sends them to the socket.
Unlike usual chargen (port 19), each next line of the generated
output is send after increasingly larger time intervals. | public static void | connect(Socket s) Models connect back situation.
Reads a line from the socket connection, line should be in the
form port service_id. | public static void | discard(Socket s) Reads input from the socket, and does not write anything back. | public static void | echo(Socket s) Echos any input on the socket to the output. | public static int | getServiceId(String serviceName) Maps service name to the integer id, does it in simple
linear search manner.
Parameters: serviceName - Name of the service whose id one needs. | static synchronized void | log(String s) Performs logging. | public static void | pipe(InputStream in, OutputStream out) Pipes data from the input stream to the output. | public void | run() | public static boolean | serve(Socket s, int service) Performs given service on given socket.
Simply looks up and calls associated method.
Parameters: s - Socket on which to perform service. Parameters: service - Id of the service to perform. |
BUF_SIZE | final static int BUF_SIZE(Code) | | |
CHARGEN | final static int CHARGEN(Code) | | |
CHARGEN_WAIT | final static int CHARGEN_WAIT(Code) | | |
CONNECT | final static int CONNECT(Code) | | |
DISCARD | final static int DISCARD(Code) | | |
ECHO | final static int ECHO(Code) | | |
MAX_WAIT | final static int MAX_WAIT(Code) | | |
servicePorts | final static int servicePorts(Code) | | |
TestService | public TestService(Socket s, int service)(Code) | | Creates new TestService object, which will perform particular
service on given socket.
Parameters: s - Socket on which to perform service. Parameters: service - Service which to provide. |
TestService | public TestService()(Code) | | Default constructor.
|
chargen | public static void chargen(Socket s, long wait_time, long max_wait) throws IOException(Code) | | Generates characters and sends them to the socket.
Unlike usual chargen (port 19), each next line of the generated
output is send after increasingly larger time intervals. It starts
from wait_time (ms), and each next time wait time is doubled.
Eg. 1 2 4 8 16 32 64 128 256 512 1024 2048 4096 8192 ... well
you got the idea.
It starts if either connection is clsoed or the wait time grows
bigger than max_wait.
Parameters: s - Socket on which to perform service. Parameters: wait_time - Time in ms, from which timing sequence should begin. Parameters: max_wait - Time in ms, after reaching timeout greater than thisvalue, chargen will stop. |
connect | public static void connect(Socket s) throws IOException(Code) | | Models connect back situation.
Reads a line from the socket connection, line should be in the
form port service_id. Connects back to the remote host to port
specified in the line, if successful performs a service speciefied
by id on that new connection. If accept was successful closes the
control connection, else outputs error message, and then closes
the connection.
Parameters: s - Control connection. |
discard | public static void discard(Socket s) throws IOException(Code) | | Reads input from the socket, and does not write anything back.
logs input in line by line fashion.
Parameters: s - Socket on which to perform service. |
echo | public static void echo(Socket s) throws IOException(Code) | | Echos any input on the socket to the output.
Echo is being done line by line.
Parameters: s - Socket on which to perform service. |
getServiceId | public static int getServiceId(String serviceName)(Code) | | Maps service name to the integer id, does it in simple
linear search manner.
Parameters: serviceName - Name of the service whose id one needs. Integer identifier for this servuce, or -1, if servicecan't be found. |
log | static synchronized void log(String s)(Code) | | Performs logging.
|
serve | public static boolean serve(Socket s, int service) throws IOException(Code) | | Performs given service on given socket.
Simply looks up and calls associated method.
Parameters: s - Socket on which to perform service. Parameters: service - Id of the service to perform. true if service have been found, false otherwise. |
|
|