本文整理汇总了Java中io.netty.channel.sctp.oio.OioSctpChannel类的典型用法代码示例。如果您正苦于以下问题:Java OioSctpChannel类的具体用法?Java OioSctpChannel怎么用?Java OioSctpChannel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
OioSctpChannel类属于io.netty.channel.sctp.oio包,在下文中一共展示了OioSctpChannel类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: sctpClientChannel
import io.netty.channel.sctp.oio.OioSctpChannel; //导入依赖的package包/类
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;
}
示例2: sctpClientChannel
import io.netty.channel.sctp.oio.OioSctpChannel; //导入依赖的package包/类
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;
}
示例3: run
import io.netty.channel.sctp.oio.OioSctpChannel; //导入依赖的package包/类
public void run() throws Exception {
// Configure the client.
EventLoopGroup group = new OioEventLoopGroup();
try {
Bootstrap b = new Bootstrap();
b.group(group)
.channel(OioSctpChannel.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();
}
}