Python twisted.internet.interfaces.IListeningPort() Examples
The following are 6
code examples of twisted.internet.interfaces.IListeningPort().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
twisted.internet.interfaces
, or try the search function
.
Example #1
Source File: test_internet.py From python-for-android with Apache License 2.0 | 6 votes |
def test_stopService(self): """ L{StreamServerEndpointService.stopService} calls C{stopListening} on the L{IListeningPort} returned from its endpoint, returns the C{Deferred} from stopService, and sets C{running} to C{False}. """ self.svc.privilegedStartService() self.fakeServer.startedListening() # Ensure running gets set to true self.svc.startService() result = self.svc.stopService() l = [] result.addCallback(l.append) self.assertEquals(len(l), 0) self.fakeServer.stoppedListening() self.assertEquals(len(l), 1) self.assertFalse(self.svc.running)
Example #2
Source File: test_tuntap.py From Safejumper-for-Desktop with GNU General Public License v2.0 | 5 votes |
def test_interface(self): """ A L{TuntapPort} instance provides L{IListeningPort}. """ port = TuntapPort(b"device", EthernetProtocol()) self.assertTrue(verifyObject(IListeningPort, port))
Example #3
Source File: test_tuntap.py From Safejumper-for-Desktop with GNU General Public License v2.0 | 5 votes |
def _stopPort(self, port): """ Verify that the C{stopListening} method of an L{IListeningPort} removes that port from the reactor's "readers" set and also that the L{Deferred} returned by that method fires with L{None}. @param port: The port object to stop. @type port: L{IListeningPort} provider """ stopped = port.stopListening() self.assertNotIn(port, self.reactor.getReaders()) # An unfortunate implementation detail self.reactor.advance(0) self.assertIsNone(self.successResultOf(stopped))
Example #4
Source File: test_tuntap.py From learn_python3_spider with MIT License | 5 votes |
def test_interface(self): """ A L{TuntapPort} instance provides L{IListeningPort}. """ port = TuntapPort(b"device", EthernetProtocol()) self.assertTrue(verifyObject(IListeningPort, port))
Example #5
Source File: test_tuntap.py From learn_python3_spider with MIT License | 5 votes |
def _stopPort(self, port): """ Verify that the C{stopListening} method of an L{IListeningPort} removes that port from the reactor's "readers" set and also that the L{Deferred} returned by that method fires with L{None}. @param port: The port object to stop. @type port: L{IListeningPort} provider """ stopped = port.stopListening() self.assertNotIn(port, self.reactor.getReaders()) # An unfortunate implementation detail self.reactor.advance(0) self.assertIsNone(self.successResultOf(stopped))
Example #6
Source File: test_udp.py From python-for-android with Apache License 2.0 | 5 votes |
def test_interface(self): """ L{IReactorUDP.listenUDP} returns an object providing L{IListeningPort}. """ reactor = self.buildReactor() port = reactor.listenUDP(0, DatagramProtocol()) self.assertTrue(verifyObject(IListeningPort, port))