'If multiple separate TLS messages are received in a single chunk from
the underlying transport, all of the application bytes from each
message are delivered to the application-level protocol.'

def test_multipleWrites(self):

    data = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i']
    class SimpleSendingProtocol(Protocol, ):
        def connectionMade(self):
            for b in data:
                self.transport.write(b)
    clientFactory = ClientFactory()
    clientFactory.protocol = SimpleSendingProtocol
    clientContextFactory = HandshakeCallbackContextFactory()
    wrapperFactory = TLSMemoryBIOFactory(clientContextFactory, True, clientFactory)
    sslClientProtocol = wrapperFactory.buildProtocol(None)
    serverProtocol = AccumulatingProtocol(sum(map(len, data)))
    serverFactory = ServerFactory()
    serverFactory.protocol = (lambda : serverProtocol)
    serverContextFactory = ServerTLSContext()
    wrapperFactory = TLSMemoryBIOFactory(serverContextFactory, False, serverFactory)
    sslServerProtocol = wrapperFactory.buildProtocol(None)
    connectionDeferred = loopbackAsync(sslServerProtocol, sslClientProtocol, collapsingPumpPolicy)
    def cbConnectionDone(ignored):
        self.assertEqual(''.join(serverProtocol.received), ''.join(data))
    connectionDeferred.addCallback(cbConnectionDone)
    return connectionDeferred
