Package jade.imtp.leap.nio
Class SSLEngineHelper
- java.lang.Object
-
- jade.imtp.leap.nio.SSLEngineHelper
-
- All Implemented Interfaces:
BufferTransformer
public final class SSLEngineHelper extends Object implements BufferTransformer
helper class that holds the ByteBuffers, SSLEngine and other Objects that deal with the non static part of the ssl/nio handshaking/input/output. The contained SSLEngine is hidden to apps, because this helper takes on the responsibility of dealing with concurrency issues- Author:
- eduard
-
-
Field Summary
Fields Modifier and Type Field Description static ByteBufferEMPTY_BUFFER
-
Constructor Summary
Constructors Constructor Description SSLEngineHelper(String host, int port, NIOJICPConnection connection)Creates and initializes ByteBuffers and SSLEngine necessary for ssl/nio.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()closes the SSLEngine, tries to send a ssl close messagebooleanneedSocketData()ByteBufferpostprocessBufferRead(ByteBuffer socketData)implementers can transform data available read from the socket.ByteBufferpreprocessBufferToWrite(ByteBuffer dataToSend)implementers can transform the bytes before they are sent.StringtoString()
-
-
-
Field Detail
-
EMPTY_BUFFER
public static final ByteBuffer EMPTY_BUFFER
-
-
Constructor Detail
-
SSLEngineHelper
public SSLEngineHelper(String host, int port, NIOJICPConnection connection) throws ICPException
Creates and initializes ByteBuffers and SSLEngine necessary for ssl/nio.- Parameters:
host- provides a hint for optimizationport- provides a hint for optimizationconnection- the connection that will use this helper- Throws:
ICPException- See Also:
NIOHelper,SSLHelper
-
-
Method Detail
-
close
public void close() throws IOExceptioncloses the SSLEngine, tries to send a ssl close message- Throws:
IOException
-
preprocessBufferToWrite
public ByteBuffer preprocessBufferToWrite(ByteBuffer dataToSend) throws IOException
Description copied from interface:BufferTransformerimplementers can transform the bytes before they are sent. When data in the dataToSend argument are left a IOException will be thrown byNIOJICPConnection.writePacket(jade.imtp.leap.JICP.JICPPacket).- Specified by:
preprocessBufferToWritein interfaceBufferTransformer- Returns:
- the ByteBuffer to send
- Throws:
IOException- will be handled by theBEManagementServiceand if applicableNIOMediator
-
postprocessBufferRead
public ByteBuffer postprocessBufferRead(ByteBuffer socketData) throws jade.imtp.leap.nio.PacketIncompleteException, IOException
Description copied from interface:BufferTransformerimplementers can transform data available read from the socket. Any data left in the socketData argument will be used in subsequentNIOJICPConnection.readPacket()calls.- Specified by:
postprocessBufferReadin interfaceBufferTransformer- Returns:
- a buffer containing the transformed data
- Throws:
IOException- will be handled by theBEManagementServiceand if applicableNIOMediatorjade.imtp.leap.nio.PacketIncompleteException
-
needSocketData
public boolean needSocketData()
-
-