org.fusesource.hawtdispatch.transport
Class SslProtocolCodec

java.lang.Object
  extended by org.fusesource.hawtdispatch.transport.SslProtocolCodec
All Implemented Interfaces:
ProtocolCodec, SecuredSession, WrappingProtocolCodec

public class SslProtocolCodec
extends Object
implements WrappingProtocolCodec, SecuredSession

Implements the SSL protocol as a WrappingProtocolCodec. Useful for when you want to switch to the SSL protocol on a regular TCP Transport.


Nested Class Summary
static class SslProtocolCodec.ClientAuth
           
 class SslProtocolCodec.SSLReadChannel
           
 class SslProtocolCodec.SSLWriteChannel
           
 
Nested classes/interfaces inherited from interface org.fusesource.hawtdispatch.transport.ProtocolCodec
ProtocolCodec.BufferState
 
Constructor Summary
SslProtocolCodec()
           
 
Method Summary
 SslProtocolCodec client()
           
 ProtocolCodec.BufferState flush()
          Attempts to complete the previous write which did not complete.
 boolean full()
          Is the codec's buffer full?
 long getLastReadSize()
           
 long getLastWriteSize()
           
 ProtocolCodec getNext()
           
 X509Certificate[] getPeerX509Certificates()
          Gets the X509Certificate associated withe the peer.
 int getReadBufferSize()
           
 long getReadCounter()
           
 SSLSession getSSLSession()
           
 int getWriteBufferSize()
           
 long getWriteCounter()
           
 void handshake()
           
protected  void initializeEngine()
           
 Object read()
          Non-blocking channel based decoding.
 SslProtocolCodec server(SslProtocolCodec.ClientAuth clientAuth)
           
 void setNext(ProtocolCodec next)
           
 void setSSLContext(SSLContext ctx)
           
 void setTransport(Transport transport)
           
protected  boolean transportFlush()
           
 void unread(byte[] buffer)
          Pushes back a buffer as being unread.
 ProtocolCodec.BufferState write(Object value)
          Non-blocking channel based encoding.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SslProtocolCodec

public SslProtocolCodec()
Method Detail

getNext

public ProtocolCodec getNext()
Specified by:
getNext in interface WrappingProtocolCodec

setNext

public void setNext(ProtocolCodec next)
Specified by:
setNext in interface WrappingProtocolCodec

setSSLContext

public void setSSLContext(SSLContext ctx)

client

public SslProtocolCodec client()
                        throws Exception
Throws:
Exception

server

public SslProtocolCodec server(SslProtocolCodec.ClientAuth clientAuth)
                        throws Exception
Throws:
Exception

initializeEngine

protected void initializeEngine()
                         throws Exception
Throws:
Exception

getSSLSession

public SSLSession getSSLSession()

getPeerX509Certificates

public X509Certificate[] getPeerX509Certificates()
Description copied from interface: SecuredSession
Gets the X509Certificate associated withe the peer.

Specified by:
getPeerX509Certificates in interface SecuredSession
Returns:

setTransport

public void setTransport(Transport transport)
Specified by:
setTransport in interface ProtocolCodec

handshake

public void handshake()
               throws IOException
Throws:
IOException

transportFlush

protected boolean transportFlush()
                          throws IOException
Returns:
true if fully flushed.
Throws:
IOException

unread

public void unread(byte[] buffer)
Description copied from interface: ProtocolCodec
Pushes back a buffer as being unread.

Specified by:
unread in interface ProtocolCodec

read

public Object read()
            throws IOException
Description copied from interface: ProtocolCodec
Non-blocking channel based decoding.

Specified by:
read in interface ProtocolCodec
Returns:
Throws:
IOException

write

public ProtocolCodec.BufferState write(Object value)
                                throws IOException
Description copied from interface: ProtocolCodec
Non-blocking channel based encoding.

Specified by:
write in interface ProtocolCodec
Returns:
true if the write completed.
Throws:
IOException

flush

public ProtocolCodec.BufferState flush()
                                throws IOException
Description copied from interface: ProtocolCodec
Attempts to complete the previous write which did not complete.

Specified by:
flush in interface ProtocolCodec
Returns:
Throws:
IOException

full

public boolean full()
Description copied from interface: ProtocolCodec
Is the codec's buffer full?

Specified by:
full in interface ProtocolCodec
Returns:

getWriteCounter

public long getWriteCounter()
Specified by:
getWriteCounter in interface ProtocolCodec
Returns:
The number of bytes written.

getLastWriteSize

public long getLastWriteSize()
Specified by:
getLastWriteSize in interface ProtocolCodec
Returns:
The number of bytes read in the last write io performed.

getReadCounter

public long getReadCounter()
Specified by:
getReadCounter in interface ProtocolCodec
Returns:
The number of bytes received.

getLastReadSize

public long getLastReadSize()
Specified by:
getLastReadSize in interface ProtocolCodec
Returns:
The number of bytes read in the last read io performed.

getReadBufferSize

public int getReadBufferSize()
Specified by:
getReadBufferSize in interface ProtocolCodec

getWriteBufferSize

public int getWriteBufferSize()
Specified by:
getWriteBufferSize in interface ProtocolCodec


Copyright © 2010-2014 FuseSource, Corp.. All Rights Reserved.