如何使 twilio 与 Java 中的代理一起使用 [英] How to make twilio work with a proxy in java

查看:57
本文介绍了如何使 twilio 与 Java 中的代理一起使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们的应用程序是基于 Java 的 Web 应用程序.在这种情况下,我们无法直接访问第三方 api https://api.twilio.com这必须通过代理来完成.谁能告诉我如何为 TwilioRestClient 实现它?

Our application is java based web application. We cannot access third party api directly in this case https://api.twilio.com This has to be done through a proxy. Can anyone tell me how can I achieve it for TwilioRestClient?

推荐答案

您可以使用 TwilioRestClient.getHttpClient() 方法并像这样设置您的代理参数:

You can use the .getHttpClient() method of TwilioRestClient and set your proxy parameters like this:

final TwilioRestClient client = new TwilioRestClient(ACCOUNT_SID, AUTH_TOKEN);
client.getHttpClient().getHostConfiguration().setProxy(PROXY_HOST, PROXY_PORT);

这篇关于如何使 twilio 与 Java 中的代理一起使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆