|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.lang.Thread
ctf.network.tcp.Connection
ctf.network.tcp.TestConnection
public class TestConnection
A connection that times out after 100 ms (the maximum allowable latency according to the CTF specification). In reality, we allow more delay, since we can't control things like processor and thread scheduling.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class java.lang.Thread |
---|
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler |
Field Summary |
---|
Fields inherited from class java.lang.Thread |
---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Constructor Summary | |
---|---|
TestConnection(java.net.Socket socket)
Construct a new (already-opened) connection |
|
TestConnection(java.lang.String host,
int port)
Construct a new connection to a server |
Method Summary | |
---|---|
java.lang.String |
getLine()
Receive a line (string terminated by newline) from the socket with the newline character removed. |
void |
sendLine(java.lang.String line)
Send a newline-terminated line across the socket |
Methods inherited from class ctf.network.tcp.Connection |
---|
close, connectedTo, finalize, run, send, setOwner, toString |
Methods inherited from class java.lang.Thread |
---|
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, yield |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public TestConnection(java.lang.String host, int port) throws java.io.IOException, UninitializedSocketException, java.net.UnknownHostException
host
- The IP host to connect toport
- The TCP port to connect to
java.io.IOException
- for general connection problems
UninitializedSocketException
- if socket doesn't initialize
java.net.UnknownHostException
- if the host is unknownpublic TestConnection(java.net.Socket socket) throws java.io.IOException, UninitializedSocketException
socket
- The socket to connect with
java.io.IOException
- on error getting an I/O stream from Socket
UninitializedSocketException
- if connection not establishedMethod Detail |
---|
public void sendLine(java.lang.String line) throws java.io.IOException, SocketClosedException, UninitializedSocketException
Connection
sendLine
in class Connection
java.io.IOException
SocketClosedException
UninitializedSocketException
public java.lang.String getLine() throws java.io.IOException, NetworkException
Connection
getLine
in class Connection
java.io.IOException
NetworkException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |