redouane59 / twittered

Twitter API client for Java developers
Apache License 2.0
239 stars 66 forks source link

[main] ERROR io.github.redouane59.twitter.helpers.AbstractRequestHelper - Error occupied on executing request #455

Closed wadashinokamisama closed 10 months ago

wadashinokamisama commented 10 months ago

thank you for you great api.it is useful but i have some error what i dont konw how to solve。

the twitter token and key must be right, i had not revoked them. Connect to twitter is not problem, i dont konw the reason of "Connection timed out: connect"

this is error.

[main] ERROR io.github.redouane59.twitter.helpers.AbstractRequestHelper - Error occupied on executing request java.net.ConnectException: Connection timed out: connect at java.net.DualStackPlainSocketImpl.connect0(Native Method) at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:79) at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350) at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206) at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188) at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) at java.net.Socket.connect(Socket.java:589) at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:673) at sun.security.ssl.BaseSSLSocketImpl.connect(BaseSSLSocketImpl.java:173) at sun.net.NetworkClient.doConnect(NetworkClient.java:180) at sun.net.www.http.HttpClient.openServer(HttpClient.java:463) at sun.net.www.http.HttpClient.openServer(HttpClient.java:558) at sun.net.www.protocol.https.HttpsClient.(HttpsClient.java:264) at sun.net.www.protocol.https.HttpsClient.New(HttpsClient.java:367) at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient(AbstractDelegateHttpsURLConnection.java:191) at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1138) at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1032) at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:177) at sun.net.www.protocol.https.HttpsURLConnectionImpl.connect(HttpsURLConnectionImpl.java:153) at com.github.scribejava.core.httpclient.jdk.JDKHttpClient.doExecute(JDKHttpClient.java:138) at com.github.scribejava.core.httpclient.jdk.JDKHttpClient.execute(JDKHttpClient.java:94) at com.github.scribejava.core.oauth.OAuthService.execute(OAuthService.java:114) at io.github.redouane59.twitter.helpers.AbstractRequestHelper.makeRequest(AbstractRequestHelper.java:100) at io.github.redouane59.twitter.helpers.AbstractRequestHelper.makeRequest(AbstractRequestHelper.java:78) at io.github.redouane59.twitter.helpers.AbstractRequestHelper.makeRequest(AbstractRequestHelper.java:56) at io.github.redouane59.twitter.helpers.RequestHelper.getRequestWithParameters(RequestHelper.java:78) at io.github.redouane59.twitter.TwitterClient.getTweet(TwitterClient.java:918) at TwitterTest.main(TwitterTest.java:14) Exception in thread "main" java.util.NoSuchElementException at java.util.Optional.orElseThrow(Optional.java:290) at io.github.redouane59.twitter.TwitterClient.getTweet(TwitterClient.java:918) at TwitterTest.main(TwitterTest.java:14)

this is my code

import io.github.redouane59.twitter.TwitterClient; import io.github.redouane59.twitter.dto.tweet.Tweet; import io.github.redouane59.twitter.signature.TwitterCredentials;

public class TwitterTest { public static void main(String[] args) { TwitterClient twitterClient = new TwitterClient(TwitterCredentials.builder() .accessToken("myToken") .accessTokenSecret("mytokenSecret") .apiKey("apikey") .apiSecretKey("apikeySecret") .build());

        Tweet tweet   = twitterClient.getTweet("1741730982368289265");
        System.out.println(tweet.getText());
        System.out.println(tweet.getCreatedAt());
        System.out.println(tweet.getLang());
        System.out.println(tweet.getLikeCount());
        System.out.println(tweet.getRetweetCount());
        System.out.println(tweet.getReplyCount());
        System.out.println(tweet.getUser().getName());
}

}