Java 类io.netty.channel.sctp.oio.OioSctpServerChannel 实例源码

项目:netty4.0.27Learn    文件:SctpTestPermutation.java   
static List<BootstrapFactory<ServerBootstrap>> sctpServerChannel() {
    if (!TestUtils.isSctpSupported()) {
        return Collections.emptyList();
    }

    List<BootstrapFactory<ServerBootstrap>> list = new ArrayList<BootstrapFactory<ServerBootstrap>>();
    // Make the list of ServerBootstrap factories.
    list.add(new BootstrapFactory<ServerBootstrap>() {
        @Override
        public ServerBootstrap newInstance() {
            return new ServerBootstrap().
                    group(nioBossGroup, nioWorkerGroup).
                    channel(NioSctpServerChannel.class);
        }
    });
    list.add(new BootstrapFactory<ServerBootstrap>() {
        @Override
        public ServerBootstrap newInstance() {
            return new ServerBootstrap().
                    group(oioBossGroup, oioWorkerGroup).
                    channel(OioSctpServerChannel.class);
        }
    });

    return list;
}
项目:netty4study    文件:SctpTestPermutation.java   
static List<Factory<ServerBootstrap>> sctpServerChannel() {
    if (!TestUtils.isSctpSupported()) {
        return Collections.emptyList();
    }

    List<Factory<ServerBootstrap>> list = new ArrayList<Factory<ServerBootstrap>>();
    // Make the list of ServerBootstrap factories.
    list.add(new Factory<ServerBootstrap>() {
        @Override
        public ServerBootstrap newInstance() {
            return new ServerBootstrap().
                    group(nioBossGroup, nioWorkerGroup).
                    channel(NioSctpServerChannel.class);
        }
    });
    list.add(new Factory<ServerBootstrap>() {
        @Override
        public ServerBootstrap newInstance() {
            return new ServerBootstrap().
                    group(oioBossGroup, oioWorkerGroup).
                    channel(OioSctpServerChannel.class);
        }
    });

    return list;
}
项目:netty-netty-5.0.0.Alpha1    文件:SctpTestPermutation.java   
static List<Factory<ServerBootstrap>> sctpServerChannel() {
    if (!TestUtils.isSctpSupported()) {
        return Collections.emptyList();
    }

    List<Factory<ServerBootstrap>> list = new ArrayList<Factory<ServerBootstrap>>();
    // Make the list of ServerBootstrap factories.
    list.add(new Factory<ServerBootstrap>() {
        @Override
        public ServerBootstrap newInstance() {
            return new ServerBootstrap().
                    group(nioBossGroup, nioWorkerGroup).
                    channel(NioSctpServerChannel.class);
        }
    });
    list.add(new Factory<ServerBootstrap>() {
        @Override
        public ServerBootstrap newInstance() {
            return new ServerBootstrap().
                    group(oioBossGroup, oioWorkerGroup).
                    channel(OioSctpServerChannel.class);
        }
    });

    return list;
}
项目:netty4study    文件:OioSctpEchoServer.java   
public void run() throws Exception {
    // Configure the server.
    EventLoopGroup bossGroup = new OioEventLoopGroup();
    EventLoopGroup workerGroup = new OioEventLoopGroup();
    try {
        ServerBootstrap b = new ServerBootstrap();
        b.group(bossGroup, workerGroup)
         .channel(OioSctpServerChannel.class)
         .option(ChannelOption.SO_BACKLOG, 100)
         .handler(new LoggingHandler(LogLevel.INFO))
         .childHandler(new ChannelInitializer<SctpChannel>() {
             @Override
             public void initChannel(SctpChannel ch) throws Exception {
                 ch.pipeline().addLast(
                         new LoggingHandler(LogLevel.INFO),
                         new SctpEchoServerHandler());
             }
         });

        // Start the server.
        ChannelFuture f = b.bind(port).sync();

        // Wait until the server socket is closed.
        f.channel().closeFuture().sync();
    } finally {
        // Shut down all event loops to terminate all threads.
        bossGroup.shutdownGracefully();
        workerGroup.shutdownGracefully();
    }
}
项目:netty-netty-5.0.0.Alpha1    文件:OioSctpEchoServer.java   
public void run() throws Exception {
    // Configure the server.
    EventLoopGroup bossGroup = new OioEventLoopGroup();
    EventLoopGroup workerGroup = new OioEventLoopGroup();
    try {
        ServerBootstrap b = new ServerBootstrap();
        b.group(bossGroup, workerGroup)
         .channel(OioSctpServerChannel.class)
         .option(ChannelOption.SO_BACKLOG, 100)
         .handler(new LoggingHandler(LogLevel.INFO))
         .childHandler(new ChannelInitializer<SctpChannel>() {
             @Override
             public void initChannel(SctpChannel ch) throws Exception {
                 ch.pipeline().addLast(
                         new LoggingHandler(LogLevel.INFO),
                         new SctpEchoServerHandler());
             }
         });

        // Start the server.
        ChannelFuture f = b.bind(port).sync();

        // Wait until the server socket is closed.
        f.channel().closeFuture().sync();
    } finally {
        // Shut down all event loops to terminate all threads.
        bossGroup.shutdownGracefully();
        workerGroup.shutdownGracefully();
    }
}