Package io.bytestreams.exchange.core
Class ServerSocketTransportFactory
java.lang.Object
io.bytestreams.exchange.core.ServerSocketTransportFactory
- All Implemented Interfaces:
TransportFactory,Closeable,AutoCloseable
public final class ServerSocketTransportFactory
extends Object
implements TransportFactory, Closeable
A
TransportFactory that accepts incoming TCP connections on a ServerSocket.
Each call to create() blocks until a client connects, applies the SocketConfigurator to the accepted socket, and returns a SocketTransport.
The factory owns the ServerSocket and binds it eagerly in ServerSocketTransportFactory.Builder.build().
Close the factory to stop accepting connections.
Use builder(int) to configure the bind address, backlog, and socket options.
-
Nested Class Summary
Nested Classes -
Method Summary
-
Method Details
-
builder
-
port
public int port()Returns the local port this factory is bound to. -
create
Description copied from interface:TransportFactoryCreates a new transport.- Specified by:
createin interfaceTransportFactory- Returns:
- the new transport
- Throws:
IOException- if the transport cannot be created
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-