Package org.apache.qpid.protonj2.client
Class TransportOptions
java.lang.Object
org.apache.qpid.protonj2.client.TransportOptions
- All Implemented Interfaces:
- Cloneable
Encapsulates all the Transport options in one configuration object.
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final booleanstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final booleanstatic final booleanstatic final intstatic final booleanstatic final intstatic final booleanstatic final int
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionaddWebSocketHeader(String key, String value) Additional headers to be passed along to the remote when performing a WebSocket based connect.booleanallowNativeIO(boolean allowNativeIO) Determines if the a native IO implementation is preferred to the JDK based IO.clone()intconnectTimeout(int connectTimeout) A transport layer connection timeout value that controls how long a connection attempt can block before giving up and throwing a connection error.copyInto(TransportOptions other) Copy all configuration into the givenTransportOptionsfrom this instance.intdefaultTcpPort(int defaultTcpPort) The default unsecured connection port to use when none has been specified by the user.localAddress(String localAddress) The local address to bind to when attempting a remote connection.intlocalPort(int localPort) Configures the local port value to bind to when connecting to the remote, if that port is already in use this can lead to a connection error.String[]voidnativeIOPreference(String... nativeIOPreference) intreceiveBufferSize(int receiveBufferSize) Sets the receive buffer size in bytes, the value must be greater than zero or anIllegalArgumentExceptionwill be thrown.intsendBufferSize(int sendBufferSize) Sets the send buffer size in bytes, the value must be greater than zero or anIllegalArgumentExceptionwill be thrown.intsoLinger()soLinger(int soLinger) Configures the soLinger value that should be configured on the connection socket.intsoTimeout(int soTimeout) Sets the value to use when configuring the socket level soTimeout option.booleantcpKeepAlive(boolean keepAlive) Configures the TCP socket keep-alive value that should be used for a connection.booleantcpNoDelay(boolean tcpNoDelay) Configure the underlying connection to use the tcpNoDelay option.booleantraceBytes(boolean traceBytes) Determines if the transport should add a logger for bytes in / outinttrafficClass(int trafficClass) Sets the traffic class value used by the TCP connection, valid range is between 0 and 255.booleanuseWebSockets(boolean webSockets) Set to true to configure the transport layer as a WebSocket based connection.intwebSocketMaxFrameSize(int maxFrameSize) Configures the maximum size of each WebSocket frame, payloads larger than the max frame size are split into multiple frames during transmission.webSocketPath(String webSocketPath) The optional path element to provide when connecting via a WebSocket.
- 
Field Details- 
DEFAULT_SEND_BUFFER_SIZEpublic static final int DEFAULT_SEND_BUFFER_SIZE- See Also:
 
- 
DEFAULT_RECEIVE_BUFFER_SIZEpublic static final int DEFAULT_RECEIVE_BUFFER_SIZE- See Also:
 
- 
DEFAULT_TRAFFIC_CLASSpublic static final int DEFAULT_TRAFFIC_CLASS- See Also:
 
- 
DEFAULT_TCP_NO_DELAYpublic static final boolean DEFAULT_TCP_NO_DELAY- See Also:
 
- 
DEFAULT_TCP_KEEP_ALIVEpublic static final boolean DEFAULT_TCP_KEEP_ALIVE- See Also:
 
- 
DEFAULT_SO_LINGERpublic static final int DEFAULT_SO_LINGER- See Also:
 
- 
DEFAULT_SO_TIMEOUTpublic static final int DEFAULT_SO_TIMEOUT- See Also:
 
- 
DEFAULT_CONNECT_TIMEOUTpublic static final int DEFAULT_CONNECT_TIMEOUT- See Also:
 
- 
DEFAULT_TCP_PORTpublic static final int DEFAULT_TCP_PORT- See Also:
 
- 
DEFAULT_ALLOW_NATIVE_IOpublic static final boolean DEFAULT_ALLOW_NATIVE_IO- See Also:
 
- 
DEFAULT_TRACE_BYTESpublic static final boolean DEFAULT_TRACE_BYTES- See Also:
 
- 
DEFAULT_LOCAL_PORTpublic static final int DEFAULT_LOCAL_PORT- See Also:
 
- 
DEFAULT_USE_WEBSOCKETSpublic static final boolean DEFAULT_USE_WEBSOCKETS- See Also:
 
- 
DEFAULT_WEBSOCKET_MAX_FRAME_SIZEpublic static final int DEFAULT_WEBSOCKET_MAX_FRAME_SIZE- See Also:
 
- 
DEFAULT_NATIVEIO_PREFERENCES
 
- 
- 
Constructor Details- 
TransportOptionspublic TransportOptions()
 
- 
- 
Method Details- 
clone
- 
sendBufferSizepublic int sendBufferSize()- Returns:
- the currently set send buffer size in bytes.
 
- 
sendBufferSizeSets the send buffer size in bytes, the value must be greater than zero or anIllegalArgumentExceptionwill be thrown.- Parameters:
- sendBufferSize- the new send buffer size for the TCP Transport.
- Returns:
- this options instance.
- Throws:
- IllegalArgumentException- if the value given is not in the valid range.
 
- 
receiveBufferSizepublic int receiveBufferSize()- Returns:
- the currently configured receive buffer size in bytes.
 
- 
receiveBufferSizeSets the receive buffer size in bytes, the value must be greater than zero or anIllegalArgumentExceptionwill be thrown.- Parameters:
- receiveBufferSize- the new receive buffer size for the TCP Transport.
- Returns:
- this options instance.
- Throws:
- IllegalArgumentException- if the value given is not in the valid range.
 
- 
trafficClasspublic int trafficClass()- Returns:
- the currently configured traffic class value.
 
- 
trafficClassSets the traffic class value used by the TCP connection, valid range is between 0 and 255.- Parameters:
- trafficClass- the new traffic class value.
- Returns:
- this options instance.
- Throws:
- IllegalArgumentException- if the value given is not in the valid range.
 
- 
soTimeoutpublic int soTimeout()- Returns:
- the configured value for the socket level soTimeout option.
 
- 
soTimeoutSets the value to use when configuring the socket level soTimeout option.- Parameters:
- soTimeout- the soTimeout value to configure on the newly create socket.
- Returns:
- this TransportOptionsinstance.
 
- 
tcpNoDelaypublic boolean tcpNoDelay()- Returns:
- the configured value for the socket level tcpNoDelay option.
 
- 
tcpNoDelayConfigure the underlying connection to use the tcpNoDelay option.- Parameters:
- tcpNoDelay- controls if the underlying connection configures tcpNoDelay.
- Returns:
- this TransportOptionsinstance.
 
- 
soLingerpublic int soLinger()- Returns:
- the configured value for the socket level soLinger option.
 
- 
soLingerConfigures the soLinger value that should be configured on the connection socket.- Parameters:
- soLinger- The soLinger value to use for the underlying socket.
- Returns:
- this TransportOptionsinstance.
 
- 
tcpKeepAlivepublic boolean tcpKeepAlive()- Returns:
- the configured value for the socket level tcpKeepAlive option.
 
- 
tcpKeepAliveConfigures the TCP socket keep-alive value that should be used for a connection.- Parameters:
- keepAlive- The TCP/IP keep-alive value to use for the connection.
- Returns:
- this TransportOptionsinstance.
 
- 
connectTimeoutpublic int connectTimeout()- Returns:
- the configured value for the socket level connection timeout option.
 
- 
connectTimeoutA transport layer connection timeout value that controls how long a connection attempt can block before giving up and throwing a connection error.- Parameters:
- connectTimeout- connection timeout in milliseconds.
- Returns:
- this TransportOptionsinstance.
 
- 
defaultTcpPortpublic int defaultTcpPort()- Returns:
- the configured value for the socket level default port to use for connection if none is provided.
 
- 
defaultTcpPortThe default unsecured connection port to use when none has been specified by the user.- Parameters:
- defaultTcpPort- the default port to use for non-SSL connection if none provided.
- Returns:
- this TransportOptionsinstance.
 
- 
localAddress- Returns:
- the configured value for the socket level localAddress option.
 
- 
localAddressThe local address to bind to when attempting a remote connection.- Parameters:
- localAddress- the local address to bind to.
- Returns:
- this TransportOptionsinstance.
 
- 
localPortpublic int localPort()- Returns:
- the configured value for the socket level localPort option.
 
- 
localPortConfigures the local port value to bind to when connecting to the remote, if that port is already in use this can lead to a connection error.- Parameters:
- localPort- local port value to use when making a remote connection.
- Returns:
- this TransportOptionsinstance.
 
- 
allowNativeIOpublic boolean allowNativeIO()- Returns:
- true if an native IO library can be used if available on this platform instead of the JDK IO.
 
- 
allowNativeIODetermines if the a native IO implementation is preferred to the JDK based IO.- Parameters:
- allowNativeIO- should use of available native transport be allowed if one is available.
- Returns:
- this TransportOptionsinstance.
 
- 
nativeIOPreference- Returns:
- the nativeIOPreference
 
- 
nativeIOPreference- Parameters:
- nativeIOPreference- the nativeIOPreference to set
 
- 
traceBytespublic boolean traceBytes()- Returns:
- true if the transport should enable byte tracing
 
- 
traceBytesDetermines if the transport should add a logger for bytes in / out- Parameters:
- traceBytes- should the transport log the bytes in and out.
- Returns:
- this TransportOptionsinstance.
 
- 
useWebSocketspublic boolean useWebSockets()- Returns:
- the configured state of WebSockets for client connections.
 
- 
useWebSocketsSet to true to configure the transport layer as a WebSocket based connection.- Parameters:
- webSockets- should the transport attempt connection using a WebSocket.
- Returns:
- this TransportOptionsinstance.
 
- 
webSocketPath- Returns:
- the configured value for the socket level WebSocket path option.
 
- 
webSocketPathThe optional path element to provide when connecting via a WebSocket.- Parameters:
- webSocketPath- path value to use for WebSocket connections.
- Returns:
- this TransportOptionsinstance.
 
- 
webSocketHeaders- Returns:
- the configured value for the socket level WebSocket Headers option.
 
- 
addWebSocketHeaderAdditional headers to be passed along to the remote when performing a WebSocket based connect.- Parameters:
- key- the header key to use with the provided value.
- value- the value to store under the provided key.
- Returns:
- this TransportOptionsinstance.
 
- 
webSocketMaxFrameSizepublic int webSocketMaxFrameSize()- Returns:
- the configured value for the socket level WebSocket max frame size option.
 
- 
webSocketMaxFrameSizeConfigures the maximum size of each WebSocket frame, payloads larger than the max frame size are split into multiple frames during transmission.- Parameters:
- maxFrameSize- the maximum WebSocket frame size before payloads are split.
- Returns:
- this TransportOptionsinstance.
 
- 
copyIntoCopy all configuration into the givenTransportOptionsfrom this instance.- Parameters:
- other- another- TransportOptionsinstance that will receive the configuration from this instance.
- Returns:
- the options instance that was copied into.
 
 
-