使用java库的Twilio Rest Client抛出ConnectionTimeoutException

时间:2015-08-05 15:02:39

标签: java rest twilio

我正在尝试使用jar twilio-java-sdk-4.4.5-jar-with-dependencies.jar连接到Twilio Rest webservice。我正在使用网站上提到的客户端示例

public class SmsSender {

      /* Find your sid and token at twilio.com/user/account */
    public static final String ACCOUNT_SID = "AC47e53d";
    public static final String AUTH_TOKEN = "aaea182";

    public static void main(String[] args) throws TwilioRestException {

        TwilioRestClient client = new TwilioRestClient(ACCOUNT_SID, AUTH_TOKEN);

        Account account = client.getAccount();

        MessageFactory messageFactory = (MessageFactory) account.getMessageFactory();
        List<NameValuePair> params = new ArrayList<NameValuePair>();
        params.add(new BasicNameValuePair("To", "+14087478523")); // Replace with a valid phone number for your account.
        params.add(new BasicNameValuePair("From", "+13122486323")); // Replace with a valid phone number for your account.
        params.add(new BasicNameValuePair("Body", "Where's Wallace?"));
        Message sms = messageFactory.create(params);
    }
}

当我运行休息客户端时,我正在

ConnectionTimeout exception
Caused by: org.apache.http.conn.ConnectTimeoutException: Connect to api.twilio.com:443 timed out.

任何人都遇到类似的问题,可以提出解决方案吗?

0 个答案:

没有答案