Class WebSocketTransport
- java.lang.Object
-
- org.apache.qpid.protonj2.client.transport.TcpTransport
-
- org.apache.qpid.protonj2.client.transport.WebSocketTransport
-
- All Implemented Interfaces:
Transport
public class WebSocketTransport extends TcpTransport
Netty based WebSockets Transport that wraps and extends the TCP Transport.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.qpid.protonj2.client.transport.TcpTransport
TcpTransport.NettyDefaultHandler<E>, TcpTransport.NettyTcpTransportHandler
-
-
Field Summary
-
Fields inherited from class org.apache.qpid.protonj2.client.transport.TcpTransport
bootstrap, channel, closed, connected, connectedLatch, failureCause, host, listener, options, port, sslOptions
-
-
Constructor Summary
Constructors Constructor Description WebSocketTransport(io.netty.bootstrap.Bootstrap bootstrap, TransportOptions options, SslOptions sslOptions)Create a newWebSocketTransportinstance with the given configuration.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaddAdditionalHandlers(io.netty.channel.ChannelPipeline pipeline)protected io.netty.channel.ChannelInboundHandlerAdaptercreateChannelHandler()java.net.URIgetRemoteURI()Returns a URI that contains some meaningful information about the remote connection such as a scheme that reflects the transport type and the remote host and port that the connection was instructed to connect to.protected java.lang.StringgetScheme()protected voidhandleConnected(io.netty.channel.Channel channel)WebSocketTransportwrite(ProtonBuffer output, java.lang.Runnable onComplete)Writes a chunk of data over the Transport connection without performing an explicit flush on the transport.WebSocketTransportwriteAndFlush(ProtonBuffer output, java.lang.Runnable onComplete)Writes a chunk of data over the Transport connection and requests a flush of all pending queued write operations-
Methods inherited from class org.apache.qpid.protonj2.client.transport.TcpTransport
awaitConnect, checkConnected, close, connect, flush, getBufferAllocator, getHost, getLocalPrincipal, getPort, getSslOptions, getTransportListener, getTransportOptions, handleTransportFailure, isConnected, isSecure, toOutputBuffer, write, writeAndFlush
-
-
-
-
Constructor Detail
-
WebSocketTransport
public WebSocketTransport(io.netty.bootstrap.Bootstrap bootstrap, TransportOptions options, SslOptions sslOptions)Create a newWebSocketTransportinstance with the given configuration.- Parameters:
bootstrap- theBootstrapthat this transport's IO is bound to.options- theTransportOptionsused to configure the socket connection.sslOptions- theSslOptionsto use if the options indicate SSL is enabled.
-
-
Method Detail
-
write
public WebSocketTransport write(ProtonBuffer output, java.lang.Runnable onComplete) throws java.io.IOException
Description copied from interface:TransportWrites a chunk of data over the Transport connection without performing an explicit flush on the transport. This method allows for a completion callback that is signaled when the actual low level IO operation is completed which could be after this method has returned.- Specified by:
writein interfaceTransport- Overrides:
writein classTcpTransport- Parameters:
output- The buffer of data that is to be transmitted.onComplete- ARunnablethat is invoked when the IO operation completes successfully.- Returns:
- this
Transportinstance. - Throws:
java.io.IOException- if an error occurs during the write operation.
-
writeAndFlush
public WebSocketTransport writeAndFlush(ProtonBuffer output, java.lang.Runnable onComplete) throws java.io.IOException
Description copied from interface:TransportWrites a chunk of data over the Transport connection and requests a flush of all pending queued write operations- Specified by:
writeAndFlushin interfaceTransport- Overrides:
writeAndFlushin classTcpTransport- Parameters:
output- The buffer of data that is to be transmitted.onComplete- ARunnablethat is invoked when the IO operation completes successfully.- Returns:
- this
Transportinstance. - Throws:
java.io.IOException- if an error occurs during the write operation.
-
getRemoteURI
public java.net.URI getRemoteURI()
Description copied from interface:TransportReturns a URI that contains some meaningful information about the remote connection such as a scheme that reflects the transport type and the remote host and port that the connection was instructed to connect to. If called before theTransport.connect(String, int, TransportListener)method this method returnsnull.- Specified by:
getRemoteURIin interfaceTransport- Overrides:
getRemoteURIin classTcpTransport- Returns:
- a URI that reflects a meaningful view of the
Transportremote connection details.
-
createChannelHandler
protected io.netty.channel.ChannelInboundHandlerAdapter createChannelHandler()
- Overrides:
createChannelHandlerin classTcpTransport
-
addAdditionalHandlers
protected void addAdditionalHandlers(io.netty.channel.ChannelPipeline pipeline)
- Overrides:
addAdditionalHandlersin classTcpTransport
-
handleConnected
protected void handleConnected(io.netty.channel.Channel channel) throws java.lang.Exception- Overrides:
handleConnectedin classTcpTransport- Throws:
java.lang.Exception
-
getScheme
protected java.lang.String getScheme()
- Overrides:
getSchemein classTcpTransport
-
-