'When passed an SSL strports description, L{clientFromString} returns a
L{SSL4ClientEndpoint} instance initialized with the values from the
string.'

def test_ssl(self):

    reactor = object()
    client = endpoints.clientFromString(reactor, ('ssl:host=example.net:port=4321:privateKey=%s:certKey=%s:bindAddress=10.0.0.3:timeout=3:caCertsDir=%s' % (escapedPEMPathName, escapedPEMPathName, escapedCAsPathName)))
    self.assertIsInstance(client, endpoints.SSL4ClientEndpoint)
    self.assertIs(client._reactor, reactor)
    self.assertEqual(client._host, 'example.net')
    self.assertEqual(client._port, 4321)
    self.assertEqual(client._timeout, 3)
    self.assertEqual(client._bindAddress, ('10.0.0.3', 0))
    certOptions = client._sslContextFactory
    self.assertIsInstance(certOptions, CertificateOptions)
    self.assertEqual(certOptions.method, SSLv23_METHOD)
    self.assertTrue((certOptions._options & OP_NO_SSLv3))
    ctx = certOptions.getContext()
    self.assertIsInstance(ctx, ContextType)
    self.assertEqual(Certificate(certOptions.certificate), testCertificate)
    privateCert = PrivateCertificate(certOptions.certificate)
    privateCert._setPrivateKey(KeyPair(certOptions.privateKey))
    self.assertEqual(privateCert, testPrivateCertificate)
    expectedCerts = [Certificate.loadPEM(x.getContent()) for x in [casPath.child('thing1.pem'), casPath.child('thing2.pem')] if x.basename().lower().endswith('.pem')]
    addedCerts = []
    class ListCtx(object, ):
        def get_cert_store(self):
            class Store(object, ):
                def add_cert(self, cert):
                    addedCerts.append(cert)
            return Store()
    certOptions.trustRoot._addCACertsToContext(ListCtx())
    self.assertEqual(sorted((Certificate(x) for x in addedCerts), key=(lambda cert: cert.digest())), sorted(expectedCerts, key=(lambda cert: cert.digest())))
