'Check the output produced by L{policies.TrafficLoggingFactory}.'

def test_thingsGetLogged(self):

    wrappedFactory = Server()
    wrappedFactory.protocol = WriteSequenceEchoProtocol
    t = StringTransportWithDisconnection()
    f = TestLoggingFactory(wrappedFactory, 'test')
    p = f.buildProtocol(('1.2.3.4', 5678))
    t.protocol = p
    p.makeConnection(t)
    v = f.openFile.getvalue()
    self.assertIn('*', v)
    self.assertFalse(t.value())
    p.dataReceived('here    are    some    bytes')
    v = f.openFile.getvalue()
    self.assertIn(('C    1:    %r' % ('here    are    some    bytes',)), v)
    self.assertIn(('S    1:    %r' % ('here    are    some    bytes',)), v)
    self.assertEqual(t.value(), 'here    are    some    bytes')
    t.clear()
    p.dataReceived('prepare    for    vector!    to    the    extreme')
    v = f.openFile.getvalue()
    self.assertIn(('SV    1:    %r' % (['prepare    for    vector!    to    the    extreme'],)), v)
    self.assertEqual(t.value(), 'prepare    for    vector!    to    the    extreme')
    p.loseConnection()
    v = f.openFile.getvalue()
    self.assertIn('ConnectionDone', v)
