org.fusesource.hawtdispatch.transport
Class SslTransport

java.lang.Object
  extended by org.fusesource.hawtdispatch.transport.ServiceBase
      extended by org.fusesource.hawtdispatch.transport.TcpTransport
          extended by org.fusesource.hawtdispatch.transport.SslTransport
All Implemented Interfaces:
SecuredSession, Transport

public class SslTransport
extends TcpTransport
implements SecuredSession

An SSL Transport for secure communications.

Author:
Hiram Chirino

Nested Class Summary
 class SslTransport.SSLChannel
           
 
Nested classes/interfaces inherited from class org.fusesource.hawtdispatch.transport.ServiceBase
ServiceBase.STARTING, ServiceBase.State, ServiceBase.STOPPING
 
Field Summary
 
Fields inherited from class org.fusesource.hawtdispatch.transport.TcpTransport
blockingExecutor, channel, codec, dispatchQueue, drainOutboundSource, IPTOS_LOWCOST, IPTOS_LOWDELAY, IPTOS_RELIABILITY, IPTOS_THROUGHPUT, listener, localLocation, rateLimitingChannel, remoteLocation, socketState, useLocalHost, yieldSource
 
Fields inherited from class org.fusesource.hawtdispatch.transport.ServiceBase
_serviceState, CREATED, STARTED, STOPPED
 
Constructor Summary
SslTransport()
           
 
Method Summary
 void connected(SocketChannel channel)
           
 void connecting(URI remoteLocation, URI localLocation)
           
static SslTransport createTransport(URI uri)
          Allows subclasses of TcpTransportFactory to create custom instances of TcpTransport.
 void drainInbound()
           
 void flush()
          Forces a flush of any output buffers.
 String getClientAuth()
           
 X509Certificate[] getPeerX509Certificates()
          Gets the X509Certificate associated withe the peer.
 ReadableByteChannel getReadChannel()
           
 SSLSession getSSLSession()
           
 WritableByteChannel getWriteChannel()
           
 void handshake()
           
protected  void initializeChannel()
           
protected  void onConnected()
           
static String protocol(String scheme)
          Maps uri schemes to a protocol algorithm names.
 void setClientAuth(String clientAuth)
           
 void setSSLContext(SSLContext ctx)
           
protected  boolean transportFlush()
           
 
Methods inherited from class org.fusesource.hawtdispatch.transport.TcpTransport
_start, _stop, full, getBlockingExecutor, getDispatchQueue, getLocalAddress, getLocalHost, getMaxReadRate, getMaxWriteRate, getProtocolCodec, getReceiveBufferSize, getRemoteAddress, getSendBufferSize, getSocketChannel, getTrafficClass, getTransportListener, initializeCodec, isClosed, isCloseOnCancel, isConnected, isKeepAlive, isUseLocalHost, offer, onTransportFailure, resolveHostName, resumeRead, resumeWrite, setBlockingExecutor, setCloseOnCancel, setDispatchQueue, setKeepAlive, setMaxReadRate, setMaxWriteRate, setProtocolCodec, setReceiveBufferSize, setSendBufferSize, setTrafficClass, setTransportListener, setUseLocalHost, suspendRead, suspendWrite
 
Methods inherited from class org.fusesource.hawtdispatch.transport.ServiceBase
getServiceState, start, start, stop, stop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.fusesource.hawtdispatch.transport.Transport
start, start, stop, stop
 

Constructor Detail

SslTransport

public SslTransport()
Method Detail

protocol

public static String protocol(String scheme)
Maps uri schemes to a protocol algorithm names. Valid algorithm names listed at: http://download.oracle.com/javase/6/docs/technotes/guides/security/StandardNames.html#SSLContext


setSSLContext

public void setSSLContext(SSLContext ctx)

createTransport

public static SslTransport createTransport(URI uri)
                                    throws Exception
Allows subclasses of TcpTransportFactory to create custom instances of TcpTransport.

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:

connecting

public void connecting(URI remoteLocation,
                       URI localLocation)
                throws Exception
Overrides:
connecting in class TcpTransport
Throws:
Exception

connected

public void connected(SocketChannel channel)
               throws Exception
Overrides:
connected in class TcpTransport
Throws:
Exception

initializeChannel

protected void initializeChannel()
                          throws Exception
Overrides:
initializeChannel in class TcpTransport
Throws:
Exception

onConnected

protected void onConnected()
                    throws IOException
Overrides:
onConnected in class TcpTransport
Throws:
IOException

flush

public void flush()
Description copied from interface: Transport
Forces a flush of any output buffers. Once the flush completes the listener's 'onRefill()' method will execute.

Specified by:
flush in interface Transport
Overrides:
flush in class TcpTransport

drainInbound

public void drainInbound()
Specified by:
drainInbound in interface Transport
Overrides:
drainInbound in class TcpTransport

transportFlush

protected boolean transportFlush()
                          throws IOException
Overrides:
transportFlush in class TcpTransport
Returns:
true if fully flushed.
Throws:
IOException

handshake

public void handshake()

getReadChannel

public ReadableByteChannel getReadChannel()
Specified by:
getReadChannel in interface Transport
Overrides:
getReadChannel in class TcpTransport

getWriteChannel

public WritableByteChannel getWriteChannel()
Specified by:
getWriteChannel in interface Transport
Overrides:
getWriteChannel in class TcpTransport

getClientAuth

public String getClientAuth()

setClientAuth

public void setClientAuth(String clientAuth)


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