Class ChannelFactory<ServerSocket extends NioServerSocketChannel,​Socket extends NioSocketChannel>

    • Constructor Detail

      • ChannelFactory

        protected ChannelFactory​(ChannelFactory.RawChannelFactory rawChannelFactory)
        This will create a ChannelFactory using the raw channel factory passed to the constructor.
        Parameters:
        rawChannelFactory - a factory that will construct the raw socket channels
    • Method Detail

      • openNioChannel

        public Socket openNioChannel​(java.net.InetSocketAddress remoteAddress,
                                     java.util.function.Supplier<NioSelector> supplier)
                              throws java.io.IOException
        Throws:
        java.io.IOException
      • acceptNioChannel

        public Socket acceptNioChannel​(ServerChannelContext serverContext,
                                       java.util.function.Supplier<NioSelector> supplier)
                                throws java.io.IOException
        Throws:
        java.io.IOException
      • openNioServerSocketChannel

        public ServerSocket openNioServerSocketChannel​(java.net.InetSocketAddress address,
                                                       java.util.function.Supplier<NioSelector> supplier)
                                                throws java.io.IOException
        Throws:
        java.io.IOException
      • createChannel

        public abstract Socket createChannel​(NioSelector selector,
                                             java.nio.channels.SocketChannel channel)
                                      throws java.io.IOException
        This method should return a new NioSocketChannel 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.
        Parameters:
        selector - the channel will be registered with
        channel - the raw channel
        Returns:
        the channel
        Throws:
        java.io.IOException - related to the creation of the channel
      • createServerChannel

        public abstract ServerSocket createServerChannel​(NioSelector selector,
                                                         java.nio.channels.ServerSocketChannel channel)
                                                  throws java.io.IOException
        This method should return a new NioServerSocketChannel implementation. When this method has returned, the channel should be fully created and setup.
        Parameters:
        selector - the channel will be registered with
        channel - the raw channel
        Returns:
        the server channel
        Throws:
        java.io.IOException - related to the creation of the channel