net.officefloor.plugin.socket.server.ssl.protocol
Class SslConnectionImpl

java.lang.Object
  extended by net.officefloor.plugin.socket.server.ssl.protocol.SslConnectionImpl
All Implemented Interfaces:
Connection, SslConnection

public class SslConnectionImpl
extends Object
implements SslConnection

SslConnection implementation.

Author:
Daniel Sagenschneider

Constructor Summary
SslConnectionImpl(Object lock, InetSocketAddress localAddress, InetSocketAddress remoteAddress, InputBufferStream inputDelegate, OutputBufferStream outputDelegate, SSLEngine engine, BufferSquirtFactory bufferSquirtFactory, TemporaryByteArrayFactory byteArrayFactory, SslTaskExecutor taskExecutor)
          Initiate.
 
Method Summary
 InputBufferStream getInputBufferStream()
          Obtains the InputBufferStream to obtain data from the client.
 InetSocketAddress getLocalAddress()
          Obtains the local address for the Connection.
 Object getLock()
          Obtains the lock to synchronize for using this Connection.
 OutputBufferStream getOutputBufferStream()
          Obtains the OutputBufferStream to write data to the client.
 InetSocketAddress getRemoteAddress()
          Obtains the remote address for the Connection.
 boolean isSecure()
          Indicates if the connection is over a secure channel (e.g.
 void processDataFromPeer()
           Should data be available from the peer this triggers processing it to make it available for input.
 void validate()
          Ensures the SslConnection is valid.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SslConnectionImpl

public SslConnectionImpl(Object lock,
                         InetSocketAddress localAddress,
                         InetSocketAddress remoteAddress,
                         InputBufferStream inputDelegate,
                         OutputBufferStream outputDelegate,
                         SSLEngine engine,
                         BufferSquirtFactory bufferSquirtFactory,
                         TemporaryByteArrayFactory byteArrayFactory,
                         SslTaskExecutor taskExecutor)
Initiate.

Parameters:
lock - Lock to coordinate access to this SslConnection.
localAddress - Local InetSocketAddress.
remoteAddress - Remote InetSocketAddress.
inputDelegate - Delegate InputBufferStream to read the cipher text from the peer.
outputDelegate - Delegate OutputBufferStream to write the cipher text to the peer.
engine - SSLEngine to wrap/unwrap between plain text and cipher text.
bufferSquirtFactory - BufferSquirtFactory for the BufferStream instances containing the application data.
byteArrayFactory - TemporaryByteArrayFactory to create necessary temporary byte array instances.
taskExecutor - SslTaskExecutor to execute any necessary SslTask instances.
Method Detail

processDataFromPeer

public void processDataFromPeer()
                         throws IOException
Description copied from interface: SslConnection

Should data be available from the peer this triggers processing it to make it available for input.

This is necessary as the SslConnection needs to be made aware when further data is available from the peer, so that it can either:

  1. further a handshake to completion, or
  2. transform the cipher text into plain text available for application input

Specified by:
processDataFromPeer in interface SslConnection
Throws:
IOException - If fails to process the data from peer.

validate

public void validate()
              throws IOException
Description copied from interface: SslConnection
Ensures the SslConnection is valid.

Specified by:
validate in interface SslConnection
Throws:
IOException - IOException of the cause of this SslConnection being invalid.

getLock

public Object getLock()
Description copied from interface: Connection
Obtains the lock to synchronize for using this Connection.

Specified by:
getLock in interface Connection
Returns:
Lock for this Connection.

getLocalAddress

public InetSocketAddress getLocalAddress()
Description copied from interface: Connection
Obtains the local address for the Connection.

Specified by:
getLocalAddress in interface Connection
Returns:
InetSocketAddress describing the local Socket for the Connection.

getRemoteAddress

public InetSocketAddress getRemoteAddress()
Description copied from interface: Connection
Obtains the remote address for the Connection.

Specified by:
getRemoteAddress in interface Connection
Returns:
InetSocketAddress describing the remote Socket for the Connection.

isSecure

public boolean isSecure()
Description copied from interface: Connection
Indicates if the connection is over a secure channel (e.g. utilising SSL).

Specified by:
isSecure in interface Connection
Returns:
true if connection is over a secure channel.

getInputBufferStream

public InputBufferStream getInputBufferStream()
Description copied from interface: Connection
Obtains the InputBufferStream to obtain data from the client.

Specified by:
getInputBufferStream in interface Connection
Returns:
InputBufferStream.

getOutputBufferStream

public OutputBufferStream getOutputBufferStream()
Description copied from interface: Connection
Obtains the OutputBufferStream to write data to the client.

Specified by:
getOutputBufferStream in interface Connection
Returns:
OutputBufferStream.


Copyright © 2005-2011. All Rights Reserved.