test
Class SimpleServer

java.lang.Object
  extended by java.lang.Thread
      extended by test.SimpleServer
All Implemented Interfaces:
java.lang.Runnable

public class SimpleServer
extends java.lang.Thread

SimpleServer binds to TCP port 2000, reads a line of text, and then echoes it back to the user. To demonstrate a network timeout, every second connection will stall for twenty seconds. Start server by typing


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
SimpleServer(java.net.Socket connection)
          Constructor, accepting a socket connection
 
Method Summary
static void main(java.lang.String[] args)
          Starts a simple server on port 2000
 void run()
          Performs connection handling
 
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, toString, yield
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SimpleServer

public SimpleServer(java.net.Socket connection)
Constructor, accepting a socket connection

Parameters:
connection - Connection to process
Method Detail

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
Starts a simple server on port 2000

Throws:
java.lang.Exception

run

public void run()
Performs connection handling

Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread