Package org.jboss.remoting3
Interface Connection
-
- All Superinterfaces:
Attachable
,AutoCloseable
,Closeable
,HandleableCloseable<Connection>
public interface Connection extends HandleableCloseable<Connection>, Attachable
A connection to a remote peer.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.jboss.remoting3.HandleableCloseable
HandleableCloseable.Key
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description ConnectionPeerIdentity
getConnectionAnonymousIdentity()
Get the anonymous peer identity for the connection.ConnectionPeerIdentity
getConnectionPeerIdentity()
Get the peer identity for the connection.Endpoint
getEndpoint()
Get the local endpoint.SocketAddress
getLocalAddress()
Get the local address of this connection, if any.default <S extends SocketAddress>
SgetLocalAddress(Class<S> type)
Get the local address of this connection, cast to a specific type, if any.org.wildfly.security.auth.server.SecurityIdentity
getLocalIdentity()
Get the local identity of this inbound connection.org.wildfly.security.auth.server.SecurityIdentity
getLocalIdentity(int id)
Get the local identity associated with the given ID that was previously shared to the peer.SocketAddress
getPeerAddress()
Get the peer address of this connection, if any.default <S extends SocketAddress>
SgetPeerAddress(Class<S> type)
Get the peer address of this connection, cast to a specific type, if any.ConnectionPeerIdentityContext
getPeerIdentityContext()
Get the peer identity context for the connection.int
getPeerIdentityId()
The the ID number for the peer identity which is currently associated with the calling thread.URI
getPeerURI()
Get the URI of the remote peer.Principal
getPrincipal()
Get the local principal that was authenticated to the peer.String
getProtocol()
Get the protocol of this connection.String
getRemoteEndpointName()
Get the name of the remote endpoint, if it has one.SSLSession
getSslSession()
Get the underlyingSSLSession
for this connection if one is established.org.xnio.IoFuture<Channel>
openChannel(String serviceType, org.xnio.OptionMap optionMap)
Open a channel to a remote service on this connection.boolean
supportsRemoteAuth()
Determine if the remote authentication protocol is supported by this connection.-
Methods inherited from interface org.jboss.remoting3.Attachable
getAttachments
-
Methods inherited from interface org.jboss.remoting3.HandleableCloseable
addCloseHandler, awaitClosed, awaitClosedUninterruptibly, close, closeAsync, isOpen
-
-
-
-
Method Detail
-
getLocalAddress
SocketAddress getLocalAddress()
Get the local address of this connection, if any.- Returns:
- the local address of this connection, or
null
if there is no local address
-
getLocalAddress
default <S extends SocketAddress> S getLocalAddress(Class<S> type)
Get the local address of this connection, cast to a specific type, if any. If there is an address but it cannot be cast to the given type,null
is returned.- Type Parameters:
S
- the address type- Parameters:
type
- the address type class- Returns:
- the local address of this connection, or
null
if there is no local address or the address is of the wrong type
-
getPeerAddress
SocketAddress getPeerAddress()
Get the peer address of this connection, if any.- Returns:
- the peer address of this connection, or
null
if there is no peer address
-
getPeerAddress
default <S extends SocketAddress> S getPeerAddress(Class<S> type)
Get the peer address of this connection, cast to a specific type, if any. If there is an address but it cannot be cast to the given type,null
is returned.- Type Parameters:
S
- the address type- Parameters:
type
- the address type class- Returns:
- the peer address of this connection, or
null
if there is no peer address or the address is of the wrong type
-
getSslSession
SSLSession getSslSession()
Get the underlyingSSLSession
for this connection if one is established.- Returns:
- the
SSLSession
for the connection if one is established, otherwise returnsnull
.
-
openChannel
org.xnio.IoFuture<Channel> openChannel(String serviceType, org.xnio.OptionMap optionMap)
Open a channel to a remote service on this connection.- Parameters:
serviceType
- the service typeoptionMap
- the option map- Returns:
- the future channel
-
getRemoteEndpointName
String getRemoteEndpointName()
Get the name of the remote endpoint, if it has one.- Returns:
- the remote endpoint name or
null
if it is anonymous
-
getEndpoint
Endpoint getEndpoint()
Get the local endpoint.- Returns:
- the local endpoint
-
getPeerURI
URI getPeerURI()
Get the URI of the remote peer. The URI may be constructed ornull
if the connection was accepted rather than established.- Returns:
- the peer URI, or
null
if none is available
-
getProtocol
String getProtocol()
Get the protocol of this connection.- Returns:
- the protocol (not
null
)
-
getLocalIdentity
org.wildfly.security.auth.server.SecurityIdentity getLocalIdentity()
Get the local identity of this inbound connection.- Returns:
- the local identity, or
null
if the connection is outbound
-
getLocalIdentity
org.wildfly.security.auth.server.SecurityIdentity getLocalIdentity(int id)
Get the local identity associated with the given ID that was previously shared to the peer.- Parameters:
id
- the numeric ID- Returns:
- the identity, or
null
if the the given ID is not valid
-
getPeerIdentityId
int getPeerIdentityId() throws org.wildfly.security.auth.AuthenticationException
The the ID number for the peer identity which is currently associated with the calling thread. The special value 0 indicates that the connection's identity is in use; the special value 1 indicates that the anonymous identity is in use.- Returns:
- the numeric ID
- Throws:
org.wildfly.security.auth.AuthenticationException
- if an authentication was required to get the ID, but the authentication failed
-
getConnectionPeerIdentity
ConnectionPeerIdentity getConnectionPeerIdentity() throws SecurityException
Get the peer identity for the connection. This is the identity that corresponds to the connection's own authentication result.- Returns:
- the peer identity for the connection
- Throws:
SecurityException
- if a security manager is installed and the caller is not granted thegetConnectionPeerIdentity
RemotingPermission
-
getConnectionAnonymousIdentity
ConnectionPeerIdentity getConnectionAnonymousIdentity()
Get the anonymous peer identity for the connection. When this identity is in force, the peer will use its local anonymous identity.- Returns:
- the anonymous peer identity for the connection
-
getPeerIdentityContext
ConnectionPeerIdentityContext getPeerIdentityContext()
Get the peer identity context for the connection. This context can be used to authenticate additional identities to the peer which can then be propagated to that peer. If the connection is managed, the lifespan of the context may encompass several connection lifespans when the managed connection is broken and subsequently re-established.- Returns:
- the peer identity context
-
getPrincipal
Principal getPrincipal()
Get the local principal that was authenticated to the peer. May be anonymous.- Returns:
- the peer principal (must not be
null
)
-
supportsRemoteAuth
boolean supportsRemoteAuth()
Determine if the remote authentication protocol is supported by this connection.- Returns:
true
if remote authentication is supported,false
otherwise
-
-