xin.alum.aim.server.PortUnificationHandshake Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of aim-starter Show documentation
Show all versions of aim-starter Show documentation
aim-starter 基于netty的WebSocket和Socket通信包
package xin.alum.aim.server;
import xin.alum.aim.AIM;
import xin.alum.aim.config.DataAgreement;
import xin.alum.aim.socks.SocksServerHandler;
import xin.alum.aim.socks.SocksServerInitializer;
import xin.alum.aim.websocks.WebSocketServerInitializer;
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelPipeline;
import io.netty.handler.codec.ByteToMessageDecoder;
import io.netty.handler.codec.http.FullHttpRequest;
import io.netty.util.internal.logging.InternalLogger;
import io.netty.util.internal.logging.InternalLoggerFactory;
import java.util.List;
/**
* 统一端口服务处理器[协议握手]
*
* 使用同一个端口去处理TCP/HTTP协议的请求,因为HTTP的底层协议也是TCP,因此可以在此处理器内部可以通过解析部分数据
* 来判断请求是TCP请求还是HTTP请求,然使用动态的pipeline切换
*
* @author Succy
* create on 2020/11/19
*/
public class PortUnificationHandshake extends ByteToMessageDecoder {
private static final InternalLogger logger =
InternalLoggerFactory.getInstance(PortUnificationHandshake.class);
@Override
protected void decode(ChannelHandlerContext ctx, ByteBuf in, List