org.apache.activemq.transport.tcp
Class SslTransport

java.lang.Object
  extended by org.apache.activemq.util.ServiceSupport
      extended by org.apache.activemq.transport.TransportSupport
          extended by org.apache.activemq.transport.TransportThreadSupport
              extended by org.apache.activemq.transport.tcp.TcpTransport
                  extended by org.apache.activemq.transport.tcp.SslTransport
All Implemented Interfaces:
Runnable, Service, Transport

public class SslTransport
extends TcpTransport

A Transport class that uses SSL and client-side certificate authentication. Client-side certificate authentication must be enabled through the constructor. By default, this class will have the same client authentication behavior as the socket it is passed. This class will set ConnectionInfo's transportContext to the SSL certificates of the client. NOTE: Accessor method for needClientAuth was not provided on purpose. This is because needClientAuth's value must be set before the socket is connected. Otherwise, unexpected situations may occur.


Field Summary
 
Fields inherited from class org.apache.activemq.transport.tcp.TcpTransport
buffOut, closeAsync, connectionTimeout, dataIn, dataOut, diffServChosen, dynamicManagement, ioBufferSize, jmxPort, localLocation, logWriterName, minmumWireFormatVersion, remoteLocation, socket, socketBufferSize, socketFactory, soTimeout, startLogging, stoppedLatch, trace, trafficClass, typeOfServiceChosen, useLocalHost, wireFormat
 
Constructor Summary
SslTransport(WireFormat wireFormat, SSLSocket socket)
          Initialize from a ServerSocket.
SslTransport(WireFormat wireFormat, SSLSocketFactory socketFactory, URI remoteLocation, URI localLocation, boolean needClientAuth)
          Connect to a remote node such as a Broker.
 
Method Summary
 void doConsume(Object command)
          Overriding in order to add the client's certificates to ConnectionInfo Commmands.
 X509Certificate[] getPeerCertificates()
           
 String toString()
           
 
Methods inherited from class org.apache.activemq.transport.tcp.TcpTransport
closeStreams, connect, doRun, doStart, doStop, getConnectionTimeout, getDiffServ, getIoBufferSize, getJmxPort, getKeepAlive, getLogWriterName, getMinmumWireFormatVersion, getReceiveCounter, getRemoteAddress, getSocketBufferSize, getSoLinger, getSoTimeout, getTcpNoDelay, getTypeOfService, getWireFormat, initialiseSocket, initializeStreams, isCloseAsync, isDynamicManagement, isStartLogging, isTrace, isUseLocalHost, narrow, oneway, readCommand, resolveHostName, run, setCloseAsync, setConnectionTimeout, setDiffServ, setDynamicManagement, setIoBufferSize, setJmxPort, setKeepAlive, setLogWriterName, setMinmumWireFormatVersion, setSocketBufferSize, setSocketOptions, setSoLinger, setSoTimeout, setStartLogging, setTcpNoDelay, setTrace, setTypeOfService, setUseLocalHost, stop
 
Methods inherited from class org.apache.activemq.transport.TransportThreadSupport
getStackSize, isDaemon, setDaemon, setStackSize
 
Methods inherited from class org.apache.activemq.transport.TransportSupport
asyncRequest, checkStarted, getTransportListener, isConnected, isDisposed, isFaultTolerant, isReconnectSupported, isUpdateURIsSupported, onException, reconnect, request, request, setTransportListener, updateURIs
 
Methods inherited from class org.apache.activemq.util.ServiceSupport
addServiceListener, dispose, isStarted, isStopped, isStopping, postStop, preStart, removeServiceListener, start
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.apache.activemq.transport.Transport
asyncRequest, getTransportListener, isConnected, isDisposed, isFaultTolerant, isReconnectSupported, isUpdateURIsSupported, reconnect, request, request, setTransportListener, updateURIs
 
Methods inherited from interface org.apache.activemq.Service
start
 

Constructor Detail

SslTransport

public SslTransport(WireFormat wireFormat,
                    SSLSocketFactory socketFactory,
                    URI remoteLocation,
                    URI localLocation,
                    boolean needClientAuth)
             throws IOException
Connect to a remote node such as a Broker.

Parameters:
wireFormat - The WireFormat to be used.
socketFactory - The socket factory to be used. Forcing SSLSockets for obvious reasons.
remoteLocation - The remote location.
localLocation - The local location.
needClientAuth - If set to true, the underlying socket will need client certificate authentication.
Throws:
UnknownHostException - If TcpTransport throws.
IOException - If TcpTransport throws.

SslTransport

public SslTransport(WireFormat wireFormat,
                    SSLSocket socket)
             throws IOException
Initialize from a ServerSocket. No access to needClientAuth is given since it is already set within the provided socket.

Parameters:
wireFormat - The WireFormat to be used.
socket - The Socket to be used. Forcing SSL.
Throws:
IOException - If TcpTransport throws.
Method Detail

doConsume

public void doConsume(Object command)
Overriding in order to add the client's certificates to ConnectionInfo Commmands.

Overrides:
doConsume in class TransportSupport
Parameters:
command - The Command coming in.

getPeerCertificates

public X509Certificate[] getPeerCertificates()
Returns:
peer certificate chain associated with the ssl socket

toString

public String toString()
Overrides:
toString in class TcpTransport
Returns:
pretty print of 'this'


Copyright © 2005-2012 The Apache Software Foundation. All Rights Reserved.