Search in sources :

Example 1 with BdyIntercept

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);
}
Also used : BdyIntercept(lee.study.down.intercept.BdyIntercept) Channel(io.netty.channel.Channel) HttpProxyIntercept(lee.study.proxyee.intercept.HttpProxyIntercept) HttpProxyExceptionHandle(lee.study.proxyee.exception.HttpProxyExceptionHandle) HttpDownSniffIntercept(lee.study.down.intercept.HttpDownSniffIntercept) HttpProxyInterceptPipeline(lee.study.proxyee.intercept.HttpProxyInterceptPipeline) HttpProxyInterceptInitializer(lee.study.proxyee.intercept.HttpProxyInterceptInitializer)

Aggregations

Channel (io.netty.channel.Channel)1 BdyIntercept (lee.study.down.intercept.BdyIntercept)1 HttpDownSniffIntercept (lee.study.down.intercept.HttpDownSniffIntercept)1 HttpProxyExceptionHandle (lee.study.proxyee.exception.HttpProxyExceptionHandle)1 HttpProxyIntercept (lee.study.proxyee.intercept.HttpProxyIntercept)1 HttpProxyInterceptInitializer (lee.study.proxyee.intercept.HttpProxyInterceptInitializer)1 HttpProxyInterceptPipeline (lee.study.proxyee.intercept.HttpProxyInterceptPipeline)1