io.netty.handler.codec.socks.SocksMessageEncoder Java Examples
The following examples show how to use
io.netty.handler.codec.socks.SocksMessageEncoder.
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: XClient.java From AgentX with Apache License 2.0 | 5 votes |
public void start() { Configuration config = Configuration.INSTANCE; InternalLoggerFactory.setDefaultFactory(Slf4JLoggerFactory.INSTANCE); bossGroup = new NioEventLoopGroup(1); workerGroup = new NioEventLoopGroup(); try { ServerBootstrap bootstrap = new ServerBootstrap(); bootstrap.group(bossGroup, workerGroup) .channel(NioServerSocketChannel.class) .childHandler(new ChannelInitializer<SocketChannel>() { @Override protected void initChannel(SocketChannel socketChannel) throws Exception { socketChannel.pipeline() .addLast("logging", new LoggingHandler(LogLevel.DEBUG)) .addLast(new SocksInitRequestDecoder()) .addLast(new SocksMessageEncoder()) .addLast(new Socks5Handler()) .addLast(Status.TRAFFIC_HANDLER); } }); log.info("\tStartup {}-{}-client [{}{}]", Constants.APP_NAME, Constants.APP_VERSION, config.getMode(), config.getMode().equals("socks5") ? "" : ":" + config.getProtocol()); new Thread(() -> new UdpServer().start()).start(); ChannelFuture future = bootstrap.bind(config.getLocalHost(), config.getLocalPort()).sync(); future.addListener(future1 -> log.info("\tTCP listening at {}:{}...", config.getLocalHost(), config.getLocalPort())); future.channel().closeFuture().sync(); } catch (Exception e) { log.error("\tSocket bind failure ({})", e.getMessage()); } finally { log.info("\tShutting down"); bossGroup.shutdownGracefully(); workerGroup.shutdownGracefully(); } }
Example #2
Source File: SocksServerInitializer.java From NSS with Apache License 2.0 | 4 votes |
public SocksServerInitializer(Config config, GlobalTrafficShapingHandler trafficHandler) { this.trafficHandler = trafficHandler; socksMessageEncoder = new SocksMessageEncoder(); socksServerHandler = new SocksServerHandler(config); }