# Compatibility Issue: Camel AS2 Server + Mendelson AS2 Client - 
ConnectionShutdownException with Async MDN



## Summary



When using **async MDN** with the Camel AS2 server component, **Mendelson AS2 
clients** receive a `ConnectionShutdownException` even though the message is 
processed correctly and the MDN is received successfully. This causes Mendelson 
to retry sending the message unnecessarily, resulting in duplicate 
transmissions.



**This is a Mendelson-specific issue.** The same Camel AS2 server works 
perfectly with **OpenAS2 clients** - async MDN completes without any errors. 
This strongly suggests the issue is related to Mendelson's HTTP client 
implementation, not a general Camel AS2 bug.



## Test Results Summary



| AS2 Client | Async MDN | Result |
|------------|-----------|--------|
| **OpenAS2** | Works | No errors, MDN received, transmission complete |
| **Mendelson** | Fails | ConnectionShutdownException, retries 10x (but MDN 
still received!) |

## Environment


- **Camel Version:** 4.x (with HttpCore 5)
- **Java:** Temurin-21
- **Server:** Custom AS2 server using `camel-as2` component

- **Clients Tested:**
  - Mendelson AS2 (opensource version) - **FAILS**
  - OpenAS2 4.8.0 - **WORKS**
- **Protocol:** AS2 with async MDN


## OpenAS2 - WORKS CORRECTLY



When OpenAS2 sends a message with async MDN to our Camel AS2 server, everything 
works:



**OpenAS2 Client Logs (SUCCESS):**
```
20:25:03.905 [AS2DirectoryPollingModule] INFO  Message sender invoked
20:25:04.103 [AS2DirectoryPollingModule] INFO  Connecting to: 
http://localhost:8888/as2/receive 
20:25:05.029 [AS2DirectoryPollingModule] INFO  Message sent and response 
received in 720 milliseconds
20:25:06.090 [pool-4-thread-2] INFO  incoming connection for receiving AsyncMDN
20:25:06.151 [pool-4-thread-2] INFO  Partner HELVETILINK responded with MDN 
[automatic-action/MDN-sent-automatically; processed]
20:25:06.164 [pool-4-thread-2] INFO  Message sent and MDN received successfully.
20:25:06.166 [pool-4-thread-2] INFO  Pending MDN MSG FILE deleted
```

**Camel AS2 Server Logs (with OpenAS2):**
```
2026-02-03T20:25:04.103+08:00  INFO  [AS2Svr-8888] Incoming connection from 
/127.0.0.1
2026-02-03T20:25:04.103+08:00  INFO  [AS2Hdlr-117] Processing new AS2 request
2026-02-03T20:25:04.108+08:00 DEBUG [AS2Hdlr-117] Processing request. Config 
Found: true
2026-02-03T20:25:04.297+08:00  INFO  [AS2Hdlr-117] Received AS2 message - From: 
OpenAS2Server, To: HELVETILINK, MDN: ASYNC
2026-02-03T20:25:04.343+08:00  INFO  [AS2Hdlr-117] Async MDN: Returning HTTP 
200 OK immediately
2026-02-03T20:25:04.405+08:00 DEBUG [AS2Hdlr-117] HTTP/1.1 200 OK 
(Content-Length: 0)
2026-02-03T20:25:05.454+08:00  INFO  [SEDA] MDN sent successfully to 
http://localhost:10081/as2/mdn 
```

**Key observations with OpenAS2:**
- No `ConnectionShutdownException`
- No retries
- Only 5ms between connection and processing (no Expect: 100-continue delay)
- Message and MDN flow completes successfully


## Mendelson - FAILS WITH ConnectionShutdownException



When Mendelson sends the same type of message with async MDN:



**Mendelson Client Logs (FAILURE):**
```
[7:55:40 PM] Preparing outbound AS2 message connection to " 
http://192.168.100.98:8888/as2/receive "
[7:55:40 PM] Sending AS2 message, async MDN requested at 
http://192.168.100.98:8080/as2/HttpReceiver 
[7:55:43 PM] MessageHTTPUploader.performUpload: [ConnectionShutdownException]
[7:55:43 PM] Will retry to send transmission after 30s, retry 1/10.
[7:55:44 PM] An invalid request has been detected. It has not been processed 
because it does not contain a as2-to header.
[7:55:44 PM] An invalid request has been detected. It has not been processed 
because it does not contain a as2-to header.
[7:55:44 PM] Inbound connection from [192.168.100.98] on port 8080
[7:55:44 PM] Inbound transmission is a MDN [HELVETILINK - mycompany]
[7:55:44 PM] Inbound MDN state is [processed].
[7:55:44 PM] Digital signature of inbound MDN has been verified successful.
[7:55:44 PM] The Message Integrity Code (MIC) matches the sent AS2 message.
```

**Key observations with Mendelson:**
- `ConnectionShutdownException` thrown even though everything works
- Mendelson schedules retry (up to 10 times) causing duplicate messages

- MDN is still received and verified successfully!

- Mysterious "invalid request" messages appear (source unknown)

**Camel AS2 Server Logs (with Mendelson):**
```
2026-02-03T19:55:40.193+08:00  INFO  [AS2Svr-8888] Incoming connection from 
/192.168.100.98
2026-02-03T19:55:40.194+08:00  INFO  [AS2Hdlr-120] Processing new AS2 request
2026-02-03T19:55:43.198+08:00 DEBUG [AS2Hdlr-120] Processing request. Config 
Found: true
2026-02-03T19:55:43.417+08:00  INFO  [AS2Hdlr-120] Received AS2 message - From: 
mycompanyAS2, To: HELVETILINK, MDN: ASYNC
2026-02-03T19:55:43.523+08:00  INFO  [AS2Hdlr-120] Async MDN: Returning HTTP 
200 OK immediately
2026-02-03T19:55:43.675+08:00 DEBUG [AS2Hdlr-120] HTTP/1.1 200 OK 
(Content-Length: 0)
2026-02-03T19:55:44.168+08:00  INFO  [AS2Hdlr-120] Client closed connection
2026-02-03T19:55:44.820+08:00  INFO  [SEDA] MDN sent successfully
```

**Note the 3-second delay** between connection (19:55:40) and processing 
(19:55:43) when Mendelson uses HTTP/1.1 with `Expect: 100-continue`. However, 
even when using HTTP/1.0 (no Expect header, no delay), the 
`ConnectionShutdownException` still occurs.


## What We Tried (None Fixed the Mendelson Issue)

### 1. Connection Handling - Server Closes with Delay
Modified `ConnectionReuseStrategy.keepAlive()` to add a delay (500ms, then 
2000ms) before returning `false`.



**Result:** Exception still occurs.



### 2. Connection Handling - Let Client Close

Modified `keepAlive()` to return `true`, letting the client close the 
connection.



**Result:** Exception still occurs. Client does close, but exception happens 
anyway.



### 3. Connection Header Manipulation

- Removed `ResponseConnControl` interceptor

- Added explicit `Connection: close` header

- Tried without any Connection header



**Result:** No difference.



### 4. HTTP/1.0 vs HTTP/1.1

Configured Mendelson to use HTTP/1.0 (to avoid `Expect: 100-continue`).



**Result:** Exception still occurs. This proves it's NOT related to Expect: 
100-continue.



### 5. Response Timing

- Added delays before sending HTTP 200 OK

- Removed all delays for immediate response



**Result:** No difference.



## HTTP Response Sent by Server



```
HTTP/1.1 200 OK
Content-Length: 0
Server: HELVETILINK
Date: Tue, 03 Feb 2026 11:55:43 GMT
Connection: close
```

This is a valid HTTP response. OpenAS2 handles it correctly; Mendelson does not.


## Additional Observation - "Invalid Request" Messages



In Mendelson's log, these mysterious messages appear at the same time as the 
exception:

```
[7:55:44 PM] An invalid request has been detected. It has not been processed 
because it does not contain a as2-to header.
[7:55:44 PM] An invalid request has been detected. It has not been processed 
because it does not contain a as2-to header.
```

These appear BEFORE the async MDN arrives. We are not sending any other 
requests to Mendelson. The source is unknown and may be related to Mendelson's 
internal HTTP handling.


## Impact



1. **Duplicate messages:** Mendelson retries up to 10 times

2. **Cannot use async MDN with Mendelson clients**
3. **Operational issues with Mendelson-based trading partners**

## Conclusion


Since OpenAS2 works perfectly and Mendelson fails with the exact same server 
configuration and HTTP response, this appears to be a **Mendelson HTTP client 
compatibility issue**, not a Camel AS2 server bug.



However, given that Mendelson is a widely-used AS2 implementation, it would be 
valuable to understand:

1. What specifically in the HTTP response or connection handling triggers 
Mendelson's exception

2. Whether there's a server-side accommodation that could help Mendelson work 
correctly



## Questions for the Community



1. Has anyone else experienced `ConnectionShutdownException` with Mendelson + 
Camel AS2 + async MDN?

2. Has anyone successfully used async MDN with Mendelson and Camel AS2?

3. Is there something specific about Mendelson's HTTP client that requires 
special handling?

4. Are there known differences in how Mendelson vs OpenAS2 handle HTTP 
connections?



## Workaround



Use **sync MDN** instead of async MDN when communicating with Mendelson clients.



---

**Reported by:** Reto Peter
**Date:** 2026-02-03

Reply via email to