eneter.messaging.messagingsystems.tcpmessagingsystem
Class SslClientFactory

java.lang.Object
  extended by eneter.messaging.messagingsystems.tcpmessagingsystem.SslClientFactory
All Implemented Interfaces:
IClientSecurityFactory

public class SslClientFactory
extends java.lang.Object
implements IClientSecurityFactory

Creates SSL client socket.


Constructor Summary
SslClientFactory()
          Constructs the factory.
SslClientFactory(javax.net.ssl.SSLSocketFactory socketFactory)
          Constructs the factory.
 
Method Summary
 java.net.Socket createClientSocket(java.net.InetSocketAddress socketAddress)
          Creates SSLClientSocket
 int getConnectionTimeout()
          Returns open connection timeout.
 int getReceiveBufferSize()
          Returns the size of the receiving buffer in bytes.
 int getReceiveTimeout()
          Returns timeout setup for receiving a message.
 int getResponseReceiverPort()
          Gets the port which shall be used for receiving response messages in output channels.
 boolean getReuseAddress()
          Gets the flag indicating whether the socket can be bound to the address which is already in use.
 int getSendBufferSize()
          Returns the size of the sending buffer in bytes.
 int getSendTimeout()
          Returns timeout setup for sending a message.
 void setConnectionTimeout(int connectionTimeout)
          Sets open connection timeout in milliseconds.
 void setReceiveBufferSize(int size)
          Sets the size of receiving buffer in bytes.
 void setReceiveTimeout(int receiveTimeout)
          Sets timeout for receiving a message.
 void setResponseReceiverPort(int port)
          Sets or gets the port which shall be used for receiving response messages in output channels.
 void setReuseAddress(boolean allowReuseAddress)
          Sets the flag indicating whether the socket can be bound to the address which is already in use.
 void setSendBufferSize(int size)
          Sets the size of sending buffer in bytes.
 void setSendTimeout(int sendTimeout)
          Sets timeout for sending a message.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SslClientFactory

public SslClientFactory()
Constructs the factory. The factory will use the default socket factory returned from SSLSocketFactory.getDefault() The connection timeout is set to 30000 milliseconds. The sending timeout is set to infinite time. The receiving timeout is set to infinite time. The message sending buffer is set to 8192 bytes. The message receiving buffer is set to 8192 bytes.


SslClientFactory

public SslClientFactory(javax.net.ssl.SSLSocketFactory socketFactory)
Constructs the factory. The factory will internally use given SSLSocketFactory. The connection timeout is set to 30000 milliseconds. The sending timeout is set to infinite time. The receiving timeout is set to infinite time. The message sending buffer is set to 8192 bytes. The message receiving buffer is set to 8192 bytes.

Parameters:
socketFactory -
Method Detail

createClientSocket

public java.net.Socket createClientSocket(java.net.InetSocketAddress socketAddress)
                                   throws java.lang.Exception
Creates SSLClientSocket

Specified by:
createClientSocket in interface IClientSecurityFactory
Parameters:
socketAddress - address
Returns:
client socket
Throws:
java.lang.Exception

setConnectionTimeout

public void setConnectionTimeout(int connectionTimeout)
Description copied from interface: IClientSecurityFactory
Sets open connection timeout in milliseconds.

Specified by:
setConnectionTimeout in interface IClientSecurityFactory
Parameters:
connectionTimeout - timeout in milliseconds. 0 means infinite time (use 30000 by default)

getConnectionTimeout

public int getConnectionTimeout()
Description copied from interface: IClientSecurityFactory
Returns open connection timeout.

Specified by:
getConnectionTimeout in interface IClientSecurityFactory
Returns:
connection timeout in milliseconds.

setSendTimeout

public void setSendTimeout(int sendTimeout)
Description copied from interface: IClientSecurityFactory
Sets timeout for sending a message. 0 means infinite time (use 30000 by default)

Specified by:
setSendTimeout in interface IClientSecurityFactory

getSendTimeout

public int getSendTimeout()
Description copied from interface: IClientSecurityFactory
Returns timeout setup for sending a message.

Specified by:
getSendTimeout in interface IClientSecurityFactory
Returns:
sending timeout in milliseconds

setReceiveTimeout

public void setReceiveTimeout(int receiveTimeout)
Description copied from interface: IClientSecurityFactory
Sets timeout for receiving a message. 0 means infinite time (use 30000 by default)

Specified by:
setReceiveTimeout in interface IClientSecurityFactory

getReceiveTimeout

public int getReceiveTimeout()
Description copied from interface: IClientSecurityFactory
Returns timeout setup for receiving a message.

Specified by:
getReceiveTimeout in interface IClientSecurityFactory
Returns:
receiving timeout in milliseconds

setSendBufferSize

public void setSendBufferSize(int size)
Description copied from interface: IClientSecurityFactory
Sets the size of sending buffer in bytes.

Specified by:
setSendBufferSize in interface IClientSecurityFactory
Parameters:
size - size of the buffer in bytes. (use 8192 by default)

getSendBufferSize

public int getSendBufferSize()
Description copied from interface: IClientSecurityFactory
Returns the size of the sending buffer in bytes.

Specified by:
getSendBufferSize in interface IClientSecurityFactory
Returns:
size of the sending buffer

setReceiveBufferSize

public void setReceiveBufferSize(int size)
Description copied from interface: IClientSecurityFactory
Sets the size of receiving buffer in bytes.

Specified by:
setReceiveBufferSize in interface IClientSecurityFactory
Parameters:
size - size of the buffer in bytes. (use 8192 by default)

getReceiveBufferSize

public int getReceiveBufferSize()
Description copied from interface: IClientSecurityFactory
Returns the size of the receiving buffer in bytes.

Specified by:
getReceiveBufferSize in interface IClientSecurityFactory
Returns:
size of the receiving buffer

setReuseAddress

public void setReuseAddress(boolean allowReuseAddress)
Description copied from interface: IClientSecurityFactory
Sets the flag indicating whether the socket can be bound to the address which is already in use.

Specified by:
setReuseAddress in interface IClientSecurityFactory
Parameters:
allowReuseAddress - true if the socket can be bound to the address which is already in use.

getReuseAddress

public boolean getReuseAddress()
Description copied from interface: IClientSecurityFactory
Gets the flag indicating whether the socket can be bound to the address which is already in use.

Specified by:
getReuseAddress in interface IClientSecurityFactory
Returns:
true if the socket can be bound to the address which is already in use.

setResponseReceiverPort

public void setResponseReceiverPort(int port)
Description copied from interface: IClientSecurityFactory
Sets or gets the port which shall be used for receiving response messages in output channels. When a client connects an IP address and port a random free port is assigned for receiving messages. This property allows to use a specific port instead of random one.

Default value is -1 which means a random free port is chosen for receiving response messages.

Specified by:
setResponseReceiverPort in interface IClientSecurityFactory
Parameters:
port - port which shall be used for receiving response messages in the output channel.

getResponseReceiverPort

public int getResponseReceiverPort()
Description copied from interface: IClientSecurityFactory
Gets the port which shall be used for receiving response messages in output channels. If the value is -1 it means a random free port is chosen for receiving response messages.

Specified by:
getResponseReceiverPort in interface IClientSecurityFactory
Returns:
port which shall be used for receiving response messages in the output channel.