支持HTTP、HTTPS、WebSocket,HTTPS采用动态签发证书,可以拦截http、https的报文并进行处理。
例如:http(s)协议抓包,http(s)动态替换请求内容或响应内容等等。
new NativeHttpProxyServer().start(9002);
new NettyHttpProxyServer().start(9001);
//拦截处理
new NettyHttpProxyServer().initProxyInterceptFactory(new ProxyInterceptFactory() {
@Override
public HttpProxyIntercept build() {
return new HttpProxyIntercept() {
@Override
public boolean beforeRequest(Channel channel, HttpRequest httpRequest) {
return false;
}
@Override
public boolean beforeRequest(Channel channel, HttpContent httpContent) {
return false;
}
@Override
public boolean afterResponse(Channel channel, HttpResponse httpResponse) {
//修改响应头
httpResponse.headers().set("Intercept","111");
return false;
}
@Override
public boolean afterResponse(Channel channel, HttpContent httpContent) {
return false;
}
};
}
}).start(8999);
SSL握手
HTTP通讯