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

?

Peter Rietzler
  • 471
  • 5
  • 11

1 Answers1

0

For the meantime, this solution can be used. This however, includes copying code from the Asana client libraries, which is problematic. I've created an issue: 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;
    }
}); 
Peter Rietzler
  • 471
  • 5
  • 11
  • Thanks, Peter! We'll take a look at the issue and figure out how we might add a configuration setting to do this without copying out the original code. – Matt Feb 13 '17 at 19:29