use of lee.study.down.intercept.BdyIntercept in project proxyee-down by monkeyWie.
the class HttpDownProxyServer method start.
public void start(int port) {
LOGGER.debug("HttpDownProxyServer listen " + port + "\tproxyConfig:" + proxyConfig);
// 监听http下载请求
proxyServer.proxyConfig(proxyConfig);
proxyServer.proxyInterceptInitializer(new HttpProxyInterceptInitializer() {
@Override
public void init(HttpProxyInterceptPipeline pipeline) {
pipeline.addLast(new BdyIntercept());
pipeline.addLast(new HttpDownSniffIntercept());
HttpProxyIntercept downIntercept = interceptFactory.create();
if (downIntercept != null) {
pipeline.addLast(downIntercept);
}
}
}).httpProxyExceptionHandle(new HttpProxyExceptionHandle() {
@Override
public void beforeCatch(Channel clientChannel, Throwable cause) throws Exception {
LOGGER.warn("beforeCatch:", cause);
}
@Override
public void afterCatch(Channel clientChannel, Channel proxyChannel, Throwable cause) throws Exception {
LOGGER.warn("afterCatch:", cause);
}
}).start(port);
}
Aggregations