org.fusesource.hawtdispatch.transport
Class SslTransport

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

public class SslTransport
extends TcpTransport

An SSL Transport for secure communications.

Author:
Hiram Chirino

Nested Class Summary
static class ServiceBase.STARTING
           
static class ServiceBase.State
           
static class ServiceBase.STOPPING
           
 class SslTransport.SSLChannel
           
 
Field Summary
protected  ServiceBase.State _serviceState
           
static ServiceBase.State CREATED
           
static ServiceBase.State STARTED
           
static ServiceBase.State STOPPED
           
 
Fields inherited from class org.fusesource.hawtdispatch.transport.TcpTransport
channel, codec, dispatchQueue, drainOutboundSource, IPTOS_LOWCOST, IPTOS_LOWDELAY, IPTOS_RELIABILITY, IPTOS_THROUGHPUT, listener, localLocation, rateLimitingChannel, remoteLocation, socketState, useLocalHost, yieldSource
 
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.
protected  void drainInbound()
           
 void flush()
          Forces a flush of any output buffers.
 Executor getBlockingExecutor()
           
 X509Certificate[] getPeerX509Certificates()
           
protected  ServiceBase.State getServiceState()
           
 SSLSession getSSLSession()
           
 void handshake()
           
protected  void initializeChannel()
           
protected  void onConnected()
           
static String protocol(String scheme)
          Maps uri schemes to a protocol algorithm names.
 ReadableByteChannel readChannel()
           
 void setBlockingExecutor(Executor blockingExecutor)
           
 void setSSLContext(SSLContext ctx)
           
 void start(Runnable onCompleted)
           
 void stop(Runnable onCompleted)
           
protected  boolean transportFlush()
           
 WritableByteChannel writeChannel()
           
 
Methods inherited from class org.fusesource.hawtdispatch.transport.TcpTransport
_start, _stop, full, getDispatchQueue, getLocalAddress, getMaxReadRate, getMaxWriteRate, getProtocolCodec, getReceiveBufferSize, getRemoteAddress, getSendBufferSize, getSocketChannel, getTrafficClass, getTransportListener, getTypeId, initializeCodec, isConnected, isDisposed, isFaultTolerant, isKeepAlive, isUseLocalHost, narrow, offer, onTransportFailure, reconnect, resolveHostName, resumeRead, resumeWrite, setDispatchQueue, setKeepAlive, setMaxReadRate, setMaxWriteRate, setProtocolCodec, setReceiveBufferSize, setSendBufferSize, setTrafficClass, setTransportListener, setUseLocalHost, suspendRead, suspendWrite
 
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, stop
 

Field Detail

CREATED

public static final ServiceBase.State CREATED

STARTED

public static final ServiceBase.State STARTED

STOPPED

public static final ServiceBase.State STOPPED

_serviceState

protected ServiceBase.State _serviceState
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()

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

protected void drainInbound()
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()

readChannel

public ReadableByteChannel readChannel()
Overrides:
readChannel in class TcpTransport

writeChannel

public WritableByteChannel writeChannel()
Overrides:
writeChannel in class TcpTransport

getBlockingExecutor

public Executor getBlockingExecutor()

setBlockingExecutor

public void setBlockingExecutor(Executor blockingExecutor)

start

public final void start(Runnable onCompleted)

stop

public final void stop(Runnable onCompleted)

getServiceState

protected ServiceBase.State getServiceState()


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