public class TcpChannelFactory extends ChannelFactory<TcpNioServerSocketChannel,TcpNioSocketChannel>
ChannelFactory which returns channels that adhere to the
TcpChannel interface. The channels will use the provided
TcpTransport.ProfileSettings. The provided context setters will be called with the channel after
construction.| Constructor | Description |
|---|---|
TcpChannelFactory(TcpTransport.ProfileSettings profileSettings,
java.util.function.Consumer<NioSocketChannel> contextSetter,
java.util.function.Consumer<NioServerSocketChannel> serverContextSetter) |
| Modifier and Type | Method | Description |
|---|---|---|
TcpNioSocketChannel |
createChannel(SocketSelector selector,
java.nio.channels.SocketChannel channel) |
This method should return a new
NioSocketChannel implementation. |
TcpNioServerSocketChannel |
createServerChannel(AcceptingSelector selector,
java.nio.channels.ServerSocketChannel channel) |
This method should return a new
NioServerSocketChannel implementation. |
acceptNioChannel, openNioChannel, openNioServerSocketChannelpublic TcpChannelFactory(TcpTransport.ProfileSettings profileSettings, java.util.function.Consumer<NioSocketChannel> contextSetter, java.util.function.Consumer<NioServerSocketChannel> serverContextSetter)
public TcpNioSocketChannel createChannel(SocketSelector selector, java.nio.channels.SocketChannel channel) throws java.io.IOException
ChannelFactoryNioSocketChannel implementation. When this method has
returned, the channel should be fully created and setup. Read and write contexts and the channel
exception handler should have been set.createChannel in class ChannelFactory<TcpNioServerSocketChannel,TcpNioSocketChannel>selector - the channel will be registered withchannel - the raw channeljava.io.IOException - related to the creation of the channelpublic TcpNioServerSocketChannel createServerChannel(AcceptingSelector selector, java.nio.channels.ServerSocketChannel channel) throws java.io.IOException
ChannelFactoryNioServerSocketChannel implementation. When this method has
returned, the channel should be fully created and setup.createServerChannel in class ChannelFactory<TcpNioServerSocketChannel,TcpNioSocketChannel>selector - the channel will be registered withchannel - the raw channeljava.io.IOException - related to the creation of the channel