Add a test to verify behavior on invalid x509 certificate