Help. I can't use twitter api


#1

I have a twitter account and I applied an application.
when I use twitter4j to access twitter api,I always receive an error as follow.
Any help is grateful. Thanks:)

twitter4j.properties

oauth.consumerKey=[myconsumerKey]
oauth.consumerSecret=[myconsumerSecret]

java code:

import twitter4j.Trends;
import twitter4j.Twitter;
import twitter4j.TwitterException;
import twitter4j.TwitterFactory;
public class Test {
public static void main(String[] args) throws TwitterException {
Twitter twitter = new TwitterFactory().getInstance();
Trends trends = twitter.getCurrentTrends();
}
}

error:

Exception in thread “main” connect timed outRelevant discussions can be on the Internet at:
http://www.google.co.jp/search?q=5014450b or
http://www.google.co.jp/search?q=405e9aad
TwitterException{exceptionCode=[5014450b-405e9aad 5014450b-405e9a83], statusCode=-1, retryAfter=-1, rateLimitStatus=null, featureSpecificRateLimitStatus=null, version=2.2.3}
at twitter4j.internal.http.HttpClientImpl.request(HttpClientImpl.java:204)
at twitter4j.internal.http.HttpClientWrapper.request(HttpClientWrapper.java:65)
at twitter4j.internal.http.HttpClientWrapper.post(HttpClientWrapper.java:102)
at twitter4j.auth.OAuthAuthorization.getOAuthRequestToken(OAuthAuthorization.java:121)
at twitter4j.auth.OAuthAuthorization.getOAuthRequestToken(OAuthAuthorization.java:104)
at twitter4j.TwitterBaseImpl.getOAuthRequestToken(TwitterBaseImpl.java:271)
at twitter4j.TwitterBaseImpl.getOAuthRequestToken(TwitterBaseImpl.java:264)
at twitter4j.examples.oauth.Test2.main(Test2.java:12)
Caused by: java.net.SocketTimeoutException: connect timed out
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
at java.net.Socket.connect(Socket.java:519)
at sun.net.NetworkClient.doConnect(NetworkClient.java:158)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:394)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:529)
at sun.net.www.http.HttpClient.(HttpClient.java:233)
at sun.net.www.http.HttpClient.New(HttpClient.java:306)
at sun.net.www.http.HttpClient.New(HttpClient.java:323)
at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:790)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:731)
at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:656)
at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:834)
at twitter4j.internal.http.HttpClientImpl.request(HttpClientImpl.java:162)
… 7 more