'L{wrapProtocol}, when passed a L{Protocol} should return something that
has write(), writeSequence(), loseConnection() methods which call the
Protocol\'s dataReceived() and connectionLost() methods, respectively.'

def test_wrapProtocol(self):

    protocol = MockProtocol()
    protocol.transport = StubTransport()
    protocol.connectionMade()
    wrapped = session.wrapProtocol(protocol)
    wrapped.dataReceived('dataReceived')
    self.assertEqual(protocol.transport.buf, 'dataReceived')
    wrapped.write('data')
    wrapped.writeSequence(['1', '2'])
    wrapped.loseConnection()
    self.assertEqual(protocol.data, 'data12')
    protocol.reason.trap(error.ConnectionDone)
