Example usage for io.netty.handler.codec.socks SocksInitRequestDecoder SocksInitRequestDecoder

List of usage examples for io.netty.handler.codec.socks SocksInitRequestDecoder SocksInitRequestDecoder

Introduction

In this page you can find the example usage for io.netty.handler.codec.socks SocksInitRequestDecoder SocksInitRequestDecoder.

Prototype

public SocksInitRequestDecoder() 

Source Link

Usage

From source file:cc.agentx.client.net.nio.XClient.java

License:Apache License

public void start() {
    Configuration config = Configuration.INSTANCE;
    InternalLoggerFactory.setDefaultFactory(Slf4JLoggerFactory.INSTANCE);
    bossGroup = new NioEventLoopGroup(1);
    workerGroup = new NioEventLoopGroup();
    try {//from  w  w w. j av  a  2 s  .  c om
        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());
        ChannelFuture future = bootstrap.bind(config.getLocalHost(), config.getLocalPort()).sync();
        future.addListener(
                future1 -> log.info("\tListening 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();
    }
}

From source file:cn.david.socks.SocksServerInitializer.java

License:Apache License

@Override
public void initChannel(SocketChannel socketChannel) throws Exception {
    ChannelPipeline p = socketChannel.pipeline();
    p.addLast(new SocksInitRequestDecoder());
    p.addLast(socksMessageEncoder);/*from  www .  j  a v a2  s .c  o  m*/
    p.addLast(socksServerHandler);
}

From source file:com.github.sinsinpub.pero.frontend.SocksServerInitializer.java

License:Apache License

@Override
public void initChannel(SocketChannel socketChannel) throws Exception {
    ChannelPipeline p = socketChannel.pipeline();
    p.addLast(new SocksInitRequestDecoder());
    p.addLast(new SocksMessageEncoder());
    p.addLast(socksServerHandler);/*from  w  w  w.  j av a 2 s.  co m*/
}

From source file:com.gxkj.demo.netty.socksproxy.SocksServerInitializer.java

License:Apache License

@Override
public void initChannel(SocketChannel socketChannel) throws Exception {
    ChannelPipeline channelPipeline = socketChannel.pipeline();

    channelPipeline.addLast(SocksInitRequestDecoder.getName(), new SocksInitRequestDecoder());

    channelPipeline.addLast(SocksMessageEncoder.getName(), socksMessageEncoder);

    channelPipeline.addLast(SocksServerHandler.getName(), socksServerHandler);
}

From source file:com.qq.servlet.demo.netty.sample.socksproxy.SocksServerInitializer.java

License:Apache License

@Override
public void initChannel(SocketChannel socketChannel) throws Exception {
    ChannelPipeline channelPipeline = socketChannel.pipeline();
    channelPipeline.addLast(SocksInitRequestDecoder.getName(), new SocksInitRequestDecoder());
    channelPipeline.addLast(SocksMessageEncoder.getName(), socksMessageEncoder);
    channelPipeline.addLast(SocksServerHandler.getName(), socksServerHandler);
}

From source file:com.xx_dev.apn.socks.remote.SocksServerInitializer.java

License:Apache License

@Override
public void initChannel(SocketChannel socketChannel) throws Exception {
    ChannelPipeline p = socketChannel.pipeline();

    p.addLast(new FakeHttpServerDecoder());
    p.addLast(new FakeHttpServerEncoder());

    p.addLast("log", new LoggingHandler("BYTE_LOGGER", LogLevel.DEBUG));

    p.addLast(new SocksInitRequestDecoder());
    p.addLast(socksMessageEncoder);//from  ww  w  . j  a va  2s.co  m
    p.addLast(socksServerHandler);
}