尝试连接 JIRA Java Rest API 时获取 SocketTimeoutException。请找到下面给出的堆栈跟踪和示例代码。
示例代码:-
JiraRestClientFactory factory = new AsynchronousJiraRestClientFactory();
URI uri = new URI("https://XXXXX.atlassian.net");
client = factory.createWithBasicHttpAuthentication(uri, "XXXXX", "XXXXX");
final Issue issue1 = client.getIssueClient().getIssue("UST-761").claim();
堆栈跟踪:-
java.lang.RuntimeException: java.net.SocketTimeoutException
at com.google.common.base.Throwables.propagate(Throwables.java:156)
at com.atlassian.httpclient.apache.httpcomponents.DefaultHttpClient$3.apply(DefaultHttpClient.java:256)
at com.atlassian.httpclient.apache.httpcomponents.DefaultHttpClient$3.apply(DefaultHttpClient.java:249)
at com.atlassian.util.concurrent.Promises$Of$2.apply(Promises.java:276)
at com.atlassian.util.concurrent.Promises$Of$2.apply(Promises.java:272)
at com.atlassian.util.concurrent.Promises$2.onFailure(Promises.java:167)
at com.google.common.util.concurrent.Futures$7.run(Futures.java:1074)
引起:java.net.SocketTimeoutException
at org.apache.http.nio.pool.RouteSpecificPool.timeout(RouteSpecificPool.java:170)
at org.apache.http.nio.pool.AbstractNIOConnPool.requestTimeout(AbstractNIOConnPool.java:403)
at org.apache.http.nio.pool.AbstractNIOConnPool$InternalSessionRequestCallback.timeout(AbstractNIOConnPool.java:593)
at org.apache.http.impl.nio.reactor.SessionRequestImpl.timeout(SessionRequestImpl.java:180)
at org.apache.http.impl.nio.reactor.DefaultConnectingIOReactor.processTimeouts(DefaultConnectingIOReactor.java:214)