org.apache.flink.shaded.netty4.io.netty.channel.ChannelPipeline Java Examples

The following examples show how to use org.apache.flink.shaded.netty4.io.netty.channel.ChannelPipeline. 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: HttpTestClient.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
/**
 * Creates a client instance for the server at the target host and port.
 *
 * @param host Host of the HTTP server
 * @param port Port of the HTTP server
 */
public HttpTestClient(String host, int port) {
	this.host = host;
	this.port = port;

	this.group = new NioEventLoopGroup();

	this.bootstrap = new Bootstrap();
	this.bootstrap.group(group)
			.channel(NioSocketChannel.class)
			.handler(new ChannelInitializer<SocketChannel>() {

				@Override
				protected void initChannel(SocketChannel ch) throws Exception {
					ChannelPipeline p = ch.pipeline();
					p.addLast(new HttpClientCodec());
					p.addLast(new HttpContentDecompressor());
					p.addLast(new ClientHandler(responses));
				}
			});
}
 
Example #2
Source File: RouterHandler.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
private void routed(
		ChannelHandlerContext channelHandlerContext,
		RouteResult<?> routeResult,
		HttpRequest httpRequest) {
	ChannelInboundHandler handler = (ChannelInboundHandler) routeResult.target();

	// The handler may have been added (keep alive)
	ChannelPipeline pipeline     = channelHandlerContext.pipeline();
	ChannelHandler addedHandler = pipeline.get(ROUTED_HANDLER_NAME);
	if (handler != addedHandler) {
		if (addedHandler == null) {
			pipeline.addAfter(ROUTER_HANDLER_NAME, ROUTED_HANDLER_NAME, handler);
		} else {
			pipeline.replace(addedHandler, ROUTED_HANDLER_NAME, handler);
		}
	}

	RoutedRequest<?> request = new RoutedRequest<>(routeResult, httpRequest);
	channelHandlerContext.fireChannelRead(request.retain());
}
 
Example #3
Source File: HttpTestClient.java    From flink with Apache License 2.0 6 votes vote down vote up
/**
 * Creates a client instance for the server at the target host and port.
 *
 * @param host Host of the HTTP server
 * @param port Port of the HTTP server
 */
public HttpTestClient(String host, int port) {
	this.host = host;
	this.port = port;

	this.group = new NioEventLoopGroup();

	this.bootstrap = new Bootstrap();
	this.bootstrap.group(group)
			.channel(NioSocketChannel.class)
			.handler(new ChannelInitializer<SocketChannel>() {

				@Override
				protected void initChannel(SocketChannel ch) throws Exception {
					ChannelPipeline p = ch.pipeline();
					p.addLast(new HttpClientCodec());
					p.addLast(new HttpContentDecompressor());
					p.addLast(new ClientHandler(responses));
				}
			});
}
 
Example #4
Source File: RouterHandler.java    From flink with Apache License 2.0 6 votes vote down vote up
private void routed(
		ChannelHandlerContext channelHandlerContext,
		RouteResult<?> routeResult,
		HttpRequest httpRequest) {
	ChannelInboundHandler handler = (ChannelInboundHandler) routeResult.target();

	// The handler may have been added (keep alive)
	ChannelPipeline pipeline     = channelHandlerContext.pipeline();
	ChannelHandler addedHandler = pipeline.get(ROUTED_HANDLER_NAME);
	if (handler != addedHandler) {
		if (addedHandler == null) {
			pipeline.addAfter(ROUTER_HANDLER_NAME, ROUTED_HANDLER_NAME, handler);
		} else {
			pipeline.replace(addedHandler, ROUTED_HANDLER_NAME, handler);
		}
	}

	RoutedRequest<?> request = new RoutedRequest<>(routeResult, httpRequest);
	channelHandlerContext.fireChannelRead(request.retain());
}
 
Example #5
Source File: HttpTestClient.java    From flink with Apache License 2.0 6 votes vote down vote up
/**
 * Creates a client instance for the server at the target host and port.
 *
 * @param host Host of the HTTP server
 * @param port Port of the HTTP server
 */
public HttpTestClient(String host, int port) {
	this.host = host;
	this.port = port;

	this.group = new NioEventLoopGroup();

	this.bootstrap = new Bootstrap();
	this.bootstrap.group(group)
			.channel(NioSocketChannel.class)
			.handler(new ChannelInitializer<SocketChannel>() {

				@Override
				protected void initChannel(SocketChannel ch) throws Exception {
					ChannelPipeline p = ch.pipeline();
					p.addLast(new HttpClientCodec());
					p.addLast(new HttpContentDecompressor());
					p.addLast(new ClientHandler(responses));
				}
			});
}
 
Example #6
Source File: RouterHandler.java    From flink with Apache License 2.0 6 votes vote down vote up
private void routed(
		ChannelHandlerContext channelHandlerContext,
		RouteResult<?> routeResult,
		HttpRequest httpRequest) {
	ChannelInboundHandler handler = (ChannelInboundHandler) routeResult.target();

	// The handler may have been added (keep alive)
	ChannelPipeline pipeline     = channelHandlerContext.pipeline();
	ChannelHandler addedHandler = pipeline.get(ROUTED_HANDLER_NAME);
	if (handler != addedHandler) {
		if (addedHandler == null) {
			pipeline.addAfter(ROUTER_HANDLER_NAME, ROUTED_HANDLER_NAME, handler);
		} else {
			pipeline.replace(addedHandler, ROUTED_HANDLER_NAME, handler);
		}
	}

	RoutedRequest<?> request = new RoutedRequest<>(routeResult, httpRequest);
	channelHandlerContext.fireChannelRead(request.retain());
}
 
Example #7
Source File: AbstractTaskManagerFileHandlerTest.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
@Override
public ChannelPipeline pipeline() {
	return mock(ChannelPipeline.class);
}
 
Example #8
Source File: AbstractTaskManagerFileHandlerTest.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
public ChannelPipeline pipeline() {
	return mock(ChannelPipeline.class);
}
 
Example #9
Source File: AbstractTaskManagerFileHandlerTest.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
public ChannelPipeline pipeline() {
	return mock(ChannelPipeline.class);
}