#NEWLINE# def test_writeSequence( self ) : #NEWLINE# #INDENT# '\n        Bytes written to L{TLSMemoryBIOProtocol} with C{writeSequence} are\n        received by the protocol on the other side of the connection.\n        ' #NEWLINE# bytes = 'some bytes' #NEWLINE# class SimpleSendingProtocol ( Protocol ) : #NEWLINE# #INDENT# def connectionMade( self ) : #NEWLINE# #INDENT# self . transport . writeSequence ( list ( bytes ) ) #NEWLINE# #UNINDENT# #UNINDENT# clientFactory = ClientFactory ( ) #NEWLINE# clientFactory . protocol = SimpleSendingProtocol #NEWLINE# clientContextFactory = HandshakeCallbackContextFactory ( ) #NEWLINE# wrapperFactory = TLSMemoryBIOFactory ( clientContextFactory , True , clientFactory ) #NEWLINE# sslClientProtocol = wrapperFactory . buildProtocol ( None ) #NEWLINE# serverProtocol = AccumulatingProtocol ( len ( bytes ) ) #NEWLINE# serverFactory = ServerFactory ( ) #NEWLINE# serverFactory . protocol = ( lambda : serverProtocol ) #NEWLINE# serverContextFactory = DefaultOpenSSLContextFactory ( certPath , certPath ) #NEWLINE# wrapperFactory = TLSMemoryBIOFactory ( serverContextFactory , False , serverFactory ) #NEWLINE# sslServerProtocol = wrapperFactory . buildProtocol ( None ) #NEWLINE# connectionDeferred = loopbackAsync ( sslServerProtocol , sslClientProtocol ) #NEWLINE# def cbConnectionDone( ignored ) : #NEWLINE# #INDENT# self . assertEquals ( '' . join ( serverProtocol . received ) , bytes ) #NEWLINE# #UNINDENT# connectionDeferred . addCallback ( cbConnectionDone ) #NEWLINE# return connectionDeferred