org.apache.flink.shaded.netty4.io.netty.handler.codec.LengthFieldBasedFrameDecoder Java Examples

The following examples show how to use org.apache.flink.shaded.netty4.io.netty.handler.codec.LengthFieldBasedFrameDecoder. 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: ClientTest.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
private Channel createServerChannel(final ChannelHandler... handlers) throws UnknownHostException, InterruptedException {
	ServerBootstrap bootstrap = new ServerBootstrap()
			// Bind address and port
			.localAddress(InetAddress.getLocalHost(), 0)
			// NIO server channels
			.group(nioGroup)
			.channel(NioServerSocketChannel.class)
			// See initializer for pipeline details
			.childHandler(new ChannelInitializer<SocketChannel>() {
				@Override
				protected void initChannel(SocketChannel ch) throws Exception {
					ch.pipeline()
							.addLast(new LengthFieldBasedFrameDecoder(Integer.MAX_VALUE, 0, 4, 0, 4))
							.addLast(handlers);
				}
			});

	return bootstrap.bind().sync().channel();
}
 
Example #2
Source File: ClientTest.java    From flink with Apache License 2.0 6 votes vote down vote up
private Channel createServerChannel(final ChannelHandler... handlers) throws UnknownHostException, InterruptedException {
	ServerBootstrap bootstrap = new ServerBootstrap()
			// Bind address and port
			.localAddress(InetAddress.getLocalHost(), 0)
			// NIO server channels
			.group(nioGroup)
			.channel(NioServerSocketChannel.class)
			// See initializer for pipeline details
			.childHandler(new ChannelInitializer<SocketChannel>() {
				@Override
				protected void initChannel(SocketChannel ch) throws Exception {
					ch.pipeline()
							.addLast(new LengthFieldBasedFrameDecoder(Integer.MAX_VALUE, 0, 4, 0, 4))
							.addLast(handlers);
				}
			});

	return bootstrap.bind().sync().channel();
}
 
Example #3
Source File: ClientTest.java    From flink with Apache License 2.0 6 votes vote down vote up
private Channel createServerChannel(final ChannelHandler... handlers) throws UnknownHostException, InterruptedException {
	ServerBootstrap bootstrap = new ServerBootstrap()
			// Bind address and port
			.localAddress(InetAddress.getLocalHost(), 0)
			// NIO server channels
			.group(nioGroup)
			.channel(NioServerSocketChannel.class)
			// See initializer for pipeline details
			.childHandler(new ChannelInitializer<SocketChannel>() {
				@Override
				protected void initChannel(SocketChannel ch) throws Exception {
					ch.pipeline()
							.addLast(new LengthFieldBasedFrameDecoder(Integer.MAX_VALUE, 0, 4, 0, 4))
							.addLast(handlers);
				}
			});

	return bootstrap.bind().sync().channel();
}
 
Example #4
Source File: AbstractServerBase.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
@Override
protected void initChannel(SocketChannel channel) throws Exception {
	channel.pipeline()
			.addLast(new ChunkedWriteHandler())
			.addLast(new LengthFieldBasedFrameDecoder(Integer.MAX_VALUE, 0, 4, 0, 4))
			.addLast(sharedRequestHandler);
}
 
Example #5
Source File: AbstractServerBase.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
protected void initChannel(SocketChannel channel) throws Exception {
	channel.pipeline()
			.addLast(new ChunkedWriteHandler())
			.addLast(new LengthFieldBasedFrameDecoder(Integer.MAX_VALUE, 0, 4, 0, 4))
			.addLast(sharedRequestHandler);
}
 
Example #6
Source File: AbstractServerBase.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
protected void initChannel(SocketChannel channel) throws Exception {
	channel.pipeline()
			.addLast(new ChunkedWriteHandler())
			.addLast(new LengthFieldBasedFrameDecoder(Integer.MAX_VALUE, 0, 4, 0, 4))
			.addLast(sharedRequestHandler);
}
 
Example #7
Source File: KvStateServerHandlerTest.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
/**
 * Frame length decoder (expected by the serialized messages).
 */
private ChannelHandler getFrameDecoder() {
	return new LengthFieldBasedFrameDecoder(Integer.MAX_VALUE, 0, 4, 0, 4);
}
 
Example #8
Source File: KvStateServerHandlerTest.java    From flink with Apache License 2.0 4 votes vote down vote up
/**
 * Frame length decoder (expected by the serialized messages).
 */
private ChannelHandler getFrameDecoder() {
	return new LengthFieldBasedFrameDecoder(Integer.MAX_VALUE, 0, 4, 0, 4);
}
 
Example #9
Source File: KvStateServerHandlerTest.java    From flink with Apache License 2.0 4 votes vote down vote up
/**
 * Frame length decoder (expected by the serialized messages).
 */
private ChannelHandler getFrameDecoder() {
	return new LengthFieldBasedFrameDecoder(Integer.MAX_VALUE, 0, 4, 0, 4);
}