use of com.wing.apirecord.core.intercept.DefaultInterceptFactory in project apiRecord by tobecoder2015.
the class NettyHttpProxyServer method init.
private void init() throws Exception {
Security.addProvider(new BouncyCastleProvider());
Method method = HttpResponseStatus.class.getDeclaredMethod("newStatus", int.class, String.class);
method.setAccessible(true);
SUCCESS = (HttpResponseStatus) method.invoke(null, 200, "Connection established");
clientSslCtx = SslContextBuilder.forClient().trustManager(InsecureTrustManagerFactory.INSTANCE).build();
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
issuer = CertUtil.getSubject(classLoader.getResourceAsStream("ca.crt"));
// CA私钥和公钥用于给动态生成的网站SSL证书签证
caPriKey = CertUtil.loadPriKey(classLoader.getResourceAsStream("ca_private.pem"));
caPubKey = CertUtil.loadPubKey(classLoader.getResourceAsStream("ca_public.der"));
// 生产一对随机公私钥用于网站SSL证书动态创建
KeyPair keyPair = CertUtil.genKeyPair();
serverPriKey = keyPair.getPrivate();
serverPubKey = keyPair.getPublic();
proxyGroup = new NioEventLoopGroup();
if (proxyInterceptFactory == null) {
proxyInterceptFactory = new DefaultInterceptFactory();
}
}
Aggregations