Package org.forgerock.opendj.io
Interface RxTransport<M,S extends RxSocket<M>>
- Type Parameters:
M- The type of messages transferred by the transport.S- The type of reactive sockets exposed by the transport.
- All Superinterfaces:
AutoCloseable,Closeable
-
Method Summary
Modifier and TypeMethodDescriptiondefault voidclose()Releases any resources, such as thread pools, associated with this transport.Returns aSinglewhich will connect to the server at the provided address each time it is subscribed.listen(InetSocketAddress address, Options options) Starts listening on the provided address and returns anRxServerSocketwhich will publish incoming connections via theRxServerSocket.accept()method.
-
Method Details
-
connect
Returns aSinglewhich will connect to the server at the provided address each time it is subscribed. It is the responsibility of the application to enforce timeouts by cancelling the subscription once the timeout is reached. Application layers may return exceptions which are more closely aligned to their APIs. In addition, any initial protocol handshakes should be performed before returning the connected socket.- Parameters:
host- The hostname of the server to connect to.port- The port number of the server to connect to.options- The connection options.- Returns:
- A
Singlewhich will connect to the server at the provided address each time it is subscribed.
-
listen
@CheckReturnValue RxServerSocket<M,S> listen(InetSocketAddress address, Options options) throws IOException Starts listening on the provided address and returns anRxServerSocketwhich will publish incoming connections via theRxServerSocket.accept()method. The following example shows how it is possible to listen on multiple addresses:Flowable<S> acceptAll(List<RxServerSocket<M, S>> listeners) { return Flowable.fromIterable(listeners).flatMap(RxServerSocket::accept); }- Parameters:
address- The address to listen on.options- The acceptor options.- Returns:
- An
RxServerSocketrepresenting the network listener. - Throws:
IOException- If an error occurred while trying to listen on the provided address.
-
close
default void close()Releases any resources, such as thread pools, associated with this transport.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-