下面列出了怎么用 io.netty.handler.codec.socksx.SocksPortUnificationServerHandler 的API类实例代码及写法,或者点击链接到github查看源代码。
@Override
public void initChannel(SocketChannel ch) throws Exception {
ch.pipeline().addLast(
new LoggingHandler(LogLevel.DEBUG),
new SocksPortUnificationServerHandler(),
SocksServerHandler.INSTANCE);
}
@Override
public void initChannel(SocketChannel ch) throws Exception {
ch.pipeline().addLast(
// new LoggingHandler(LogLevel.INFO),
new SocksPortUnificationServerHandler(),
SocksServerHandler.INSTANCE);
}
@Override
public void handlerAdded(ChannelHandlerContext ctx) throws Exception {
LOGGER.info("{} : handlerAdded", connectionInfo.toString(true));
Socks5ServerEncoder socks5ServerEncoder = new Socks5ServerEncoder(Socks5AddressEncoder.DEFAULT);
SocksPortUnificationServerHandler socksPortUnificationServerHandler = new SocksPortUnificationServerHandler(socks5ServerEncoder);
ctx.pipeline().addBefore(ctx.name(), null, socksPortUnificationServerHandler);
}
@Override
protected void configure(Channel ch) throws Exception {
ch.pipeline().addLast(new SocksPortUnificationServerHandler());
ch.pipeline().addLast(DYNAMIC_HANDLER);
ch.pipeline().addLast(new Socks4ProxyServerHandler());
ch.pipeline().addLast(new Socks5ProxyServerHandler());
ch.pipeline().addLast(new IntermediaryProxyServerHandler("socks"));
}