public class SimpleServer extends SimpleConversationEndPoint
SimpleServer class.
| Modifier and Type | Class and Description |
|---|---|
static class |
SimpleServer.ServerErrorExchange |
SimpleConversationEndPoint.SimpleExchange| Modifier and Type | Field and Description |
|---|---|
protected boolean |
m_stopped |
m_conversation| Constructor and Description |
|---|
SimpleServer() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
addErrorHandler(RequestHandler requestHandler)
addErrorHandler
|
protected boolean |
attemptConversation(BufferedReader in,
OutputStream out)
attemptConversation
|
void |
dispose()
dispose
|
protected RequestHandler |
errorString(String error)
errorString
|
String |
getBanner()
getBanner
|
InetAddress |
getInetAddress()
getInetAddress
|
int |
getLocalPort()
getLocalPort
|
protected SimpleServerRunnable |
getRunnable()
getRunnable
|
ServerSocket |
getServerSocket()
getServerSocket
|
protected Thread |
getServerThread()
getServerThread
|
Socket |
getSocket()
getSocket
|
int |
getThreadSleepLength()
getThreadSleepLength
|
void |
init()
init
|
protected void |
onInit()
onInit
|
protected void |
sendBanner(OutputStream out)
sendBanner
|
void |
setBanner(String banner)
setBanner
|
void |
setBannerDelay(int delay)
Slow down transmission of the banner by a specified number of milliseconds.
|
void |
setServerSocket(ServerSocket serverSocket)
setServerSocket
|
protected void |
setServerThread(Thread serverThread)
setServerThread
|
void |
setSocket(Socket socket)
setSocket
|
void |
setThreadSleepLength(int timeout)
setThreadSleepLength
|
protected RequestHandler |
shutdownServer(String response)
shutdownServer
|
void |
startServer()
startServer
|
void |
stopServer()
stopServer
|
addResponseHandler, contains, getTimeout, matches, multilineLineRequest, setTimeout, singleLineRequest, startsWithpublic void setBannerDelay(int delay)
public InetAddress getInetAddress()
getInetAddress
public int getLocalPort()
getLocalPort
public void setThreadSleepLength(int timeout)
setThreadSleepLength
timeout - a int.public int getThreadSleepLength()
getThreadSleepLength
public void init()
throws Exception
init
init in class SimpleConversationEndPointException - if any.protected void onInit()
onInit
public void startServer()
throws IOException
startServer
Exception - if any.IOExceptionpublic void stopServer()
throws IOException
stopServer
IOException - if any.public void dispose()
dispose
protected SimpleServerRunnable getRunnable() throws IOException
getRunnable
Runnable object.Exception - if any.IOExceptionprotected void sendBanner(OutputStream out) throws IOException
sendBanner
out - a OutputStream object.IOException - if any.protected boolean attemptConversation(BufferedReader in, OutputStream out) throws Exception
attemptConversation
in - a BufferedReader object.out - a OutputStream object.Exception - if any.protected void addErrorHandler(RequestHandler requestHandler)
addErrorHandler
requestHandler - a RequestHandler object.protected RequestHandler errorString(String error)
errorString
error - a String object.RequestHandler object.protected RequestHandler shutdownServer(String response)
shutdownServer
response - a String object.RequestHandler object.public void setServerSocket(ServerSocket serverSocket)
setServerSocket
serverSocket - a ServerSocket object.public ServerSocket getServerSocket()
getServerSocket
ServerSocket object.protected void setServerThread(Thread serverThread)
setServerThread
serverThread - a Thread object.Copyright © 2022. All rights reserved.