CAMEL-23431: Migrate AS2 tests from AvailablePortFinder to port-0 binding#22990
Merged
gnodet merged 1 commit intoapache:mainfrom May 6, 2026
Merged
CAMEL-23431: Migrate AS2 tests from AvailablePortFinder to port-0 binding#22990gnodet merged 1 commit intoapache:mainfrom
gnodet merged 1 commit intoapache:mainfrom
Conversation
…ding Add getLocalPort() to AS2ServerConnection and AS2AsyncMDNServerConnection to expose the OS-assigned port after binding. Migrate AS2 API tests and component server tests to bind to port 0 and read back the actual port, eliminating the TOCTOU race condition inherent in AvailablePortFinder. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Contributor
|
🌟 Thank you for your contribution to the Apache Camel project! 🌟 🐫 Apache Camel Committers, please review the following items:
|
Contributor
|
🧪 CI tested the following changed modules:
All tested modules (9 modules)
|
davsclaus
approved these changes
May 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
CAMEL-23431
Summary
Migrate AS2 test infrastructure from
AvailablePortFinderto direct port-0ServerSocketbinding to eliminate the TOCTOU (time-of-check-to-time-of-use) race condition that causes flakyBindExceptionfailures in CI.Production code changes:
getLocalPort()toAS2ServerConnectionandAS2AsyncMDNServerConnectionto expose the OS-assigned port after bindingTest changes (10 files):
AS2MessageTestBase,AS2MessageTest,AS2UnencryptedMessageTest: API tests now create servers with port 0 and read back the actual portAS2AsyncMDNServerConnectionTest: Uses port 0 directlyAS2ServerManagerITBase,AS2ServerManagerIT,AS2ServerManagerEncryptedIT: Component tests use port 0 in configuration, read back actual port viadoPostSetup()AS2ServerSecTestBase: Same pattern for security test base classNot migrated yet (follow-up):
AvailablePortFinder.find()with@RegisterExtension.Test plan
mvn testincamel-as2-api— 94 tests passmvn testincamel-as2-component— 12 tests pass