Skip to content

Conversation

@konard
Copy link

@konard konard commented Dec 1, 2025

Summary

This PR adds the ability to configure connectTimeout and readTimeout for HTTP connections on a per-request basis through ConfigurationParameters. This solves issue #41 where timeouts could only be set by overwriting the global static httpHelper instance.

Changes

  • Add connectTimeout and readTimeout fields to ConfigurationParameters with getters/setters
  • Add overloaded getHttpsURLConnection(URL url, Integer connectTimeout, Integer readTimeout) method in HttpHelper
  • Pass timeout configuration through both OAuth1 and OAuth2 request flows in EmailageClient
  • Update OAuth2Wrapper.doOAuth2Request() and getAccessToken() to accept timeout parameters
  • Add unit tests for timeout configuration

Usage Example

ConfigurationParameters parameters = new ConfigurationParameters();
parameters.setUserEmail("user@example.com");
parameters.setAcccountToken("token");
parameters.setAccountSecret("secret");
parameters.setEnvironment(Enums.Environment.Sandbox);
parameters.setHashAlgorithm(Enums.SignatureMethod.HMAC_SHA256);
parameters.setResultFormat(Enums.Format.Json);

// New timeout configuration - per-request, no global state changes
parameters.setConnectTimeout(5000);  // 5 seconds
parameters.setReadTimeout(10000);    // 10 seconds

EmailageResponse result = EmailageClient.QueryEmail("test@example.com", parameters);

Test plan

  • Unit tests verify timeout parameters are passed through the call chain
  • Existing tests still pass (HttpHelperTest: 3/3 passing)
  • Code compiles successfully

Note: Some pre-existing tests fail due to Java 21 incompatibility with JaCoCo 0.8.6 and PowerMock (module access restrictions). This is an environmental issue unrelated to these changes.

Fixes #41

🤖 Generated with Claude Code

konard and others added 2 commits December 1, 2025 15:38
Adding CLAUDE.md with task information for AI processing.
This file will be removed when the task is complete.

Issue: emailage#41
This adds the ability to configure connectTimeout and readTimeout for HTTP
connections on a per-request basis through ConfigurationParameters, solving
the issue where timeouts could only be set by overwriting the global static
httpHelper instance.

Changes:
- Add connectTimeout and readTimeout fields to ConfigurationParameters
- Add overloaded getHttpsURLConnection method in HttpHelper that accepts timeout params
- Pass timeout configuration through OAuth1 and OAuth2 request flows
- Add unit tests for timeout configuration

Fixes emailage#41

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@konard konard changed the title [WIP] Impossible to set connection timeouts without overwriting global state Add connection timeout configuration to ConfigurationParameters Dec 1, 2025
@konard konard marked this pull request as ready for review December 1, 2025 15:50
@konard
Copy link
Author

konard commented Dec 1, 2025

🤖 Solution Draft Log

This log file contains the complete execution trace of the AI solution draft process.

💰 Cost estimation:

  • Public pricing estimate: $5.092966 USD
  • Calculated by Anthropic: $3.544156 USD
  • Difference: $-1.548810 (-30.41%)
    📎 Log file uploaded as GitHub Gist (777KB)
    🔗 View complete solution draft log

Now working session is ended, feel free to review and add any feedback on the solution draft.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Impossible to set connection timeouts without overwriting global state

1 participant