toolbox.socket
Class SocketProtocolHandlerNewLineImpl

Package class diagram package SocketProtocolHandlerNewLineImpl
java.lang.Object
  extended by toolbox.socket.SocketProtocolHandlerNewLineImpl
All Implemented Interfaces:
SocketProtocolHandler

public class SocketProtocolHandlerNewLineImpl
extends java.lang.Object
implements SocketProtocolHandler

A simple SocketProtocolHandler implementation to write and read single lines to and from the underlying socket.


Constructor Summary
SocketProtocolHandlerNewLineImpl()
          Default constructor.
 
Method Summary
 void publish(java.net.Socket socket, java.lang.String payload)
          This method facilitates 1-way fire and forget client socket communication.
 java.lang.String request(java.net.Socket socket, java.lang.String payload)
          This method facilitates 2-way synchronous client socket communication.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SocketProtocolHandlerNewLineImpl

public SocketProtocolHandlerNewLineImpl()
Default constructor.

Method Detail

request

public java.lang.String request(java.net.Socket socket,
                                java.lang.String payload)
                         throws SocketClientException
This method facilitates 2-way synchronous client socket communication.

Specified by:
request in interface SocketProtocolHandler
Parameters:
socket - The client socket connection.
payload - Sring containing the request data.
Returns:
String containing the response data.
Throws:
SocketClientException - when an error occurs during socket communication.

publish

public void publish(java.net.Socket socket,
                    java.lang.String payload)
             throws SocketClientException
This method facilitates 1-way fire and forget client socket communication.

Specified by:
publish in interface SocketProtocolHandler
Parameters:
socket - The client socket connection.
payload - String containing the data that must be plublished.
Throws:
SocketClientException - when an error occurs during socket communication.