[#1262] Avoid monitor reply errors during local connection shutdown (#1263)
Fixes #1262
A pending RS monitor reply can retain a handler whose session the reader
has already closed. Its real send then fails on the closed socket, and
`sendPendingMonitorMsgs()` previously reported ERROR 66 even during
local cleanup.
The RS send-failure catch now reports ERROR 66 only when the handler is
not shutting down and local session close has not begun. Both flags are
read after the failed send. Exception tracing remains unconditional, and
failures on otherwise live sessions retain the destination-specific
error. The requester/reader still owns failure detection and cleanup;
this path does not call `stopServer()`. Convergence error filters remain
unchanged.
Eight regression cases use real TLS sessions and the real handler send
path, with domain construction and lifecycle operations mocked. They
cover all four close/shutdown combinations, close after handler
selection, shutdown after selection, successful delivery, and retained
exception tracing. Failed-send cases require an actual IOException and
verify that no handler stop was requested.
Validation on JDK 21, based on master `c6650aedac`:
- Before the fix, six of the eight new cases fail on an unexpected ERROR
66; the other 38 selected tests pass.
- Maven reactor `-Pprecommit verify`, including Javadoc, passes all 44
selected tests with no failures, errors or skips: 8 monitor, 8
heartbeat, 8 reader, 4 writer, 6 session and 10 publisher-drain cases.
- All seven isolated mutations are detected: omitting either guard flag,
caching either flag before the send, guarding exception tracing, adding
`stopServer()`, and logging the sender instead of the destination.
Mutation classes were compiled outside reactor outputs; the final
reactor run used the unmodified fix.
- `git diff --check` passes; independent local review found no issues.
Docker convergence was not run locally.
```sh
mvn -o -Pprecommit verify -pl opendj-server-legacy -am \
-Dit.test=ReplicationServerDomainMonitorTest,ReplicationServerDomainHeartbeatTest,ServerReaderDisconnectTest,ServerWriterDisconnectTest,SessionTest,SessionPublisherDrainTest \
-Dfailsafe.failIfNoSpecifiedTests=false \
-Dtest=NoTestsSelected -Dsurefire.failIfNoSpecifiedTests=false
```