'C{connectionMade} and C{connectionLost} are called on the protocol by
the C{SerialPort}.'

def test_connectionMadeLost(self):

    class DummySerialPort(serialport.SerialPort, ):
        _serialFactory = DoNothing
        def _finishPortSetup(self):
            pass
    events = []
    class SerialProtocol(Protocol, ):
        def connectionMade(self):
            events.append('connectionMade')
        def connectionLost(self, reason):
            events.append(('connectionLost', reason))
    port = DummySerialPort(SerialProtocol(), '', reactor=DoNothing())
    self.assertEqual(events, ['connectionMade'])
    f = Failure(ConnectionDone())
    port.connectionLost(f)
    self.assertEqual(events, ['connectionMade', ('connectionLost', f)])
