io.netty.channel.sctp.nio.NioSctpChannel Java Examples
The following examples show how to use
io.netty.channel.sctp.nio.NioSctpChannel.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SctpTestPermutation.java From netty-4.1.22 with Apache License 2.0 | 6 votes |
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; }
Example #2
Source File: SctpTestPermutation.java From netty4.0.27Learn with Apache License 2.0 | 6 votes |
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; }
Example #3
Source File: SimpleSctpClient.java From netty-cookbook with Apache License 2.0 | 6 votes |
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(); } }
Example #4
Source File: SimpleSctpClient.java From netty-cookbook with Apache License 2.0 | 6 votes |
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(); } }
Example #5
Source File: SctpEchoClient.java From netty-4.1.22 with Apache License 2.0 | 5 votes |
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(); } }
Example #6
Source File: GatewayClient.java From mpush with Apache License 2.0 | 5 votes |
@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(); }
Example #7
Source File: SctpEchoClient.java From netty4.0.27Learn with Apache License 2.0 | 5 votes |
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(); } }