Class SslTransport
- java.lang.Object
-
- org.apache.activemq.util.ServiceSupport
-
- org.apache.activemq.transport.TransportSupport
-
- org.apache.activemq.transport.TransportThreadSupport
-
- org.apache.activemq.transport.tcp.TcpTransport
-
- org.apache.activemq.transport.tcp.SslTransport
-
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.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.activemq.transport.tcp.TcpTransport
TcpTransport.InitBuffer
-
-
Field Summary
-
Fields inherited from class org.apache.activemq.transport.tcp.TcpTransport
buffOut, closeAsync, connectionTimeout, dataIn, dataOut, diffServChosen, dynamicManagement, initBuffer, ioBufferSize, jmxPort, localLocation, logWriterName, minmumWireFormatVersion, receiveCounter, remoteLocation, socket, socketBufferSize, socketFactory, socketOptions, soTimeout, startLogging, stoppedLatch, trace, trafficClass, typeOfServiceChosen, useLocalHost, wireFormat
-
-
Constructor Summary
Constructors Constructor Description 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.SslTransport(WireFormat format, SSLSocket socket, TcpTransport.InitBuffer initBuffer)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
doConsume(Object command)
Overriding in order to add the client's certificates to ConnectionInfo Commmands.X509Certificate[]
getPeerCertificates()
protected void
initialiseSocket(Socket sock)
Configures the socket for usevoid
setVerifyHostName(Boolean verifyHostName)
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, initializeStreams, isCloseAsync, isDynamicManagement, isStartLogging, isTrace, isUseLocalHost, narrow, oneway, readCommand, resolveHostName, run, setCloseAsync, setConnectionTimeout, setDiffServ, setDynamicManagement, setIoBufferSize, setJmxPort, setKeepAlive, setLogWriterName, setMinmumWireFormatVersion, setPeerCertificates, 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
-
-
-
-
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.
-
SslTransport
public SslTransport(WireFormat format, SSLSocket socket, TcpTransport.InitBuffer initBuffer) throws IOException
- Throws:
IOException
-
-
Method Detail
-
initialiseSocket
protected void initialiseSocket(Socket sock) throws SocketException, IllegalArgumentException
Description copied from class:TcpTransport
Configures the socket for use- Overrides:
initialiseSocket
in classTcpTransport
- Parameters:
sock
- the socket- Throws:
SocketException
IllegalArgumentException
-
doConsume
public void doConsume(Object command)
Overriding in order to add the client's certificates to ConnectionInfo Commmands.- Overrides:
doConsume
in classTransportSupport
- Parameters:
command
- The Command coming in.
-
setVerifyHostName
public void setVerifyHostName(Boolean verifyHostName)
-
getPeerCertificates
public X509Certificate[] getPeerCertificates()
- Specified by:
getPeerCertificates
in interfaceTransport
- Overrides:
getPeerCertificates
in classTcpTransport
- Returns:
- peer certificate chain associated with the ssl socket
-
toString
public String toString()
- Overrides:
toString
in classTcpTransport
- Returns:
- pretty print of 'this'
-
-