diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0a3b063..3279232 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -363,6 +363,30 @@ if(GTest_FOUND)
# Note: NOT gtest_main - we provide our own main()
)
+ # Mutual TLS integration tests (client cert required, no SASL; #10 coverage)
+ add_executable(mutual_tls_integration_tests
+ tests/integration/MutualTlsIntegrationTest.cpp
+ )
+
+ target_link_libraries(mutual_tls_integration_tests
+ PRIVATE
+ hotrod-client
+ GTest::gtest
+ # Note: NOT gtest_main - we provide our own main()
+ )
+
+ # SASL EXTERNAL over mutual TLS integration tests (cert identity; #10 coverage)
+ add_executable(external_auth_integration_tests
+ tests/integration/ExternalAuthIntegrationTest.cpp
+ )
+
+ target_link_libraries(external_auth_integration_tests
+ PRIVATE
+ hotrod-client
+ GTest::gtest
+ # Note: NOT gtest_main - we provide our own main()
+ )
+
target_link_libraries(fromuri_integration_tests
PRIVATE
hotrod-client
@@ -391,6 +415,8 @@ if(GTest_FOUND)
add_test(NAME MultiSeedIntegrationTests COMMAND multiseed_integration_tests)
add_test(NAME AuthIntegrationTests COMMAND auth_integration_tests)
add_test(NAME TlsIntegrationTests COMMAND tls_integration_tests)
+ add_test(NAME MutualTlsIntegrationTests COMMAND mutual_tls_integration_tests)
+ add_test(NAME ExternalAuthIntegrationTests COMMAND external_auth_integration_tests)
# Set working directory so scripts can be found
set_tests_properties(PingIntegrationTests PROPERTIES
@@ -477,6 +503,14 @@ if(GTest_FOUND)
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
LABELS "integration;docker;tls"
)
+ set_tests_properties(MutualTlsIntegrationTests PROPERTIES
+ WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
+ LABELS "integration;docker;tls;mutual-tls"
+ )
+ set_tests_properties(ExternalAuthIntegrationTests PROPERTIES
+ WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
+ LABELS "integration;docker;auth;tls;mutual-tls"
+ )
# Fail fast if a suite hangs (e.g. a server/CLI-version regression stalls a
# subprocess) instead of letting one stuck test burn the whole CI job budget.
@@ -489,6 +523,7 @@ if(GTest_FOUND)
ConcurrentClientsTests HashAwareRoutingIntegrationTests ConcurrentMultiServerTests
RetryViewIntegrationTests PingRetryIntegrationTests MultiSeedIntegrationTests
AuthIntegrationTests TlsIntegrationTests
+ MutualTlsIntegrationTests ExternalAuthIntegrationTests
PROPERTIES TIMEOUT 300
)
endif() # NOT WIN32 (integration tests)
diff --git a/docs/DECISIONS.md b/docs/DECISIONS.md
index 759a8dd..ab96da6 100644
--- a/docs/DECISIONS.md
+++ b/docs/DECISIONS.md
@@ -1363,3 +1363,63 @@ deferred (needs server realms/token issuer; see STATUS backlog), as with mutual
**Deferred:** GSSAPI/GS2-KRB5 (needs MIT krb5/Heimdal + multi-round GSS exchange),
DIGEST-MD5 (obsolete). SASL QOP/`sasl_properties.*` not wired.
+
+## 2026-11-13 — Integration coverage: mutual TLS, SASL PLAIN, SASL EXTERNAL
+
+**What:** Added Docker-backed, end-to-end integration tests for three features
+that previously had unit coverage only, closing two STATUS backlog items (mutual
+TLS, non-SCRAM SASL — all but OAUTHBEARER). One integration-coverage change set:
+- **PLAIN** — no new infra. `infinispan-auth.xml` already offers PLAIN alongside
+ the SCRAM family and uses the same plain-text realm, so PLAIN reuses the existing
+ `AuthMechanismRoundTrip` fixture via a second `INSTANTIATE_TEST_SUITE_P` (now 7
+ `AuthIntegrationTests`).
+- **Mutual TLS** — new `MutualTlsIntegrationTest` (suite
+ `MutualTlsIntegrationTests`) against `test-configs/infinispan-mtls.xml`
+ (require-ssl-client-auth, client-CA truststore, **no SASL**). Cases: programmatic
+ `setTls(cert/key)` round-trip, `hotrods://` URI with `client_cert_file`/
+ `client_key_file` round-trip, and a no-client-cert rejection.
+- **EXTERNAL** — new `ExternalAuthIntegrationTest` (suite
+ `ExternalAuthIntegrationTests`) against `test-configs/infinispan-external.xml`
+ (the mutual-TLS realm + `` + SASL EXTERNAL). Cases:
+ programmatic `setAuthentication({mechanism="EXTERNAL"})` + mutual TLS round-trip,
+ and the same via a `hotrods://` URI with `sasl_mechanism=EXTERNAL`.
+
+One parameterized start script (`scripts/start_infinispan_mtls.sh [config]`) serves
+both TLS configs; `scripts/gen-test-certs.sh` now also emits the integration client
+identity (`client.pem`/`client.key`) and the server truststore bundle
+(`client-truststore.pem`). Fixtures are committed. New ctest labels:
+`mutual-tls` (both new suites), plus `auth`+`tls` on the EXTERNAL suite.
+
+**Why it matters / gotchas discovered while wiring the server side:**
+
+1. **`` trusts *specific client certificates*, not just the
+ CA.** With a CA-only PEM truststore the pure-mTLS endpoint (no realm) accepted
+ our client cert fine, but the EXTERNAL endpoint rejected the TLS handshake with
+ `tlsv1.3 alert certificate unknown` (OpenSSL `0A000416`, SSL alert 46). Root
+ cause confirmed against Infinispan's own harness: `CertificateAuthority.export
+ Certificates` stores each **leaf** cert (`getCertificateChain()[0]`) as a
+ truststore entry, not the issuing CA. Fix: the committed server truststore is a
+ **bundle of the client leaf cert + its CA** (`client-truststore.pem`) — the leaf
+ entry satisfies the truststore-realm's exact-cert trust, and the CA lets the
+ pure-mTLS trust manager validate the chain too. One bundle serves both configs.
+
+2. **TLS 1.3 reports a required-but-missing client cert *after* the handshake,
+ not at connect().** With `require-ssl-client-auth`, a client that presents no
+ cert still sees `SSL_connect()` succeed under TLS 1.3 — the server's
+ `certificate required` alert arrives post-handshake, surfacing on the first
+ read/op. So the no-client-cert test asserts an exception across connect()+op
+ (the `AuthIntegrationTest.NoCredentialsFails` pattern), not `EXPECT_THROW(connect)`.
+ (`openssl s_client ... <<< Q` masks this: it verifies only the *server* cert and
+ quits before reading the alert, so it looks like success.)
+
+3. **`require-ssl-client-auth` is valid on the single-port ``** (it is a
+ `protocol-connector` base attribute in the 16.0 server schema), and Infinispan
+ **auto-detects a PEM truststore** (`password=""` per the schema) — no PKCS12
+ needed for the client-trust material.
+
+**Authoritative references used (per AGENTS.md):** Infinispan server tests
+`AuthenticationCertIT` + `security/trustrealm.xml` + `endpoints/auth-tls-external.xml`
+(realm/endpoint shape), and the 16.0 server XSD (attribute placement, PEM detection).
+
+**Deferred:** OAUTHBEARER integration (needs a token issuer/realm — Keycloak or a
+static-JWT public key + pre-minted token); it remains unit-only. See STATUS backlog.
diff --git a/docs/STATUS.md b/docs/STATUS.md
index 3cd47d8..92cd82f 100644
--- a/docs/STATUS.md
+++ b/docs/STATUS.md
@@ -4,7 +4,7 @@
> If any other doc disagrees with this file, this file wins. Point-in-time
> snapshots live in [`archive/`](archive/) and are historical only.
>
-> **Last updated:** 2026-11-12
+> **Last updated:** 2026-11-13
---
@@ -41,7 +41,8 @@ _The 1–3 concrete things to do next. Keep this short and current._
(two `TODO`s in `src/operations/RemoteCache.cpp`).
_Recently shipped (detail in "Working and shipped" + [`DECISIONS.md`](DECISIONS.md)):
-non-SCRAM SASL (PLAIN/EXTERNAL/OAUTHBEARER) (#10, 2026-11-12), mutual TLS (PEM
+Docker integration coverage for mutual TLS + SASL PLAIN + SASL EXTERNAL
+(2026-11-13), non-SCRAM SASL (PLAIN/EXTERNAL/OAUTHBEARER) (#10, 2026-11-12), mutual TLS (PEM
client cert/key) + PEM-honest TLS URI keys (`ca_file`,
`client_cert_file`/`client_key_file`; Java keystore keys now rejected with a
redirect) (#18, 2026-11-12), server-authenticated TLS for `hotrods://` (#18,
@@ -62,15 +63,11 @@ pull from here next. Step numbers follow
`BULK_GET` (0x1F, iterator-style).
**Other known work (not roadmap steps):**
-- [ ] **Mutual-TLS integration coverage** — client cert/key is unit-tested
- (in-process OpenSSL server requiring a client cert) but not yet covered by the
- Docker `TlsIntegrationTest`, which needs the Infinispan server configured to
- require/verify client certs (extend `scripts/start_infinispan_tls.sh` +
- `gen-test-certs.sh` already emits the unit client cert).
-- [ ] **Non-SCRAM SASL integration coverage** — PLAIN/EXTERNAL/OAUTHBEARER are
- unit-tested against fake servers but not end-to-end: PLAIN needs a server SASL
- realm offering it; EXTERNAL needs mutual TLS + a cert→identity mapping;
- OAUTHBEARER needs a token issuer/realm. `AuthIntegrationTest` covers SCRAM only.
+- [ ] **OAUTHBEARER integration coverage** — the last non-SCRAM SASL mechanism
+ without an end-to-end Docker test. Needs real token infra (a token-realm backed
+ by Keycloak, or a static-JWT public key + a pre-minted token). PLAIN, EXTERNAL,
+ and mutual TLS integration coverage shipped 2026-11-13 (see "Working and
+ shipped"); OAUTHBEARER is still unit-tested against a fake server only.
- [ ] **Benchmark the multiplexing path** — the async rewrite targets 5–10×
concurrent throughput; unmeasured so far.
- [ ] **Code cleanup:** read header "other params" when `paramCount > 0`
@@ -198,24 +195,30 @@ Rod URI `fromUri` (#9), multi-server seed list + failover (#12)._
that stalls a subprocess fails fast instead of hanging the whole CI job. See
[`DECISIONS.md`](DECISIONS.md).
-**Test status:** **284 unit** (verified 2026-11-12) + **96 integration** (20
-suites, verified 2026-10-19), all passing. This is the one authoritative count —
+**Test status:** **284 unit** (verified 2026-11-12) + **107 integration** (23
+suites, verified 2026-11-13), all passing. This is the one authoritative count —
other docs describe *what* is covered rather than repeating totals. Counts read
from the built test binaries via `--gtest_list_tests`, so they match what actually
-runs. (The +34 unit tests since 2026-11-09 are the mutual-TLS handshake cases, the
-PEM-honest URI-key parsing/redirect cases, and the non-SCRAM SASL mechanism cases
-— pure initial-response builders + PLAIN/EXTERNAL/OAUTHBEARER driver flows.)
+runs. (The +6 integration tests on 2026-11-13 are the mutual-TLS round-trip/URI/
+no-cert-rejected cases — `MutualTlsIntegrationTests` — the SASL EXTERNAL
+cert-identity round-trip + URI cases — `ExternalAuthIntegrationTests` — and a PLAIN
+case added to `AuthIntegrationTests`.)
- Unit (`./build/unit_tests`, <1s) — wire primitives/headers, consistent hashing,
server-selection/retry helpers, the SASL handshake (SCRAM family +
PLAIN/EXTERNAL/OAUTHBEARER, against fake servers), the TLS handshake (server-auth
+ mutual TLS, in-process OpenSSL server), and the Hot Rod URI parser.
- Integration (`ctest`, spins up Docker Infinispan single-server + multi-node
clusters; also green on Linux CI) — CRUD + metadata/CAS, topology & hash-aware
- routing, keyed/keyless retry (`RetryView`/ping), SASL/SCRAM against a secured
- server, Hot Rod URI `fromUri`, and multi-server seed failover.
-- Full run: `ctest --test-dir build --output-on-failure` → **100% pass, 21/21**
- (1 unit + 20 integration suites) — last full end-to-end run 2026-10-19; unit
- suite re-verified 2026-11-12 (266 pass) after the mutual-TLS/URI changes.
+ routing, keyed/keyless retry (`RetryView`/ping), SASL against a secured server
+ (SCRAM family + PLAIN via `AuthIntegrationTests`; EXTERNAL over mutual TLS via
+ `ExternalAuthIntegrationTests`), server-authenticated TLS (`TlsIntegrationTests`)
+ and mutual TLS (`MutualTlsIntegrationTests`), Hot Rod URI `fromUri`, and
+ multi-server seed failover.
+- Full run: `ctest --test-dir build --output-on-failure` covers **24 suites**
+ (1 unit + 23 integration). Last full end-to-end run 2026-10-19 (100% pass at the
+ then-current 21 suites); unit suite re-verified 2026-11-12 (284 pass), and the
+ `Auth`/`Tls`/`MutualTls`/`ExternalAuth` integration suites verified 2026-11-13
+ (7 + 5 + 3 + 2 pass) after the integration-coverage changes.
- **Concurrency validated (2026-09-25):** the concurrent suites pass 8/8
(incl. `ConcurrentWithFailover`), and a ThreadSanitizer run (`build-tsan/`)
reports **no races in production code** — slice-4's `stateMutex_`/`shared_ptr`
diff --git a/scripts/gen-test-certs.sh b/scripts/gen-test-certs.sh
index 6968355..46d22c1 100755
--- a/scripts/gen-test-certs.sh
+++ b/scripts/gen-test-certs.sh
@@ -84,6 +84,25 @@ openssl pkcs12 -export -out "$INT_DIR/server.p12" \
-inkey "$TMP/int-server.key" -in "$TMP/int-server.pem" \
-name server -passout "pass:$P12_PASS" 2>/dev/null
+# Client identity for the mutual-TLS / EXTERNAL integration tests (MutualTls*,
+# ExternalAuth* suites). A client CA signs a client leaf (client.pem + client.key,
+# PEM) — what the client presents. The server's PEM truststore
+# (client-truststore.pem) is a bundle of the client LEAF cert followed by its CA:
+# - the leaf entry is what Infinispan's (EXTERNAL) matches to
+# derive the identity — the realm trusts specific client certificates, exactly as
+# Infinispan's own test harness does (CertificateAuthority.exportCertificates
+# stores each leaf, getCertificateChain()[0], not the CA);
+# - the CA lets the pure-mTLS endpoint (no realm) validate the chain as well.
+# Infinispan auto-detects the PEM truststore (password=""). The client CA *private*
+# key is discarded, like the other CAs; the CA cert itself is not committed on its
+# own — it lives only inside the committed truststore bundle.
+make_ca "$TMP/int-clientca.pem" "$TMP/int-clientca.key" "Integration Client CA"
+make_leaf "$TMP/int-clientca.pem" "$TMP/int-clientca.key" \
+ "$INT_DIR/client.key" "$INT_DIR/client.pem" \
+ "test-client" "DNS:test-client"
+chmod 600 "$INT_DIR/client.key"
+cat "$INT_DIR/client.pem" "$TMP/int-clientca.pem" > "$INT_DIR/client-truststore.pem"
+
echo ">> done."
echo " Regenerated fixtures are NOT byte-identical to the committed ones (fresh"
echo " random keys/serials). 'git add' them only if you mean to replace the set."
diff --git a/scripts/start_infinispan_mtls.sh b/scripts/start_infinispan_mtls.sh
new file mode 100755
index 0000000..7f20d70
--- /dev/null
+++ b/scripts/start_infinispan_mtls.sh
@@ -0,0 +1,79 @@
+#!/bin/bash
+# Start Infinispan with mutual TLS on the Hot Rod endpoint (issue #10 integration
+# coverage). The endpoint requires a client certificate (require-ssl-client-auth),
+# verified against a PEM truststore (test-configs/tls/client-ca.pem).
+#
+# One script serves two configs, selected by the first argument:
+# infinispan-mtls.xml (default) — mutual TLS, NO SASL (MutualTlsIntegrationTest)
+# infinispan-external.xml — mutual TLS + SASL EXTERNAL (ExternalAuthIntegrationTest)
+#
+# Mounts the server PKCS12 identity (server.p12), the client CA PEM truststore
+# (client-ca.pem), and the chosen config. Exports the server trust anchor the
+# client needs (ca.pem) plus the client cert/key it must present.
+
+set -e
+
+CONFIG_NAME="${1:-infinispan-mtls.xml}"
+
+SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
+CONFIG_DIR="$SCRIPT_DIR/../test-configs"
+CONFIG_FILE="$CONFIG_DIR/$CONFIG_NAME"
+KEYSTORE_FILE="$CONFIG_DIR/tls/server.p12"
+TRUSTSTORE_FILE="$CONFIG_DIR/tls/client-truststore.pem"
+CA_FILE="$CONFIG_DIR/tls/ca.pem"
+CLIENT_CERT_FILE="$CONFIG_DIR/tls/client.pem"
+CLIENT_KEY_FILE="$CONFIG_DIR/tls/client.key"
+
+for f in "$CONFIG_FILE" "$KEYSTORE_FILE" "$TRUSTSTORE_FILE" "$CA_FILE" \
+ "$CLIENT_CERT_FILE" "$CLIENT_KEY_FILE"; do
+ if [ ! -f "$f" ]; then
+ echo "ERROR: Config file not found: $f" >&2
+ exit 1
+ fi
+done
+
+CONF=/opt/infinispan/server/conf
+
+# Start container with the mutual-TLS config + server keystore + client-CA truststore
+# mounted into the conf dir.
+# --pull always: :latest is unpinned; refresh so a stale local cache can't run an old server.
+CONTAINER_ID=$(docker run -d --pull always \
+ -p 0:11222 \
+ -v "$CONFIG_FILE:$CONF/infinispan.xml:ro" \
+ -v "$KEYSTORE_FILE:$CONF/server.p12:ro" \
+ -v "$TRUSTSTORE_FILE:$CONF/client-truststore.pem:ro" \
+ quay.io/infinispan/server:latest)
+
+# Wait for server ready (ISPN080001 = "Infinispan Server started")
+echo "Waiting for Infinispan server to start (mutual TLS, config: $CONFIG_NAME)..." >&2
+timeout 120 bash -c "
+while ! docker logs $CONTAINER_ID 2>&1 | grep -q 'ISPN080001'; do
+ sleep 1
+done
+" || {
+ echo "ERROR: Server failed to start within 120 seconds" >&2
+ docker logs $CONTAINER_ID >&2
+ docker rm -f $CONTAINER_ID >&2
+ exit 1
+}
+
+# Get mapped port
+HOST=localhost
+PORT=$(docker port $CONTAINER_ID 11222 | cut -d: -f2)
+
+if [ -z "$PORT" ]; then
+ echo "ERROR: Failed to get mapped port" >&2
+ docker rm -f $CONTAINER_ID >&2
+ exit 1
+fi
+
+# Export for C++ tests (stdout only - for parsing)
+echo "export ISPN_CONTAINER_ID=$CONTAINER_ID"
+echo "export ISPN_HOST=$HOST"
+echo "export ISPN_PORT=$PORT"
+echo "export ISPN_TLS=true"
+echo "export ISPN_CA_FILE=$CA_FILE"
+echo "export ISPN_CLIENT_CERT_FILE=$CLIENT_CERT_FILE"
+echo "export ISPN_CLIENT_KEY_FILE=$CLIENT_KEY_FILE"
+
+echo "Server started: $HOST:$PORT (container: $CONTAINER_ID, mutual TLS, config: $CONFIG_NAME)" >&2
diff --git a/test-configs/infinispan-external.xml b/test-configs/infinispan-external.xml
new file mode 100644
index 0000000..1d60aba
--- /dev/null
+++ b/test-configs/infinispan-external.xml
@@ -0,0 +1,78 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/test-configs/infinispan-mtls.xml b/test-configs/infinispan-mtls.xml
new file mode 100644
index 0000000..6c0a682
--- /dev/null
+++ b/test-configs/infinispan-mtls.xml
@@ -0,0 +1,73 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/test-configs/tls/client-truststore.pem b/test-configs/tls/client-truststore.pem
new file mode 100644
index 0000000..ca965df
--- /dev/null
+++ b/test-configs/tls/client-truststore.pem
@@ -0,0 +1,38 @@
+-----BEGIN CERTIFICATE-----
+MIIDIDCCAgigAwIBAgIUfy9wi1XOw3WBE0g6Rh8LykLr/FcwDQYJKoZIhvcNAQEL
+BQAwIDEeMBwGA1UEAwwVSW50ZWdyYXRpb24gQ2xpZW50IENBMCAXDTI2MTExMzA3
+NDg0M1oYDzIxMjYxMDIwMDc0ODQzWjAWMRQwEgYDVQQDDAt0ZXN0LWNsaWVudDCC
+ASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAI7+c4q5xs/gaHXXbRdD6ZL4
+D4lxD9G4qNbd0n8N++zgDLjl0iPZ5L1r3Xjbx6SkyfH09pu3Ed0lDVwqTW1a3ooo
+eJtxuo+yd9i9dZLKMGxc30GOJAFTJqB0aBSp3J5KoLFDTRuzw+w21HzICz1N6pdB
+EWyq8sVh871FxTIdFlqUkXeisjnTsbaktRHe0dPP04w25roQ0O3cI1Mg/9FnoDmj
+Aiz/zqxEgRXeAOREFVK4DPGsvbQ8rggbV4o5kS3Xl3LR+v3mjf7PEYk3Mt6mvxQF
+isgZCaYzE75ETwH9rQDfrlaF/8dWR+d5v+K075IUeaEtIOxSFkxMv2aFwa1rJD8C
+AwEAAaNaMFgwFgYDVR0RBA8wDYILdGVzdC1jbGllbnQwHQYDVR0OBBYEFLSgg2YL
+u5e8nl8S5uqo92kGcWi1MB8GA1UdIwQYMBaAFDzkAuZbZRPf5OJ4Ja3aoIe4tIku
+MA0GCSqGSIb3DQEBCwUAA4IBAQAypMv6J1ZyEz665fjsXS5tmzk63efeOKqPJE1f
+XjUrtCA0z9Mayf16NKW48VbMCJjkUjuitLiDENI6Ic0uuYX476da5eo1GsUw5Lbu
+sNXDcZ7wT/8NKtKU0RzwAtoOZafQ2SYDEIvX2aSLjuSHrH92s7mjXRm29glCljHO
+C6YjAExCcqSPgpusK8JMbI7X+arftyEKFmryTyAaJ2bcXzSml/2ZXqOink7F7p9B
+cjrDl0kwIsxBOa+rv4OUJSloWYhFqB4KN2lDkN0GzAV2Q2t4NpSsZfUS/6vTtacv
+Y/7PvNgNOd2FPubNEgPKQi/rwXn+uI9cPT8xDmXAWE2qWacF
+-----END CERTIFICATE-----
+-----BEGIN CERTIFICATE-----
+MIIDIzCCAgugAwIBAgIUXmlFV2E+X2wib5/WqXYKEqTXnDgwDQYJKoZIhvcNAQEL
+BQAwIDEeMBwGA1UEAwwVSW50ZWdyYXRpb24gQ2xpZW50IENBMCAXDTI2MTExMzA3
+NDg0M1oYDzIxMjYxMDIwMDc0ODQzWjAgMR4wHAYDVQQDDBVJbnRlZ3JhdGlvbiBD
+bGllbnQgQ0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCuT6W4/KgX
+kITjZKV7BOOZVY443WRtFwfhzVbnb1TsTckfIm3Dv2QnsJcAu8iVNBErxmtakal/
+VvksUQMCJDCr+yiA7/AflnpgxMyZeSbCJIxRvdl94/SQ3CPd7tJ8z4PUYKzIQAfp
+Q4mml/xHcUCu7nBKbsWQm2+BqYcjm6cX3yai4skhuAsRx9XIi6dXZCgVJvHHkURF
+w7rDwS9rb4Blku/3fZiyHtNa963bbQ9hBzQQLodJY3v5jr/ZQ2HqYjJWPJGMX5no
+a0hg6hS4ZLVEkjT+HHPVTef1WGyXjU0MWCIcDFXQtz42oYoI9+DYYg3SVInMdvDh
+HmbHTw5QWezLAgMBAAGjUzBRMB0GA1UdDgQWBBQ85ALmW2UT3+TieCWt2qCHuLSJ
+LjAfBgNVHSMEGDAWgBQ85ALmW2UT3+TieCWt2qCHuLSJLjAPBgNVHRMBAf8EBTAD
+AQH/MA0GCSqGSIb3DQEBCwUAA4IBAQA65nJu30Y6WtsGrKFKQFMBgN+OYyURHlnB
+3U0cdjyXxbwz6XpwmBReOfrYHkQDJ86Cs4KLwi0RY0osOFVbCvZ+m6GfZ0cY4OON
+FfvufiGShOMK1MV68gOo93csxjc1g8LuFmSAj7q08d85CF17lpnEguPijSukKpMN
+89f83vove7KytzFjLog7EK1sx6pu6AY1ELW8ATpIoMDeT+2OYdjCIl8SK7q4DT2K
+6yZmkOlJDLJDXqT7PFOpkDK+gTghkrObow0+UDd0N6qqrTFZBQtVkDulXVusa89A
+TDLQ29A4gXfcM4qNjjUcMQ1OVhFoGIlnYaGDjL+/0eopYdoPwc5N
+-----END CERTIFICATE-----
diff --git a/test-configs/tls/client.key b/test-configs/tls/client.key
new file mode 100644
index 0000000..19304b0
--- /dev/null
+++ b/test-configs/tls/client.key
@@ -0,0 +1,28 @@
+-----BEGIN PRIVATE KEY-----
+MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCO/nOKucbP4Gh1
+120XQ+mS+A+JcQ/RuKjW3dJ/Dfvs4Ay45dIj2eS9a91428ekpMnx9PabtxHdJQ1c
+Kk1tWt6KKHibcbqPsnfYvXWSyjBsXN9BjiQBUyagdGgUqdyeSqCxQ00bs8PsNtR8
+yAs9TeqXQRFsqvLFYfO9RcUyHRZalJF3orI507G2pLUR3tHTz9OMNua6ENDt3CNT
+IP/RZ6A5owIs/86sRIEV3gDkRBVSuAzxrL20PK4IG1eKOZEt15dy0fr95o3+zxGJ
+NzLepr8UBYrIGQmmMxO+RE8B/a0A365Whf/HVkfneb/itO+SFHmhLSDsUhZMTL9m
+hcGtayQ/AgMBAAECggEAKptPwySixBrqFT7IzxdZuAR44KuTGprKmCdFSr1YdNa3
+g7pa2HrayMQknBfkjz7Yu2MRvgkY5gtdxToHkw9x4rm3Yh3LiHiVdDvTlhbvwcIU
+dbyMJubnSgUVZB7O0U2MPvU+OwRf2vjlbH7QtoYKYeIt9nKjXsPWc+2fmdSH7hoH
+a64q2BsB9lTO/yxJT/SNCr75A7+M8wXvlK7DCQL3nts1yb0DNiKnLhhzYrjttIfz
+2UnNwYXQPpkoEHPVcCi3jP2H3cciG8oLKTtpTNw8GWXaPrCSnpwajDnGWFMDrqx0
+uRpAexJfXU2HNb5fz7HFS59NCTqGDlNwGxmUGkebNQKBgQDJBqQPe8vg0UvobTEH
+zCkELMqdzfov0/kjSki4kQ1/AzqZbJmCTLoHFrYiTHpkQVVnc5qobAh8hKTu0Cfb
+y3Lyj73FcIapeUD+4CGe0z4hcLFBcDhQmIvyKx729SglJtwS6sSFPQwS1Y0+XsKj
+Ra/Bh1c2rqXTk6TOWHRsWJ47HQKBgQC2GSAp2qGeSbYY0Uma26M0dTe7K6ZmpoXQ
+nXpzAGBqA1qxzLFMt/sZFh9LxmHZvchYvrnLj9Px5lgIIF9HuL6sHUPuMSd/A6EO
+cS1Mxs4XkdrIpQY7dbiu2OsJnQecFYERho1n4X23WiIyVEPsyxCj3hLd1rcGys53
+Ja60zfviCwKBgDCckn/MB/lNo3WJMhoYnLKNwlF2xdFbCRwnkn5PVVwpg7omMNj5
+hOLB8zlIFTC5O9XQds3TkhnKWbgGTh0wjZNqfxGHrIi+8aCwwnCN1LBxd+vDH1se
+CHl/Q/WkQxj41K8eZndx08GaMpWqhJbG+0FpYQWwJhmL0oazjTPGGj1hAoGAIaJo
+b3KjkYIZ8WGOz9yru3+/KII6fRFa/BpqSJ2UMWCnOtoNEZeV+J8+bpeY8Uf9nm60
+EKZjRnX+YpngH3Y/Obk6F9/aZLp94BYFgP3jiTT2jUL18LugviLw3tizVCAgs+T/
+b2WV++zZDiTEWxNy4mGdaH5FVirVkepS57B4StsCgYEAhjBhLOjwapk7z1ndtDUi
+CgRJg83SbnFR0i3gF9JeeJxFmvUSWIY/bHVO13zkeo4B7+Z8mANrwcg0hG5P3+78
+7lK4gnhernuCWkCFIaIeuobW+sRPM8WmwZ0PR6k6pPiCMCB4LBPs9ekGfce08tMr
+XxN2A31gcPONptiXvPr+pDw=
+-----END PRIVATE KEY-----
diff --git a/test-configs/tls/client.pem b/test-configs/tls/client.pem
new file mode 100644
index 0000000..6ea9133
--- /dev/null
+++ b/test-configs/tls/client.pem
@@ -0,0 +1,19 @@
+-----BEGIN CERTIFICATE-----
+MIIDIDCCAgigAwIBAgIUfy9wi1XOw3WBE0g6Rh8LykLr/FcwDQYJKoZIhvcNAQEL
+BQAwIDEeMBwGA1UEAwwVSW50ZWdyYXRpb24gQ2xpZW50IENBMCAXDTI2MTExMzA3
+NDg0M1oYDzIxMjYxMDIwMDc0ODQzWjAWMRQwEgYDVQQDDAt0ZXN0LWNsaWVudDCC
+ASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAI7+c4q5xs/gaHXXbRdD6ZL4
+D4lxD9G4qNbd0n8N++zgDLjl0iPZ5L1r3Xjbx6SkyfH09pu3Ed0lDVwqTW1a3ooo
+eJtxuo+yd9i9dZLKMGxc30GOJAFTJqB0aBSp3J5KoLFDTRuzw+w21HzICz1N6pdB
+EWyq8sVh871FxTIdFlqUkXeisjnTsbaktRHe0dPP04w25roQ0O3cI1Mg/9FnoDmj
+Aiz/zqxEgRXeAOREFVK4DPGsvbQ8rggbV4o5kS3Xl3LR+v3mjf7PEYk3Mt6mvxQF
+isgZCaYzE75ETwH9rQDfrlaF/8dWR+d5v+K075IUeaEtIOxSFkxMv2aFwa1rJD8C
+AwEAAaNaMFgwFgYDVR0RBA8wDYILdGVzdC1jbGllbnQwHQYDVR0OBBYEFLSgg2YL
+u5e8nl8S5uqo92kGcWi1MB8GA1UdIwQYMBaAFDzkAuZbZRPf5OJ4Ja3aoIe4tIku
+MA0GCSqGSIb3DQEBCwUAA4IBAQAypMv6J1ZyEz665fjsXS5tmzk63efeOKqPJE1f
+XjUrtCA0z9Mayf16NKW48VbMCJjkUjuitLiDENI6Ic0uuYX476da5eo1GsUw5Lbu
+sNXDcZ7wT/8NKtKU0RzwAtoOZafQ2SYDEIvX2aSLjuSHrH92s7mjXRm29glCljHO
+C6YjAExCcqSPgpusK8JMbI7X+arftyEKFmryTyAaJ2bcXzSml/2ZXqOink7F7p9B
+cjrDl0kwIsxBOa+rv4OUJSloWYhFqB4KN2lDkN0GzAV2Q2t4NpSsZfUS/6vTtacv
+Y/7PvNgNOd2FPubNEgPKQi/rwXn+uI9cPT8xDmXAWE2qWacF
+-----END CERTIFICATE-----
diff --git a/tests/integration/AuthIntegrationTest.cpp b/tests/integration/AuthIntegrationTest.cpp
index ed1bac0..d5f2a07 100644
--- a/tests/integration/AuthIntegrationTest.cpp
+++ b/tests/integration/AuthIntegrationTest.cpp
@@ -123,6 +123,15 @@ INSTANTIATE_TEST_SUITE_P(
return n;
});
+// PLAIN (RFC 4616) is offered by infinispan-auth.xml alongside the SCRAM family and
+// uses the same username+password, so it reuses the round-trip fixture — no new
+// server. (The handshake runs over a plaintext socket here; production use of PLAIN
+// should be over TLS, as the client docs note.)
+INSTANTIATE_TEST_SUITE_P(
+ Plain, AuthMechanismRoundTrip,
+ ::testing::Values("PLAIN"),
+ [](const ::testing::TestParamInfo& info) { return info.param; });
+
// 2. Wrong password: the SASL handshake fails at connect() time.
TEST(AuthIntegrationTest, WrongPasswordThrowsAtConnect) {
RemoteCache cache(AuthServerEnvironment::host, AuthServerEnvironment::port);
diff --git a/tests/integration/ExternalAuthIntegrationTest.cpp b/tests/integration/ExternalAuthIntegrationTest.cpp
new file mode 100644
index 0000000..615581e
--- /dev/null
+++ b/tests/integration/ExternalAuthIntegrationTest.cpp
@@ -0,0 +1,163 @@
+/**
+ * SASL EXTERNAL Authentication Integration Tests (Docker-backed), issue #10.
+ *
+ * Runs against a mutual-TLS + EXTERNAL Infinispan server started by
+ * scripts/start_infinispan_mtls.sh infinispan-external.xml (require-ssl-client-auth,
+ * a client-CA truststore, a truststore-realm, and SASL EXTERNAL on the Hot Rod
+ * connector). The client's identity comes entirely from its TLS certificate
+ * (CN=test-client); EXTERNAL carries no password. Verifies the end-to-end chain —
+ * mutual TLS handshake, then the SASL EXTERNAL handshake, then an operation:
+ * 1. Programmatic setTls(cert/key) + setAuthentication(EXTERNAL) -> put/get.
+ * 2. hotrods:// URI carrying the client cert/key + sasl_mechanism=EXTERNAL -> same.
+ *
+ * Mirrors Infinispan's own AuthenticationCertIT. Excluded from the default CI unit
+ * run via the "integration;docker;auth;tls" label.
+ */
+#include
+#include "hotrod/RemoteCache.h"
+#include "hotrod/HotRodClientException.h"
+
+#include
+#include
+#include
+#include
+#include
+
+using namespace hotrod;
+
+namespace {
+
+// Starts/stops the EXTERNAL (mutual TLS + SASL) Infinispan container once for the
+// whole suite and carries the trust anchor + client identity it exports.
+class ExternalServerEnvironment : public ::testing::Environment {
+public:
+ static std::string containerID;
+ static std::string host;
+ static int port;
+ static std::string caFile;
+ static std::string clientCertFile;
+ static std::string clientKeyFile;
+
+ void SetUp() override {
+ int result = system("./scripts/start_infinispan_mtls.sh infinispan-external.xml "
+ "> /tmp/ispn-external-env.sh 2>&1");
+ if (result != 0) {
+ throw std::runtime_error("Failed to start EXTERNAL Infinispan server. Check Docker is running.");
+ }
+
+ std::ifstream env("/tmp/ispn-external-env.sh");
+ if (!env.is_open()) {
+ throw std::runtime_error("Failed to open /tmp/ispn-external-env.sh");
+ }
+
+ std::string line;
+ while (std::getline(env, line)) {
+ if (line.rfind("export ISPN_CONTAINER_ID=", 0) == 0) {
+ containerID = line.substr(25);
+ } else if (line.rfind("export ISPN_HOST=", 0) == 0) {
+ host = line.substr(17);
+ } else if (line.rfind("export ISPN_PORT=", 0) == 0) {
+ port = std::stoi(line.substr(17));
+ } else if (line.rfind("export ISPN_CA_FILE=", 0) == 0) {
+ caFile = line.substr(20);
+ } else if (line.rfind("export ISPN_CLIENT_CERT_FILE=", 0) == 0) {
+ clientCertFile = line.substr(29);
+ } else if (line.rfind("export ISPN_CLIENT_KEY_FILE=", 0) == 0) {
+ clientKeyFile = line.substr(28);
+ }
+ }
+
+ if (containerID.empty() || port == 0 || caFile.empty() ||
+ clientCertFile.empty() || clientKeyFile.empty()) {
+ throw std::runtime_error("Failed to parse EXTERNAL server info from startup script");
+ }
+ }
+
+ void TearDown() override {
+ if (!containerID.empty()) {
+ std::string cmd = "./scripts/stop_infinispan.sh " + containerID + " >/dev/null";
+ std::ignore = system(cmd.c_str());
+ }
+ }
+};
+
+std::string ExternalServerEnvironment::containerID;
+std::string ExternalServerEnvironment::host = "localhost";
+int ExternalServerEnvironment::port = 0;
+std::string ExternalServerEnvironment::caFile;
+std::string ExternalServerEnvironment::clientCertFile;
+std::string ExternalServerEnvironment::clientKeyFile;
+
+// TlsConfig trusting the server CA and presenting the test client cert/key.
+TlsConfig mutualTlsConfig() {
+ TlsConfig tls;
+ tls.enabled = true;
+ tls.ca_file = ExternalServerEnvironment::caFile;
+ tls.cert_file = ExternalServerEnvironment::clientCertFile;
+ tls.key_file = ExternalServerEnvironment::clientKeyFile;
+ return tls;
+}
+
+} // namespace
+
+// Cache pre-defined in infinispan-external.xml.
+constexpr const char* kExternalCache = "externalcache";
+
+// 1. Programmatic EXTERNAL: present the client cert at the TLS layer and run the
+// SASL EXTERNAL handshake (identity derived server-side from the cert). A
+// put/get then round-trips.
+TEST(ExternalAuthIntegrationTest, CertIdentityRoundTrips) {
+ RemoteCache cache(ExternalServerEnvironment::host, ExternalServerEnvironment::port, kExternalCache);
+ cache.setTls(mutualTlsConfig());
+
+ Authentication auth;
+ auth.mechanism = "EXTERNAL"; // identity from the client cert; no password/token
+ cache.setAuthentication(auth);
+
+ cache.connect();
+
+ const ByteArray key{'e', 'x', 't', '1'};
+ const ByteArray value{'v', '1'};
+ cache.put(key, value).get();
+ auto got = cache.get(key).get();
+
+ ASSERT_TRUE(got.has_value());
+ EXPECT_EQ(*got, value);
+
+ cache.disconnect();
+}
+
+// 2. Same, driven from a hotrods:// URI: the client cert/key come from the mutual-TLS
+// URI keys and the mechanism from sasl_mechanism=EXTERNAL. Proves the
+// fromUri() parse -> setTls + setAuthentication -> connect -> op chain for a
+// cert-identity mechanism (no userinfo in the URI).
+TEST(ExternalAuthIntegrationTest, FromUriExternalRoundTrips) {
+ const std::string uri =
+ "hotrods://" + ExternalServerEnvironment::host + ":" +
+ std::to_string(ExternalServerEnvironment::port) +
+ "?ca_file=" + ExternalServerEnvironment::caFile +
+ "&client_cert_file=" + ExternalServerEnvironment::clientCertFile +
+ "&client_key_file=" + ExternalServerEnvironment::clientKeyFile +
+ "&sasl_mechanism=EXTERNAL";
+
+ auto cache = RemoteCache::fromUri(uri, kExternalCache);
+ cache->connect();
+
+ const ByteArray key{'u', 'r', 'i', 'e', 'x', 't'};
+ const ByteArray value{'v', '1'};
+ cache->put(key, value).get();
+ auto got = cache->get(key).get();
+
+ ASSERT_TRUE(got.has_value());
+ EXPECT_EQ(*got, value);
+
+ cache->disconnect();
+}
+
+int main(int argc, char** argv) {
+ // No signal(SIGPIPE, SIG_IGN): the client suppresses SIGPIPE per-connection
+ // (see TlsIntegrationTest for the rationale).
+ ::testing::InitGoogleTest(&argc, argv);
+ ::testing::AddGlobalTestEnvironment(new ExternalServerEnvironment());
+ return RUN_ALL_TESTS();
+}
diff --git a/tests/integration/MutualTlsIntegrationTest.cpp b/tests/integration/MutualTlsIntegrationTest.cpp
new file mode 100644
index 0000000..32b71c2
--- /dev/null
+++ b/tests/integration/MutualTlsIntegrationTest.cpp
@@ -0,0 +1,183 @@
+/**
+ * Mutual TLS Integration Tests (Docker-backed), issue #10 integration coverage.
+ *
+ * Runs against a mutual-TLS Infinispan server started by
+ * scripts/start_infinispan_mtls.sh (Hot Rod endpoint with require-ssl-client-auth
+ * and a client-CA truststore, no SASL). The client trusts the server CA
+ * (test-configs/tls/ca.pem) and presents the test client certificate
+ * (test-configs/tls/client.pem + client.key). Verifies the real wire end-to-end:
+ * 1. Programmatic setTls(ca + client cert/key) -> connect + put/get over mTLS.
+ * 2. hotrods:// URI carrying ca_file + client_cert_file + client_key_file -> same.
+ * 3. No client certificate -> the server rejects the TLS handshake -> connect()
+ * throws (require-ssl-client-auth enforced at the transport layer).
+ *
+ * The companion ExternalAuthIntegrationTest layers SASL EXTERNAL on the same
+ * fixtures; this suite isolates the client's mutual-TLS cert presentation (#18)
+ * with no SASL.
+ *
+ * Excluded from the default CI unit run via the "integration;docker;tls" label.
+ */
+#include
+#include "hotrod/RemoteCache.h"
+#include "hotrod/HotRodClientException.h"
+
+#include
+#include
+#include
+#include
+#include
+
+using namespace hotrod;
+
+namespace {
+
+// Starts/stops the mutual-TLS Infinispan container once for the whole suite and
+// carries the trust anchor + client identity the start script exports.
+class MutualTlsServerEnvironment : public ::testing::Environment {
+public:
+ static std::string containerID;
+ static std::string host;
+ static int port;
+ static std::string caFile;
+ static std::string clientCertFile;
+ static std::string clientKeyFile;
+
+ void SetUp() override {
+ int result = system("./scripts/start_infinispan_mtls.sh > /tmp/ispn-mtls-env.sh 2>&1");
+ if (result != 0) {
+ throw std::runtime_error("Failed to start mutual-TLS Infinispan server. Check Docker is running.");
+ }
+
+ std::ifstream env("/tmp/ispn-mtls-env.sh");
+ if (!env.is_open()) {
+ throw std::runtime_error("Failed to open /tmp/ispn-mtls-env.sh");
+ }
+
+ std::string line;
+ while (std::getline(env, line)) {
+ if (line.rfind("export ISPN_CONTAINER_ID=", 0) == 0) {
+ containerID = line.substr(25);
+ } else if (line.rfind("export ISPN_HOST=", 0) == 0) {
+ host = line.substr(17);
+ } else if (line.rfind("export ISPN_PORT=", 0) == 0) {
+ port = std::stoi(line.substr(17));
+ } else if (line.rfind("export ISPN_CA_FILE=", 0) == 0) {
+ caFile = line.substr(20);
+ } else if (line.rfind("export ISPN_CLIENT_CERT_FILE=", 0) == 0) {
+ clientCertFile = line.substr(29);
+ } else if (line.rfind("export ISPN_CLIENT_KEY_FILE=", 0) == 0) {
+ clientKeyFile = line.substr(28);
+ }
+ }
+
+ if (containerID.empty() || port == 0 || caFile.empty() ||
+ clientCertFile.empty() || clientKeyFile.empty()) {
+ throw std::runtime_error("Failed to parse mutual-TLS server info from startup script");
+ }
+ }
+
+ void TearDown() override {
+ if (!containerID.empty()) {
+ std::string cmd = "./scripts/stop_infinispan.sh " + containerID + " >/dev/null";
+ std::ignore = system(cmd.c_str());
+ }
+ }
+};
+
+std::string MutualTlsServerEnvironment::containerID;
+std::string MutualTlsServerEnvironment::host = "localhost";
+int MutualTlsServerEnvironment::port = 0;
+std::string MutualTlsServerEnvironment::caFile;
+std::string MutualTlsServerEnvironment::clientCertFile;
+std::string MutualTlsServerEnvironment::clientKeyFile;
+
+// Build a TlsConfig trusting the server CA and presenting the test client cert/key.
+TlsConfig mutualTlsConfig() {
+ TlsConfig tls;
+ tls.enabled = true;
+ tls.ca_file = MutualTlsServerEnvironment::caFile;
+ tls.cert_file = MutualTlsServerEnvironment::clientCertFile;
+ tls.key_file = MutualTlsServerEnvironment::clientKeyFile;
+ return tls; // hostname_validation stays on; client dials localhost (in SAN)
+}
+
+} // namespace
+
+// Cache pre-defined in infinispan-mtls.xml.
+constexpr const char* kMtlsCache = "mtlscache";
+
+// 1. Programmatic mutual TLS: trust the server CA, present the client cert/key,
+// connect, round-trip a value. The server verifies the client cert against its
+// truststore (require-ssl-client-auth).
+TEST(MutualTlsIntegrationTest, ClientCertRoundTrips) {
+ RemoteCache cache(MutualTlsServerEnvironment::host, MutualTlsServerEnvironment::port, kMtlsCache);
+ cache.setTls(mutualTlsConfig());
+ cache.connect();
+
+ const ByteArray key{'m', 't', 'l', 's', '1'};
+ const ByteArray value{'v', '1'};
+ cache.put(key, value).get();
+ auto got = cache.get(key).get();
+
+ ASSERT_TRUE(got.has_value());
+ EXPECT_EQ(*got, value);
+
+ cache.disconnect();
+}
+
+// 2. Same round-trip driven from a hotrods:// URI carrying the PEM trust anchor and
+// the PEM client cert/key (mutual-TLS URI keys, #18).
+TEST(MutualTlsIntegrationTest, FromUriClientCertRoundTrips) {
+ const std::string uri =
+ "hotrods://" + MutualTlsServerEnvironment::host + ":" +
+ std::to_string(MutualTlsServerEnvironment::port) +
+ "?ca_file=" + MutualTlsServerEnvironment::caFile +
+ "&client_cert_file=" + MutualTlsServerEnvironment::clientCertFile +
+ "&client_key_file=" + MutualTlsServerEnvironment::clientKeyFile;
+
+ auto cache = RemoteCache::fromUri(uri, kMtlsCache);
+ cache->connect();
+
+ const ByteArray key{'u', 'r', 'i', 'm', 't', 'l', 's'};
+ const ByteArray value{'v', '1'};
+ cache->put(key, value).get();
+ auto got = cache->get(key).get();
+
+ ASSERT_TRUE(got.has_value());
+ EXPECT_EQ(*got, value);
+
+ cache->disconnect();
+}
+
+// 3. No client certificate against a server that requires one: the server rejects
+// the connection. Trust of the server is correct; only the missing client cert
+// differs. With require-ssl-client-auth the server aborts, but under TLS 1.3 the
+// client's SSL_connect() can return before the server's "certificate required"
+// alert arrives, so the failure may surface at connect() OR on the first
+// operation — either way an exception must be thrown before a value round-trips
+// (same pattern as AuthIntegrationTest.NoCredentialsFails).
+TEST(MutualTlsIntegrationTest, NoClientCertRejected) {
+ RemoteCache cache(MutualTlsServerEnvironment::host, MutualTlsServerEnvironment::port, kMtlsCache);
+ cache.setTls(MutualTlsServerEnvironment::caFile); // server-auth only, no client cert
+
+ bool threw = false;
+ try {
+ cache.connect();
+ const ByteArray key{'n', 'o', 'c', 'e', 'r', 't'};
+ cache.put(key, ByteArray{'x'}).get();
+ } catch (const std::exception&) {
+ threw = true;
+ }
+ EXPECT_TRUE(threw);
+
+ cache.disconnect();
+}
+
+int main(int argc, char** argv) {
+ // Deliberately NO signal(SIGPIPE, SIG_IGN): the client suppresses SIGPIPE
+ // per-connection, so a TLS handshake the server aborts must surface as a thrown
+ // exception, not kill this process (see TlsIntegrationTest for the rationale).
+ ::testing::InitGoogleTest(&argc, argv);
+ ::testing::AddGlobalTestEnvironment(new MutualTlsServerEnvironment());
+ return RUN_ALL_TESTS();
+}