On macOS, the closed connection can lead to a "Broken pipe" error instead of
a "Connection reset by peer" error.
s.connect((HOST, server.port))
with self.assertRaisesRegex(
OSError,
- 'alert unknown ca|EOF occurred|TLSV1_ALERT_UNKNOWN_CA|closed by the remote host|Connection reset by peer'
+ 'alert unknown ca|EOF occurred|TLSV1_ALERT_UNKNOWN_CA|'
+ 'closed by the remote host|Connection reset by peer|'
+ 'Broken pipe'
):
# TLS 1.3 perform client cert exchange after handshake
s.write(b'data')