'Create a L{TLSMemoryBIOFactory}.
@param contextFactory: Configuration parameters used to create an
OpenSSL connection.  In order of preference, what you should pass
here should be:
1. L{twisted.internet.ssl.CertificateOptions} (if you\'re
writing a server) or the result of
L{twisted.internet.ssl.optionsForClientTLS} (if you\'re
writing a client).  If you want security you should really
use one of these.
2. If you really want to implement something yourself, supply a
provider of L{IOpenSSLClientConnectionCreator} or
L{IOpenSSLServerConnectionCreator}.
3. If you really have to, supply a
L{twisted.internet.ssl.ContextFactory}.  This will likely be
deprecated at some point so please upgrade to the new
interfaces.
@type contextFactory: L{IOpenSSLClientConnectionCreator} or
L{IOpenSSLServerConnectionCreator}, or, for compatibility with
older code, anything implementing
L{twisted.internet.interfaces.IOpenSSLContextFactory}.  See
U{https://twistedmatrix.com/trac/ticket/7215} for information on
the upcoming deprecation of passing a
L{twisted.internet.ssl.ContextFactory} here.
@param isClient: Is this a factory for TLS client connections; in other
words, those that will send a C{ClientHello} greeting?  L{True} if
so, L{False} otherwise.  This flag determines what interface is
expected of C{contextFactory}.  If L{True}, C{contextFactory}
should provide L{IOpenSSLClientConnectionCreator}; otherwise it
should provide L{IOpenSSLServerConnectionCreator}.
@type isClient: L{bool}
@param wrappedFactory: A factory which will create the
application-level protocol.
@type wrappedFactory: L{twisted.internet.interfaces.IProtocolFactory}'

def __init__(self, contextFactory, isClient, wrappedFactory):

    WrappingFactory.__init__(self, wrappedFactory)
    if isClient:
        creatorInterface = IOpenSSLClientConnectionCreator
    else:
        creatorInterface = IOpenSSLServerConnectionCreator
    self._creatorInterface = creatorInterface
    if (not creatorInterface.providedBy(contextFactory)):
        contextFactory = _ContextFactoryToConnectionFactory(contextFactory)
    self._connectionCreator = contextFactory
