0

I am using the official Java client libraries (https://github.com/Asana/java-asana/) and I am frequently running into

java.net.SocketTimeoutException: Read timed out

and

java.net.SocketTimeoutException: connect timed out

problems. Is there any chance to configure those values, e.g. like done via

URLConnection.setReadTimeout

?

4

1 回答 1

0

同时,可以使用此解决方案。但是,这包括从 Asana 客户端库复制代码,这是有问题的。我创建了一个问题:https ://github.com/Asana/java-asana/issues/47

new Client(new AccessTokenDispatcher(personalAccessToken) {
    @Override
    public HttpRequest buildRequest(String method, GenericUrl url, HttpContent content) throws IOException {
        HttpRequest request = httpTransport.createRequestFactory(req -> {
            req.setConnectTimeout(connectTimeout);
            req.setReadTimeout(readTimeout);
        }).buildRequest(method, url, content);
        request.getHeaders().setAuthorization("Bearer " + personalAccessToken);
        return request;
    }
}); 
于 2017-02-03T07:31:19.147 回答