public class OutboundSocketBinding extends Object
SocketBinding
which represents a ServerSocket
that opens a socket for "listening",
the OutboundSocketBinding
represents a Socket
which "connects" to a remote/local host.Modifier and Type | Field and Description |
---|---|
static org.jboss.msc.service.ServiceName |
OUTBOUND_SOCKET_BINDING_BASE_SERVICE_NAME
Deprecated.
use capability based injection
|
Constructor and Description |
---|
OutboundSocketBinding(String name,
SocketBindingManager socketBindingManager,
InetAddress destinationAddress,
int destinationPort,
NetworkInterfaceBinding sourceNetworkInterface,
Integer sourcePort,
boolean fixedSourcePort)
Creates an outbound socket binding.
|
OutboundSocketBinding(String name,
SocketBindingManager socketBindingManager,
String destinationAddress,
int destinationPort,
NetworkInterfaceBinding sourceNetworkInterface,
Integer sourcePort,
boolean fixedSourcePort)
Creates an outbound socket binding
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the outbound socket binding connection.
|
Socket |
connect()
Creates a
Socket represented by this OutboundSocketBinding and connects to the
destination. |
Integer |
getAbsoluteSourcePort()
Returns the absolute source port for this outbound socket binding.
|
InetAddress |
getDestinationAddress()
Deprecated.
Use
getResolvedDestinationAddress() instead to get the resolved destination address
or getUnresolvedDestinationAddress() to get the unresolved destination address. |
int |
getDestinationPort()
Returns the destination port number.
|
String |
getName()
Returns the name of this outbound socket binding.
|
InetAddress |
getOptionalSourceAddress()
Returns the source address of this outbound socket binding if one is configured.
|
InetAddress |
getResolvedDestinationAddress()
Returns the resolved destination address of this outbound socket binding.
|
InetAddress |
getSourceAddress()
Returns the source address of this outbound socket binding.
|
Integer |
getSourcePort()
Returns the source port for this outbound socket binding.
|
String |
getUnresolvedDestinationAddress()
Returns the unresolved destination address of this outbound socket binding.
|
boolean |
isConnected()
Returns true if a socket connection has been established by this outbound socket binding, false otherwise.
|
boolean |
isFixedSourcePort()
Returns whether the source port is fixed, i.e.
|
@Deprecated public static final org.jboss.msc.service.ServiceName OUTBOUND_SOCKET_BINDING_BASE_SERVICE_NAME
public OutboundSocketBinding(String name, SocketBindingManager socketBindingManager, String destinationAddress, int destinationPort, NetworkInterfaceBinding sourceNetworkInterface, Integer sourcePort, boolean fixedSourcePort)
name
- Name of the outbound socket bindingsocketBindingManager
- The socket binding managerdestinationAddress
- The destination address to which this socket will be "connected". Cannot be null or empty string.destinationPort
- The destination port. Cannot be < 0.sourceNetworkInterface
- (Optional) source network interface which will be used as the "source" of the socket bindingsourcePort
- (Optional) source port. Cannot be null or < 0fixedSourcePort
- True if the sourcePort
has to be used as a fixed port number. False if the sourcePort
will be added to the port offset while determining the absolute source port.public OutboundSocketBinding(String name, SocketBindingManager socketBindingManager, InetAddress destinationAddress, int destinationPort, NetworkInterfaceBinding sourceNetworkInterface, Integer sourcePort, boolean fixedSourcePort)
name
- Name of the outbound socket bindingsocketBindingManager
- The socket binding managerdestinationAddress
- The destination address to which this socket will be "connected". Cannot be null.destinationPort
- The destination port. Cannot be < 0.sourceNetworkInterface
- (Optional) source network interface which will be used as the "source" of the socket bindingsourcePort
- (Optional) source port. Cannot be null or < 0fixedSourcePort
- True if the sourcePort
has to be used as a fixed port number. False if the sourcePort
will be added to the port offset while determining the absolute source port.public Socket connect() throws IOException
Socket
represented by this OutboundSocketBinding
and connects to the
destination.IOException
public String getName()
public String getUnresolvedDestinationAddress()
public InetAddress getResolvedDestinationAddress() throws UnknownHostException
UnknownHostException
- If the destination address cannot be resolved@Deprecated public InetAddress getDestinationAddress() throws UnknownHostException
getResolvedDestinationAddress()
instead to get the resolved destination address
or getUnresolvedDestinationAddress()
to get the unresolved destination address.UnknownHostException
public int getDestinationPort()
public boolean isFixedSourcePort()
public InetAddress getSourceAddress()
public InetAddress getOptionalSourceAddress()
null
. Use getSourceAddress()
instead to obtain the default interface of the socket binding manager if none is specified for this binding.null
otherwisepublic Integer getSourcePort()
getAbsoluteSourcePort()
method.public Integer getAbsoluteSourcePort()
getSourcePort()
if the outbound socket binding is marked for "fixed source port". Else, it is the sum of getSourcePort()
and the port offset configured on the SocketBindingManager
.public void close() throws IOException
IOException
public boolean isConnected()
Copyright © 2023 JBoss by Red Hat. All rights reserved.