Interface LdapSocket
-
- All Superinterfaces:
AutoCloseable
,Closeable
public interface LdapSocket extends Closeable
A socket implementation representing a stream of LDAP messages. LDAP sockets are role agnostic and may be used for implementing LDAP clients and servers.Support for StartTLS is provided through the usage of
StartTlsExtendedRequest
. Support for SASL quality of protection is provided through the usage ofBindRequest
.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description void
close()
Disconnects this socket.void
closeWithReason(Throwable reason)
Disconnects the socket.InetSocketAddress
getLocalAddress()
Returns theInetSocketAddress
associated with the local system.InetSocketAddress
getRemoteAddress()
Returns theInetSocketAddress
associated with the remote system.SaslClient
getSaslClient()
Returns theSaslClient
currently in use by the underlying connection, ornull
if SASL integrity and/or privacy protection is not enabled.SaslServer
getSaslServer()
Returns theSaslServer
currently in use by the underlying connection, ornull
if SASL integrity and/or privacy protection is not enabled.SSLSession
getSslSession()
Returns the SSL session currently in use by the underlying connection, ornull
if SSL/TLS is not enabled.boolean
isClosed()
Returnstrue
if this socket is disconnected (locally or remotely) orfalse
if this socket is still connected to a peer.Flowable<LdapMessage>
read()
Returns aFlowable
of LDAP messages read from the network.Completable
write(Flowable<LdapMessage> messages)
Returns aCompletable
which, once subscribed, will write all themessages
to the network.default Completable
write(LdapMessage message)
Returns aCompletable
which, once subscribed, will write themessage
to the network.
-
-
-
Method Detail
-
read
Flowable<LdapMessage> read()
Returns aFlowable
of LDAP messages read from the network. Message reception is suspended until a subscriber subscribes to it. Note that no message will be dropped in the mean time.This
Flowable
only supports oneSubscriber
. SubsequentSubscriber
s will receive anIllegalStateException
. Consider subscribing using one of theFlowableProcessor
implementations in order to broadcast messages to multiple subscribers.If this socket is disconnected locally using
close()
orcloseWithReason(Throwable)
, then the subscriber will be notified throughSubscriber.onError(Throwable)
with the exception provided to the abort method orEOFException
if none was provided.When this socket is disconnected remotely by the peer, the subscriber will be notified through
Subscriber.onComplete()
.- Returns:
- The stream of
LdapMessage
s read from the network.
-
write
Completable write(Flowable<LdapMessage> messages)
Returns aCompletable
which, once subscribed, will write all themessages
to the network.The publisher must respect back-pressure constraints which reflect the capacity of the remote peer to read the flow of messages.
When this socket is disconnected, the
Completable
will be signaled with anEOFException
and themessages
stream will beSubscription.cancel()
ed.- Parameters:
messages
- The stream of message to write.- Returns:
- A
Completable
transmitting all messages to the network.
-
write
default Completable write(LdapMessage message)
Returns aCompletable
which, once subscribed, will write themessage
to the network.When this socket is disconnected, the
Completable
will be signaled with anEOFException
.- Parameters:
message
- The message to write.- Returns:
- A
Completable
transmitting the message to the network.
-
getLocalAddress
InetSocketAddress getLocalAddress()
Returns theInetSocketAddress
associated with the local system.- Returns:
- The
InetSocketAddress
associated with the local system.
-
getRemoteAddress
InetSocketAddress getRemoteAddress()
Returns theInetSocketAddress
associated with the remote system.- Returns:
- The
InetSocketAddress
associated with the remote system.
-
getSslSession
SSLSession getSslSession()
Returns the SSL session currently in use by the underlying connection, ornull
if SSL/TLS is not enabled.- Returns:
- The SSL session currently in use by the underlying connection, or
null
if SSL/TLS is not enabled.
-
getSaslServer
SaslServer getSaslServer()
Returns theSaslServer
currently in use by the underlying connection, ornull
if SASL integrity and/or privacy protection is not enabled.- Returns:
- The
SaslServer
currently in use by the underlying connection, ornull
if SASL integrity and/or privacy protection is not enabled.
-
getSaslClient
SaslClient getSaslClient()
Returns theSaslClient
currently in use by the underlying connection, ornull
if SASL integrity and/or privacy protection is not enabled.- Returns:
- The
SaslClient
currently in use by the underlying connection, ornull
if SASL integrity and/or privacy protection is not enabled.
-
close
void close()
Disconnects this socket. Disconnecting the socket will invokeread()
'sSubscriber.onError(Throwable)
with aEOFException
and willcancel
thewrite(Flowable)
's publisher. All messages which have not yet been sent could be dropped.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
-
closeWithReason
void closeWithReason(Throwable reason)
Disconnects the socket. Disconnecting the socket will invokeread()
'sSubscriber.onError(Throwable)
with the providedreason
. All messages which have not yet been sent could be dropped.- Parameters:
reason
- The reason of this disconnection.
-
isClosed
boolean isClosed()
Returnstrue
if this socket is disconnected (locally or remotely) orfalse
if this socket is still connected to a peer.- Returns:
true
if this socket is disconnected (locally or remotely) orfalse
if this socket is still connected to a peer.
-
-