def test_logPrefix(self):
        class CustomLogPrefixDatagramProtocol(DatagramProtocol):
            def __init__(self, prefix):
                self._prefix = prefix
                self.system = Deferred()

            def logPrefix(self):
                return self._prefix

            def datagramReceived(self, bytes, addr):
                if self.system is not None:
                    system = self.system
                    self.system = None
                    system.callback(context.get(ILogContext)["system"])

        reactor = self.buildReactor()
        protocol = CustomLogPrefixDatagramProtocol("Custom Datagrams")
        d = protocol.system
        port = reactor.listenUDP(0, protocol)
        address = port.getHost()

        def gotSystem(system):
            self.assertEqual("Custom Datagrams (UDP)", system)
        d.addCallback(gotSystem)
        d.addErrback(err)
        d.addCallback(lambda ignored: reactor.stop())

        port.write("some bytes", ('127.0.0.1', address.port))
        self.runReactor(reactor)
Datagram transports implement L{ILoggingContext.logPrefix} to return a
dataset/ETHPy150Open nlloyd/SubliminalCollaborator/libs/twisted/internet/test/test_udp.py/UDPServerTestsBuilder.test_logPrefix