Example usage for io.netty.handler.logging LogLevel DEBUG

List of usage examples for io.netty.handler.logging LogLevel DEBUG

Introduction

In this page you can find the example usage for io.netty.handler.logging LogLevel DEBUG.

Prototype

LogLevel DEBUG

To view the source code for io.netty.handler.logging LogLevel DEBUG.

Click Source Link

Usage

From source file:com.xx_dev.apn.proxy.ApnProxyServerChannelInitializer.java

License:Apache License

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

    pipeline.addLast("idlestate", new IdleStateHandler(0, 0, 3, TimeUnit.MINUTES));
    pipeline.addLast("idlehandler", new ApnProxyIdleHandler());

    pipeline.addLast("datalog", new LoggingHandler("PRE_BYTE_LOGGER", LogLevel.DEBUG));

    if (ApnProxyConfig.getConfig().getListenType() == ApnProxyListenType.SSL) {
        SSLEngine engine = ApnProxySSLContextFactory.createServerSSLSSLEngine();
        pipeline.addLast("apnproxy.encrypt", new SslHandler(engine));
    } else if (ApnProxyConfig.getConfig().getListenType() == ApnProxyListenType.AES) {
        byte[] key = ApnProxyConfig.getConfig().getKey();
        byte[] iv = ApnProxyConfig.getConfig().getIv();
        pipeline.addLast("apnproxy.encrypt", new ApnProxyAESEncoder(key, iv));
        pipeline.addLast("apnproxy.decrypt", new ApnProxyAESDecoder(key, iv));
    }// www  . j  av  a  2  s  .c o m

    pipeline.addLast("log", new LoggingHandler("BYTE_LOGGER", LogLevel.INFO));

    pipeline.addLast("codec", new HttpServerCodec());

    pipeline.addLast(ApnProxyPreHandler.HANDLER_NAME, new ApnProxyPreHandler());

    pipeline.addLast(ApnProxySchemaHandler.HANDLER_NAME, new ApnProxySchemaHandler());

}

From source file:com.xx_dev.apn.socks.local.PortForwardProxyFrontendInitializer.java

License:Apache License

@Override
public void initChannel(SocketChannel ch) throws SSLException {
    ch.pipeline().addLast(new LoggingHandler("BYTE_LOGGER", LogLevel.DEBUG));
    ch.pipeline().addLast(new PortForwardProxyFrontendHandler(remoteHost, remotePort));
}

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

License:Apache License

public static void main(String[] args) throws Exception {
    EventLoopGroup bossGroup = new NioEventLoopGroup(1);
    EventLoopGroup workerGroup = new NioEventLoopGroup();
    try {/*from  www . j a v a2s.  c  o  m*/
        ServerBootstrap b = new ServerBootstrap();
        b.group(bossGroup, workerGroup).channel(NioServerSocketChannel.class)
                .handler(new LoggingHandler("NET_LOGGER", LogLevel.DEBUG))
                .childHandler(new SocksServerInitializer());
        b.bind(RemoteConfig.ins().getListenPort()).sync().channel().closeFuture().sync();
    } finally {
        bossGroup.shutdownGracefully();
        workerGroup.shutdownGracefully();
    }
}

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);//  w w w.java  2 s.c  o  m
    p.addLast(socksServerHandler);
}

From source file:com.xx_dev.apn.socks.test.SocksClientInitializer.java

License:Apache License

@Override
protected void initChannel(SocketChannel socketChannel) throws Exception {
    ChannelPipeline p = socketChannel.pipeline();
    p.addLast("log", new LoggingHandler("BYTE_LOGGER", LogLevel.DEBUG));
    p.addLast(new SocksInitResponseDecoder());
    p.addLast(new SocksMessageEncoder());
    p.addLast(new SocksClientHandler());
}

From source file:com.xx_dev.port_forwared.HexDumpProxy.java

License:Apache License

public static void main(String[] args) throws Exception {

    EventLoopGroup bossGroup = new NioEventLoopGroup(1);
    EventLoopGroup workerGroup = new NioEventLoopGroup();

    List<HexDumpForwardRule> ruleList = new ArrayList<HexDumpForwardRule>();
    HexDumpForwardRule r3 = new HexDumpForwardRule(9000, "imap.gmail.com", 993, true);
    ruleList.add(r3);/*from  www  .ja  v  a  2s .  c  o m*/
    HexDumpForwardRule r4 = new HexDumpForwardRule(9001, "smtp.gmail.com", 465, true);
    ruleList.add(r4);

    List<ChannelFuture> bindFutureList = new ArrayList<ChannelFuture>();

    try {
        for (HexDumpForwardRule r : ruleList) {

            ServerBootstrap b = new ServerBootstrap();
            ChannelFuture bindFuture = b.group(bossGroup, workerGroup).channel(NioServerSocketChannel.class)
                    .handler(new LoggingHandler("BYTE_LOGGER", LogLevel.DEBUG))
                    .childHandler(
                            new HexDumpProxyInitializer(r.getRemoteHost(), r.getRemotePort(), r.isRemoteSsl()))
                    .childOption(ChannelOption.AUTO_READ, false).bind(r.getLocalPort());

            bindFutureList.add(bindFuture);

        }
        for (ChannelFuture f : bindFutureList) {
            f.sync().channel().closeFuture().sync();
        }
    } finally {
        bossGroup.shutdownGracefully();
        workerGroup.shutdownGracefully();
    }

}

From source file:com.zbum.example.socket.server.Application.java

License:Apache License

@SuppressWarnings("unchecked")
@Bean(name = "serverBootstrap")
public ServerBootstrap bootstrap() {
    ServerBootstrap b = new ServerBootstrap();
    b.group(bossGroup(), workerGroup()).channel(NioServerSocketChannel.class)
            .handler(new LoggingHandler(LogLevel.DEBUG)).childHandler(somethingChannelInitializer);
    Map<ChannelOption<?>, Object> tcpChannelOptions = tcpChannelOptions();
    Set<ChannelOption<?>> keySet = tcpChannelOptions.keySet();
    for (@SuppressWarnings("rawtypes")
    ChannelOption option : keySet) {/*from  www . j  a va  2  s  . c o  m*/
        b.option(option, tcpChannelOptions.get(option));
    }
    return b;
}

From source file:de.dfki.kiara.http.HttpClientInitializer.java

License:Open Source License

@Override
public void initChannel(SocketChannel ch) {
    ChannelPipeline p = ch.pipeline();//from w  w w.  j av a  2s  .  co m
    // Enable HTTPS if necessary.
    if (sslCtx != null) {
        p.addLast(sslCtx.newHandler(ch.alloc()));
    }
    p.addLast("logger", new LoggingHandler(LogLevel.DEBUG));
    p.addLast(new HttpClientCodec());
    // Remove the following line if you don't want automatic content decompression.
    p.addLast(new HttpContentDecompressor());
    // Uncomment the following line if you don't want to handle HttpContents.
    //p.addLast(new HttpObjectAggregator(1048576));
    p.addLast(handler);
}

From source file:de.dfki.kiara.http.HttpServerInitializer.java

License:Open Source License

@Override
public void initChannel(SocketChannel ch) {
    ChannelPipeline p = ch.pipeline();// ww w  .j  av a  2 s.c  o  m
    // Enable HTTPS if necessary.
    if (sslCtx != null) {
        p.addLast(sslCtx.newHandler(ch.alloc()));
    }
    p.addLast("logger", new LoggingHandler(LogLevel.DEBUG));
    p.addLast(new HttpRequestDecoder());
    // Uncomment the following line if you don't want to handle HttpChunks.
    //p.addLast(new HttpObjectAggregator(1048576));
    p.addLast(new HttpResponseEncoder());
    // Remove the following line if you don't want automatic content compression.
    //p.addLast(new HttpContentCompressor());
    p.addLast("aggregator", new HttpObjectAggregator(1048576));
    p.addLast(new HttpHandler(transport, connectionListener));
}

From source file:de.dfki.kiara.tcp.TcpClientInitializer.java

License:Open Source License

@Override
public void initChannel(SocketChannel ch) {
    ChannelPipeline p = ch.pipeline();//w  w w  .  j a  v a 2s.  co  m
    // Enable TCPS if necessary.
    if (sslCtx != null) {
        p.addLast(sslCtx.newHandler(ch.alloc()));
    }
    p.addLast("logger", new LoggingHandler(LogLevel.DEBUG));

    p.addLast(new LengthFieldBasedFrameDecoder(ByteOrder.LITTLE_ENDIAN, Integer.MAX_VALUE, 0, 4, 0, 4, true));
    p.addLast(new ByteBufferDecoder());

    p.addLast(new LengthFieldPrepender(4, 0, false) {
        @Override
        protected void encode(ChannelHandlerContext ctx, ByteBuf msg, ByteBuf out) throws Exception {
            ByteBuf outWithLittleEndian = out.order(ByteOrder.LITTLE_ENDIAN);
            super.encode(ctx, msg, outWithLittleEndian);
        }
    });
    p.addLast(new ByteBufferEncoder());
    p.addLast(handler);
}