Claus Ibsen created CAMEL-27944:
-----------------------------------

             Summary: camel-as2: targetPortNumber=-1 fails, 
httpConnectionPoolSize above 5 has no effect, sub-second httpSocketTimeout 
means no timeout
                 Key: CAMEL-27944
                 URL: https://issues.apache.org/jira/browse/CAMEL-27944
             Project: Camel
          Issue Type: Bug
          Components: camel-as2
            Reporter: Claus Ibsen
             Fix For: 4.25.0


Found while improving the option descriptions of camel-as2 for CAMEL-23832 
(pull request https://github.com/apache/camel/pull/31192).
These are separate problems of the component; the descriptions change only 
documents the current behavior.

h4. 1. targetPortNumber=-1 fails when the endpoint is created
{{AS2ClientConnection.createTestConnection}} calls new Socket(host, port) 
without a proxy, so targetPortNumber=-1 (which the old option text described as 
the default port of the scheme) throws IllegalArgumentException "port out of 
range". The description no longer claims the -1 behavior.
Proposed change: resolve -1 to 80/443 by the scheme first.

h4. 2. httpConnectionPoolSize above 5 has no effect
{{AS2ClientConnection}} calls setMaxTotal(httpConnectionPoolSize) but not 
setDefaultMaxPerRoute; httpclient5 allows 5 connections per route by default 
and the client has a single route.
Proposed change: also call setDefaultMaxPerRoute(httpConnectionPoolSize).

h4. 3. httpSocketTimeout loses its fraction, and below 1 second means no timeout
{{AS2ClientConnection}} sets SO_TIMEOUT to 
Timeout.ofSeconds(socketTimeout.getSeconds()), so fractions are dropped and a 
value below 1 s becomes 0, which is no socket timeout at all.
Proposed change: Timeout.ofMilliseconds(socketTimeout.toMillis()).

h4. 4. Smaller issues
The test connection made when the endpoint is created uses new Socket(host, 
port) with no connect timeout, so httpConnectionTimeout does not apply to it. 
ediMessageCharset has defaultValue "us-ascii" but the field is null (a text 
body is encoded as US-ASCII, but the Content-Type then has no charset). 
requestUriPattern of listen and receive is marked required, but the consumer 
falls back to "/". AS2SignatureAlgorithm SHA1WITHRSA, MD2WITHRSA and 
SHA224WITHRSA have wrong AlgorithmIdentifier OIDs (unused today, signing uses 
getSignatureAlgorithmName()).


_Claude Code on behalf of davsclaus_



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to