Java 类io.netty.channel.sctp.nio.NioSctpChannel 实例源码

项目:netty-cookbook    文件:SimpleSctpClient.java   
public static void main(String[] args) throws Exception {        
    EventLoopGroup loopGroup = new NioEventLoopGroup();
    try {            
        ChannelFuture f = new Bootstrap().group(loopGroup)
         .channel(NioSctpChannel.class)
         // set SCTP option
         .option(SctpChannelOption.SCTP_NODELAY, true) 
         .handler(new ChannelInitializer<SctpChannel>() {
             @Override
             public void initChannel(SctpChannel ch) throws Exception {
                 ChannelPipeline p = ch.pipeline();
                 p.addLast(new SimpleSctpClientHandler());
             }
         }).connect(HOST, PORT).sync();            
        f.channel().closeFuture().sync();
    } finally {
        loopGroup.shutdownGracefully();
    }
}
项目:netty-cookbook    文件:SimpleSctpClient.java   
public static void main(String[] args) throws Exception {        
    EventLoopGroup loopGroup = new NioEventLoopGroup();
    try {            
        ChannelFuture f = new Bootstrap().group(loopGroup)
         .channel(NioSctpChannel.class)
         // set SCTP option
         .option(SctpChannelOption.SCTP_NODELAY, true) 
         .handler(new ChannelInitializer<SctpChannel>() {
             @Override
             public void initChannel(SctpChannel ch) throws Exception {
                 ChannelPipeline p = ch.pipeline();
                 p.addLast(new SimpleSctpClientHandler());
             }
         }).connect(HOST, PORT).sync();            
        f.channel().closeFuture().sync();
    } finally {
        loopGroup.shutdownGracefully();
    }
}
项目:netty4.0.27Learn    文件:SctpTestPermutation.java   
static List<BootstrapFactory<Bootstrap>> sctpClientChannel() {
    if (!TestUtils.isSctpSupported()) {
        return Collections.emptyList();
    }

    List<BootstrapFactory<Bootstrap>> list = new ArrayList<BootstrapFactory<Bootstrap>>();
    list.add(new BootstrapFactory<Bootstrap>() {
        @Override
        public Bootstrap newInstance() {
            return new Bootstrap().group(nioWorkerGroup).channel(NioSctpChannel.class);
        }
    });
    list.add(new BootstrapFactory<Bootstrap>() {
        @Override
        public Bootstrap newInstance() {
            return new Bootstrap().group(oioWorkerGroup).channel(OioSctpChannel.class);
        }
    });
    return list;
}
项目:netty4study    文件:SctpTestPermutation.java   
static List<Factory<Bootstrap>> sctpClientChannel() {
    if (!TestUtils.isSctpSupported()) {
        return Collections.emptyList();
    }

    List<Factory<Bootstrap>> list = new ArrayList<Factory<Bootstrap>>();
    list.add(new Factory<Bootstrap>() {
        @Override
        public Bootstrap newInstance() {
            return new Bootstrap().group(nioWorkerGroup).channel(NioSctpChannel.class);
        }
    });
    list.add(new Factory<Bootstrap>() {
        @Override
        public Bootstrap newInstance() {
            return new Bootstrap().group(oioWorkerGroup).channel(OioSctpChannel.class);
        }
    });
    return list;
}
项目:netty-netty-5.0.0.Alpha1    文件:SctpTestPermutation.java   
static List<Factory<Bootstrap>> sctpClientChannel() {
    if (!TestUtils.isSctpSupported()) {
        return Collections.emptyList();
    }

    List<Factory<Bootstrap>> list = new ArrayList<Factory<Bootstrap>>();
    list.add(new Factory<Bootstrap>() {
        @Override
        public Bootstrap newInstance() {
            return new Bootstrap().group(nioWorkerGroup).channel(NioSctpChannel.class);
        }
    });
    list.add(new Factory<Bootstrap>() {
        @Override
        public Bootstrap newInstance() {
            return new Bootstrap().group(oioWorkerGroup).channel(OioSctpChannel.class);
        }
    });
    return list;
}
项目:mpush    文件:GatewayClient.java   
@Override
public ChannelFactory<? extends Channel> getChannelFactory() {
    if (CC.mp.net.tcpGateway()) return super.getChannelFactory();
    if (CC.mp.net.udtGateway()) return NioUdtProvider.BYTE_CONNECTOR;
    if (CC.mp.net.sctpGateway()) return NioSctpChannel::new;
    return super.getChannelFactory();
}
项目:JavaAyo    文件:SctpEchoClient.java   
public static void main(String[] args) throws Exception {
    // Configure the client.
    EventLoopGroup group = new NioEventLoopGroup();
    try {
        Bootstrap b = new Bootstrap();
        b.group(group)
         .channel(NioSctpChannel.class)
         .option(SctpChannelOption.SCTP_NODELAY, true)
         .handler(new ChannelInitializer<SctpChannel>() {
             @Override
             public void initChannel(SctpChannel ch) throws Exception {
                 ch.pipeline().addLast(
                         //new LoggingHandler(LogLevel.INFO),
                         new SctpEchoClientHandler());
             }
         });

        // Start the client.
        ChannelFuture f = b.connect(HOST, PORT).sync();

        // Wait until the connection is closed.
        f.channel().closeFuture().sync();
    } finally {
        // Shut down the event loop to terminate all threads.
        group.shutdownGracefully();
    }
}
项目:netty4.0.27Learn    文件:SctpEchoClient.java   
public static void main(String[] args) throws Exception {
    // Configure the client.
    EventLoopGroup group = new NioEventLoopGroup();
    try {
        Bootstrap b = new Bootstrap();
        b.group(group)
         .channel(NioSctpChannel.class)
         .option(SctpChannelOption.SCTP_NODELAY, true)
         .handler(new ChannelInitializer<SctpChannel>() {
             @Override
             public void initChannel(SctpChannel ch) throws Exception {
                 ch.pipeline().addLast(
                         //new LoggingHandler(LogLevel.INFO),
                         new SctpEchoClientHandler());
             }
         });

        // Start the client.
        ChannelFuture f = b.connect(HOST, PORT).sync();

        // Wait until the connection is closed.
        f.channel().closeFuture().sync();
    } finally {
        // Shut down the event loop to terminate all threads.
        group.shutdownGracefully();
    }
}
项目:javase-study    文件:SctpEchoClient.java   
public static void main(String[] args) throws Exception {
    // Configure the client.
    EventLoopGroup group = new NioEventLoopGroup();
    try {
        Bootstrap b = new Bootstrap();
        b.group(group)
         .channel(NioSctpChannel.class)
         .option(SctpChannelOption.SCTP_NODELAY, true)
         .handler(new ChannelInitializer<SctpChannel>() {
             @Override
             public void initChannel(SctpChannel ch) throws Exception {
                 ch.pipeline().addLast(
                         //new LoggingHandler(LogLevel.INFO),
                         new SctpEchoClientHandler());
             }
         });

        // Start the client.
        ChannelFuture f = b.connect(HOST, PORT).sync();

        // Wait until the connection is closed.
        f.channel().closeFuture().sync();
    } finally {
        // Shut down the event loop to terminate all threads.
        group.shutdownGracefully();
    }
}
项目:netty4study    文件:NioSctpEchoClient.java   
public void run() throws Exception {
    // Configure the client.
    EventLoopGroup group = new NioEventLoopGroup();
    try {
        Bootstrap b = new Bootstrap();
        b.group(group)
         .channel(NioSctpChannel.class)
         .option(SctpChannelOption.SCTP_NODELAY, true)
         .handler(new ChannelInitializer<SctpChannel>() {
             @Override
             public void initChannel(SctpChannel ch) throws Exception {
                 ch.pipeline().addLast(
                         new LoggingHandler(LogLevel.INFO),
                         new SctpEchoClientHandler(firstMessageSize));
             }
         });

        // Start the client.
        ChannelFuture f = b.connect(host, port).sync();

        // Wait until the connection is closed.
        f.channel().closeFuture().sync();
    } finally {
        // Shut down the event loop to terminate all threads.
        group.shutdownGracefully();
    }
}
项目:netty-netty-5.0.0.Alpha1    文件:NioSctpEchoClient.java   
public void run() throws Exception {
    // Configure the client.
    EventLoopGroup group = new NioEventLoopGroup();
    try {
        Bootstrap b = new Bootstrap();
        b.group(group)
         .channel(NioSctpChannel.class)
         .option(SctpChannelOption.SCTP_NODELAY, true)
         .handler(new ChannelInitializer<SctpChannel>() {
             @Override
             public void initChannel(SctpChannel ch) throws Exception {
                 ch.pipeline().addLast(
                         new LoggingHandler(LogLevel.INFO),
                         new SctpEchoClientHandler(firstMessageSize));
             }
         });

        // Start the client.
        ChannelFuture f = b.connect(host, port).sync();

        // Wait until the connection is closed.
        f.channel().closeFuture().sync();
    } finally {
        // Shut down the event loop to terminate all threads.
        group.shutdownGracefully();
    }
}