Skip to content

feat(java): add TCP/TLS integration tests and examples#2823

Open
atharvalade wants to merge 7 commits intoapache:masterfrom
atharvalade:java-tcp-tls-tests-examples
Open

feat(java): add TCP/TLS integration tests and examples#2823
atharvalade wants to merge 7 commits intoapache:masterfrom
atharvalade:java-tcp-tls-tests-examples

Conversation

@atharvalade
Copy link
Contributor

Which issue does this PR close?

Closes #2805

Rationale

The Java SDK had TLS builder methods but no integration tests connecting to a TLS server and no TLS examples.

What changed?

Existing tests only verified TLS builder method chaining but never actually connected to a TLS server.

Added TlsConnectionTest integration test using Testcontainers with TLS certificates mounted from core/certs/. Tests cover: TLS connection with CA cert, TLS connection with server cert, plain TCP failure when TLS is required, and full send/receive message flow over TLS. Added TcpTlsProducer and TcpTlsConsumer examples using IggyTcpClient.builder().enableTls().tlsCertificate(...).

Local Execution

Passed. spotlessCheck and compileJava/compileTestJava clean in both examples/java and foreign/java.

AI Usage

  1. Opus 4.6
  2. guided by existing GettingStarted examples, BaseIntegrationTest, and C# TLS test patterns
  3. Compiled and linted locally, verified code follows existing patterns exactly
  4. Yes

@atharvalade
Copy link
Contributor Author

atharvalade commented Feb 26, 2026

Resolved

Test TLS with CA cert, server cert, plain TCP failure, and message flow over TLS
@atharvalade atharvalade force-pushed the java-tcp-tls-tests-examples branch from 16e9f5c to 27f9165 Compare February 26, 2026 17:37
@atharvalade atharvalade changed the title Add TCP/TLS integration tests and examples for Java SDK feat(java): add TCP/TLS integration tests and examples Feb 26, 2026
@atharvalade atharvalade force-pushed the java-tcp-tls-tests-examples branch from b3d1b55 to 35ce2c5 Compare February 26, 2026 18:11
@mmodzelewski
Copy link
Member

WIP

It's best if you mark WIP PRs as drafts — that way it's clearly visible from the list that they're not pending maintainer action.

@atharvalade
Copy link
Contributor Author

WIP

It's best if you mark WIP PRs as drafts — that way it's clearly visible from the list that they're not pending maintainer action.

Will keep that in mind. Though these issues aren't WIP anymore. I'll update the comments.

Copy link
Member

@mmodzelewski mmodzelewski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cheers @atharvalade. I'll have a proper look at this later. Just a quick note - could you include these examples in the README? They're picked up by the run-java-examples-from-readme.sh script in the CI. Unless they're actually executed as part of the build, they’ll likely become outdated quite fast.

@github-actions
Copy link

github-actions bot commented Mar 6, 2026

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs.

If you need a review, please ensure CI is green and the PR is rebased on the latest master. Don't hesitate to ping the maintainers - either @core on Discord or by mentioning them directly here on the PR.

Thank you for your contribution!

@github-actions github-actions bot added the stale Inactive issue or pull request label Mar 6, 2026
@codecov
Copy link

codecov bot commented Mar 7, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 71.89%. Comparing base (514b5c5) to head (eb7bfa3).
⚠️ Report is 30 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff              @@
##             master    #2823      +/-   ##
============================================
+ Coverage     71.44%   71.89%   +0.44%     
- Complexity      708      739      +31     
============================================
  Files           969      988      +19     
  Lines         78219    80173    +1954     
  Branches      60029    61308    +1279     
============================================
+ Hits          55884    57638    +1754     
- Misses        20002    20170     +168     
- Partials       2333     2365      +32     
Flag Coverage Δ
csharp 67.43% <ø> (+0.18%) ⬆️
java 54.83% <ø> (+0.81%) ⬆️
node 92.26% <ø> (-0.15%) ⬇️
python 81.57% <ø> (?)
rust 70.04% <ø> (+0.48%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.
see 81 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

…ests

- Use log-based wait strategy instead of port probe (TLS server rejects raw TCP health checks)
- Fix connectWithoutTls test: run in executor with timeout since blocking client hangs on responses.take()
- Fix sendAndReceiveOverTls test: use partition ID 0 (topic has 1 partition, IDs are 0-indexed)
@github-actions github-actions bot removed the stale Inactive issue or pull request label Mar 8, 2026
@atharvalade
Copy link
Contributor Author

Cheers @atharvalade. I'll have a proper look at this later. Just a quick note - could you include these examples in the README? They're picked up by the run-java-examples-from-readme.sh script in the CI. Unless they're actually executed as part of the build, they’ll likely become outdated quite fast.

@mmodzelewski added!

@atharvalade atharvalade requested a review from mmodzelewski March 8, 2026 09:17
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.

Java SDK: Add TCP/TLS integration tests and examples

2 participants