io.netty.channel.rxtx.RxtxChannel Java Examples
The following examples show how to use
io.netty.channel.rxtx.RxtxChannel.
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: RxtxClient.java From netty-4.1.22 with Apache License 2.0 | 6 votes |
public static void main(String[] args) throws Exception { EventLoopGroup group = new OioEventLoopGroup(); try { Bootstrap b = new Bootstrap(); b.group(group) .channel(RxtxChannel.class) .handler(new ChannelInitializer<RxtxChannel>() { @Override public void initChannel(RxtxChannel ch) throws Exception { ch.pipeline().addLast( new LineBasedFrameDecoder(32768), new StringEncoder(), new StringDecoder(), new RxtxClientHandler() ); } }); ChannelFuture f = b.connect(new RxtxDeviceAddress(PORT)).sync(); f.channel().closeFuture().sync(); } finally { group.shutdownGracefully(); } }
Example #2
Source File: RxtxClient.java From netty4.0.27Learn with Apache License 2.0 | 6 votes |
public static void main(String[] args) throws Exception { EventLoopGroup group = new OioEventLoopGroup(); try { Bootstrap b = new Bootstrap(); b.group(group) .channel(RxtxChannel.class) .handler(new ChannelInitializer<RxtxChannel>() { @Override public void initChannel(RxtxChannel ch) throws Exception { ch.pipeline().addLast( new LineBasedFrameDecoder(32768), new StringEncoder(), new StringDecoder(), new RxtxClientHandler() ); } }); ChannelFuture f = b.connect(new RxtxDeviceAddress(PORT)).sync(); f.channel().closeFuture().sync(); } finally { group.shutdownGracefully(); } }