#NEWLINE# def test_handshake( self ) : #NEWLINE# #INDENT# '\n        The TLS handshake is performed when L{TLSMemoryBIOProtocol} is\n        connected to a transport.\n        ' #NEWLINE# clientFactory = ClientFactory ( ) #NEWLINE# clientFactory . protocol = Protocol #NEWLINE# ( clientContextFactory , handshakeDeferred ) = HandshakeCallbackContextFactory . factoryAndDeferred ( ) #NEWLINE# wrapperFactory = TLSMemoryBIOFactory ( clientContextFactory , True , clientFactory ) #NEWLINE# sslClientProtocol = wrapperFactory . buildProtocol ( None ) #NEWLINE# serverFactory = ServerFactory ( ) #NEWLINE# serverFactory . protocol = Protocol #NEWLINE# serverContextFactory = DefaultOpenSSLContextFactory ( certPath , certPath ) #NEWLINE# wrapperFactory = TLSMemoryBIOFactory ( serverContextFactory , False , serverFactory ) #NEWLINE# sslServerProtocol = wrapperFactory . buildProtocol ( None ) #NEWLINE# connectionDeferred = loopbackAsync ( sslServerProtocol , sslClientProtocol ) #NEWLINE# return handshakeDeferred