use of io.netty.handler.codec.socksx.SocksPortUnificationServerHandler in project cdap by caskdata.
the class ServiceSocksProxy method startUp.
@Override
protected void startUp() throws Exception {
ServerBootstrap bootstrap = new ServerBootstrap();
// We don't perform any blocking task in the proxy, only IO relying, hence doesn't need large amount of threads.
eventLoopGroup = new NioEventLoopGroup(10, Threads.createDaemonThreadFactory("service-socks-proxy-%d"));
bootstrap.group(eventLoopGroup).channel(NioServerSocketChannel.class).childHandler(new ChannelInitializer<SocketChannel>() {
@Override
protected void initChannel(SocketChannel ch) {
channelGroup.add(ch);
ch.pipeline().addLast(new SocksPortUnificationServerHandler()).addLast(new ServiceSocksServerHandler(discoveryServiceClient, authenticator));
}
});
Channel serverChannel = bootstrap.bind(InetAddress.getLoopbackAddress(), 0).sync().channel();
bindAddress = (InetSocketAddress) serverChannel.localAddress();
channelGroup = new DefaultChannelGroup(ImmediateEventExecutor.INSTANCE);
channelGroup.add(serverChannel);
LOG.info("Runtime service socks proxy started on {}", bindAddress);
}
use of io.netty.handler.codec.socksx.SocksPortUnificationServerHandler in project cdap by cdapio.
the class ServiceSocksProxy method startUp.
@Override
protected void startUp() throws Exception {
ServerBootstrap bootstrap = new ServerBootstrap();
// We don't perform any blocking task in the proxy, only IO relying, hence doesn't need large amount of threads.
eventLoopGroup = new NioEventLoopGroup(10, Threads.createDaemonThreadFactory("service-socks-proxy-%d"));
bootstrap.group(eventLoopGroup).channel(NioServerSocketChannel.class).childHandler(new ChannelInitializer<SocketChannel>() {
@Override
protected void initChannel(SocketChannel ch) {
channelGroup.add(ch);
ch.pipeline().addLast(new SocksPortUnificationServerHandler()).addLast(new ServiceSocksServerHandler(discoveryServiceClient, authenticator));
}
});
Channel serverChannel = bootstrap.bind(InetAddress.getLoopbackAddress(), 0).sync().channel();
bindAddress = (InetSocketAddress) serverChannel.localAddress();
channelGroup = new DefaultChannelGroup(ImmediateEventExecutor.INSTANCE);
channelGroup.add(serverChannel);
LOG.info("Runtime service socks proxy started on {}", bindAddress);
}
Aggregations