'Start handshake between TLS client and server.'

def handshakeProtocols(self):

    clientFactory = ClientFactory()
    clientFactory.protocol = Protocol
    (clientContextFactory, handshakeDeferred) = HandshakeCallbackContextFactory.factoryAndDeferred()
    wrapperFactory = TLSMemoryBIOFactory(clientContextFactory, True, clientFactory)
    sslClientProtocol = wrapperFactory.buildProtocol(None)
    serverFactory = ServerFactory()
    serverFactory.protocol = Protocol
    serverContextFactory = ServerTLSContext()
    wrapperFactory = TLSMemoryBIOFactory(serverContextFactory, False, serverFactory)
    sslServerProtocol = wrapperFactory.buildProtocol(None)
    connectionDeferred = loopbackAsync(sslServerProtocol, sslClientProtocol)
    return (sslClientProtocol, sslServerProtocol, handshakeDeferred, connectionDeferred)
