我构建了2个应用程序,一个用于移动电话(Android),可使用Firebase接收通知,另一个用于Java(桌面),从中发送通知。该应用程序运行良好,但我需要将其移动到代理后面的计算机上。如何绕过代理?
这是我尝试过的:
System.setProperty("https.proxyHost", "xxx");
System.setProperty("https.proxyPort", "1212");
System.setProperty("com.google.api.client.should_use_proxy","true");
String PROXY_HOST = System.getProperty("https.proxyHost");
int PROXY_PORT = Integer.parseInt(System.getProperty("https.proxyPort"));
Boolean PROXY_ENABLED =
Boolean.parseBoolean(System.getProperty("com.google.api.client.should_use_proxy", "false"));
ChannelPipeline p = ch.pipeline();
if (PROXY_ENABLED) {
InetSocketAddress proxySocket = new InetSocketAddress(PROXY_HOST, PROXY_PORT);
p.addFirst(new HttpProxyHandler(proxySocket));
}
//p.addLast(sslContext.newHandler(ch.alloc(), uri.getHost(), port));
//p.addLast(new HttpClientCodec(), new HttpObjectAggregator(32 * 1024), channelHandler);
这不起作用。可以请别人给我一个有效的示例,以便我可以从代理后面发送通知吗?
谢谢,祝你有美好的一天