Ticket #1442: endpoints4.diff
| File endpoints4.diff, 25.7 KB (added by rwall, 7 years ago) |
|---|
-
twisted/test/test_endpoints.py
1 from zope.interface import implements, Interface 2 1 3 from twisted.trial import unittest 2 4 from twisted.internet import (defer, error, interfaces, reactor, 3 5 _sslverify as sslverify) … … 2 4 from twisted.internet.address import IPv4Address, UNIXAddress 3 from twisted.internet.protocol import ClientFactory, Protocol, ServerFactory 4 from twisted.internet.endpoints import (TCPEndpoint, UNIXEndpoint) 5 from twisted.internet.protocol import ClientFactory, Protocol 6 from twisted.internet.endpoints import (TCPServerEndpoint, TCPClientEndpoint, 7 SSLTCPServerEndpoint, 8 SSLTCPClientEndpoint, 9 UNIXServerEndpoint, UNIXClientEndpoint) 5 10 from twisted.test.test_sslverify import makeCertificate 6 11 7 class ServerProtocol(Protocol):8 def connectionMade(self):9 self.factory.onConnectionMade.callback(self)10 12 11 def connectionLost(self, *a): 12 self.factory.onConnectionLost.callback(self) 13 14 class ClientProtocol(Protocol): 13 class TestProtocol(Protocol): 14 """I am a protocol whose only function is to callback deferreds on my 15 factory when I am connected and when I am disconnected. 16 """ 17 15 18 def connectionMade(self): … … 20 23 def connectionLost(self, *a): 21 24 self.factory.onConnectionLost.callback(self) 22 25 23 class MyServerFactory(ServerFactory):24 protocol = ServerProtocol25 26 def __init__(self):27 self.onConnectionMade = defer.Deferred()28 self.onConnectionLost = defer.Deferred()29 26 30 class MyClientFactory(ClientFactory): 31 protocol = ClientProtocol 27 class TestFactory(ClientFactory): 28 """I am a simple factory to be used both when connecting and listening. I 29 contain two deferreds which are called back when my protocol connects and 30 disconnects. 31 """ 32 32 33 protocol = TestProtocol 34 33 35 def __init__(self): 34 36 self.onConnectionMade = defer.Deferred() 35 37 self.onConnectionLost = defer.Deferred() 36 38 39 37 40 class PortAndConnectorCleanerUpper(unittest.TestCase): 41 """I am a base class for Endpoint testcases. I clean up all the Ports and 42 Connectors used in subclass test methods (provided that I know about them). 43 When a subclass creates a server, the resulting Port should be appended to 44 my list of listeningPorts. 45 When my subclasses create a client, the resulting connector should be 46 appended to my list of clientConnectors. 47 """ 48 38 49 def setUp(self): 50 """Setup my fresh lists for listeningPorts and clientConnections""" 39 51 self.listeningPorts = [] 40 52 self.clientConnections = [] 41 53 42 54 def tearDown(self): 55 """Stoplistening on all Ports and disconnect all connectors""" 43 56 map(lambda p: p.stopListening(), self.listeningPorts) 44 57 map(lambda c: c.disconnect(), self.clientConnections) 45 58 59 60 class IEndpointTestCase(Interface): 61 """I provide methods for creating servers / clients and server / client 62 endpoints""" 63 64 def createServer(factory): 65 """Create a server 66 67 @param factory: A provider of I{IProtocolFactory} 68 """ 69 70 def createClient(address, factory): 71 """Create a client 72 73 @param address: A provider of I{IAddress} 74 @param factory: A provider of I{IProtocolFactory} 75 """ 76 77 def createServerEndpoint(address=None): 78 """Create an ServerEndpoint. 79 80 @param address: An optional provider of I{IAddress}. If omitted a 81 suitable free address will be chosen. 82 """ 83 84 def createClientEndpoint(address): 85 """Create an ClientEndpoint. 86 87 @param address: A provider of I{IAddress} to which the endpoint will be 88 required to connect. 89 """ 90 91 46 92 class EndpointTestCaseMixin(object): 93 """Generic test methods to be mixed into all EndpointTest classes. Classes 94 that mix me in, should provide IEndpointTestCase""" 95 47 96 def test_EndpointConnectSuccess(self): 48 """Test that Endpoint can connect and returns a deferred who97 """Test that a client Endpoint can connect and returns a deferred who 49 98 gets called back with a protocol instance. 50 99 """ 51 sf = MyServerFactory()100 sf = TestFactory() 52 101 p = self.createServer(sf) 53 102 addr = p.getHost() 54 ep = self.create Endpoint(addr)55 cf = MyClientFactory()56 d = ep.connect( reactor,cf)103 ep = self.createClientEndpoint(addr) 104 cf = TestFactory() 105 d = ep.connect(cf) 57 106 self.assertTrue(isinstance(d, defer.Deferred)) 58 107 def onConnectSuccess(proto): 59 108 self.assertTrue(interfaces.IProtocol.providedBy(proto)) … … 65 114 """Test that if an Endpoint tries to connect to a none 66 115 listening port that it gets a ConnectError failure. 67 116 """ 68 p = self.createServer( MyServerFactory())117 p = self.createServer(TestFactory()) 69 118 addr = p.getHost() 70 119 p.loseConnection() 71 120 72 ep = self.create Endpoint(addr)73 d = ep.connect( reactor, MyClientFactory())121 ep = self.createClientEndpoint(addr) 122 d = ep.connect(TestFactory()) 74 123 self.failUnlessFailure(d, error.ConnectError) 75 124 return d 76 125 … … 78 127 """Test that Endpoint can listen and returns a deferred that 79 128 gets called back with a port instance. 80 129 """ 81 ep = self.create Endpoint()82 sf = MyServerFactory()83 d = ep.listen( reactor,sf)130 ep = self.createServerEndpoint() 131 sf = TestFactory() 132 d = ep.listen(sf) 84 133 self.assertTrue(isinstance(d, defer.Deferred)) 85 134 def onListenSuccess(port): 86 135 self.assertTrue(interfaces.IListeningPort.providedBy(port)) … … 88 137 return port.getHost() 89 138 d.addCallback(onListenSuccess) 90 139 def connectTo(addr): 91 self.createClient(addr, MyClientFactory())140 self.createClient(addr, TestFactory()) 92 141 d.addCallback(connectTo) 93 142 return defer.gatherResults([sf.onConnectionMade, d]) 94 143 … … 96 145 """Test that if Endpoint tries to listen on an already listening 97 146 port, that a CannotListenError failure is errbacked. 98 147 """ 99 p = self.createServer( MyServerFactory())148 p = self.createServer(TestFactory()) 100 149 addr = p.getHost() 101 ep = self.create Endpoint(addr)102 d = ep.listen( reactor, MyServerFactory())150 ep = self.createServerEndpoint(addr) 151 d = ep.listen(TestFactory()) 103 152 self.failUnlessFailure(d, error.CannotListenError) 104 153 return d 105 154 155 106 156 class TCPEndpointsTestCase(PortAndConnectorCleanerUpper, EndpointTestCaseMixin): 157 """Tests for TCP Endpoints""" 158 159 implements(IEndpointTestCase) 160 107 161 def createServer(self, factory): 108 162 p = reactor.listenTCP(0, factory) 109 163 self.listeningPorts.append(p) … … 114 168 self.clientConnections.append(c) 115 169 return c 116 170 117 def create Endpoint(self, address=None):118 if not address:171 def createServerEndpoint(self, address=None): 172 if address is None: 119 173 address = IPv4Address("TCP", "localhost", 0) 120 return TCP Endpoint(address.host, address.port)174 return TCPServerEndpoint(reactor, address.port) 121 175 176 def createClientEndpoint(self, address): 177 return TCPClientEndpoint(reactor, address.host, address.port) 178 179 122 180 class SSLEndpointsTestCase(PortAndConnectorCleanerUpper, EndpointTestCaseMixin): 181 """Tests for SSL Endpoints""" 123 182 183 implements(IEndpointTestCase) 184 124 185 def setUpClass(self): 186 """Set up client and server SSL contexts for use later.""" 125 187 self.sKey, self.sCert = makeCertificate( 126 188 O="Server Test Certificate", 127 189 CN="server") … … 142 204 self.clientConnections.append(c) 143 205 return c 144 206 145 def create Endpoint(self, address=None):146 if not address:207 def createServerEndpoint(self, address=None): 208 if address is None: 147 209 address = IPv4Address("TCP", "localhost", 0) 148 return TCPEndpoint(address.host, address.port, 149 sslContextFactory=self.clientSSLContext) 150 210 return SSLTCPServerEndpoint(reactor, address.port, 211 self.clientSSLContext) 151 212 213 def createClientEndpoint(self, address): 214 return SSLTCPClientEndpoint(reactor, address.host, address.port, 215 self.clientSSLContext) 216 217 152 218 class UNIXEndpointsTestCase(PortAndConnectorCleanerUpper, EndpointTestCaseMixin): 219 """Tests for UnixSocket Endpoints""" 220 221 implements(IEndpointTestCase) 222 153 223 def createServer(self, factory): 154 224 p = reactor.listenUNIX(self.mktemp(), factory) 155 225 self.listeningPorts.append(p) … … 160 230 self.clientConnections.append(c) 161 231 return c 162 232 163 def create Endpoint(self, address=None):164 if not address:233 def createServerEndpoint(self, address=None): 234 if address is None: 165 235 address = UNIXAddress(self.mktemp()) 166 return UNIXEndpoint(address.name) 236 return UNIXServerEndpoint(reactor, address.name) 237 238 def createClientEndpoint(self, address=None): 239 return UNIXClientEndpoint(reactor, address.name) -
twisted/test/test_address.py
1 import re 2 3 from twisted.trial import unittest 4 from twisted.internet.address import IPv4Address, UNIXAddress 5 6 7 class AddressTestCaseMixin(object): 8 def test_AddressComparison(self): 9 """Test that two different address instances, sharing the same 10 properties are considered equal.""" 11 self.assertEquals(self.buildAddress(), self.buildAddress()) 12 13 def test_StringRepresentation(self): 14 """Test that when addresses are converted to strings, they adhere to a 15 standard pattern. Not sure if it's worth it, but seemed like a bit of 16 fun and demonstrates an inconsistency with UNIXAddress.__str__ 17 """ 18 addr = self.buildAddress() 19 pattern = "".join([ 20 "^", 21 "([^\(]+Address)", # class name, 22 "\(", # opening bracket, 23 "([^)]+)", # arguments, 24 "\)", # closing bracket, 25 "$" 26 ]) 27 m = re.match(pattern, str(addr)) 28 self.assertNotEqual(None, m, 29 "%s does not match the standard __str__ pattern " 30 "ClassName(arg1, arg2, etc)" % str(addr)) 31 self.assertEqual(addr.__class__.__name__, m.group(1)) 32 33 args = [x.strip() for x in m.group(2).split(",")] 34 self.assertEqual(len(args), len(self.addressArgSpec)) 35 def checkArg(arg, argSpec): 36 self.assertEqual(argSpec[1] % getattr(addr, argSpec[0]), arg) 37 map(checkArg, args, self.addressArgSpec) 38 39 40 class IPv4AddressTestCaseMixin(AddressTestCaseMixin): 41 def setUpClass(self): 42 self.addressArgSpec = (("type", "%s"), ("host", "%r"), ("port", "%d")) 43 44 45 class IPv4AddressTCPTestCase(unittest.TestCase, IPv4AddressTestCaseMixin): 46 def buildAddress(self): 47 return IPv4Address("TCP", "127.0.0.1", 0) 48 49 50 class IPv4AddressUDPTestCase(unittest.TestCase, IPv4AddressTestCaseMixin): 51 def buildAddress(self): 52 return IPv4Address("UDP", "127.0.0.1", 0) 53 54 55 class UNIXAddressTestCase(unittest.TestCase, AddressTestCaseMixin): 56 def setUpClass(self): 57 self._socketAddress = self.mktemp() 58 self.addressArgSpec = (("name", "%r"),) 59 60 def buildAddress(self): 61 return UNIXAddress(self._socketAddress) -
twisted/internet/endpoints.py
1 1 # -*- test-case-name: twisted.test.test_endpoints -*- 2 2 3 from zope.interface import implements , providedBy, directlyProvides3 from zope.interface import implements 4 4 5 5 from twisted.internet import interfaces 6 from twisted.internet import defer , protocol6 from twisted.internet import defer 7 7 from twisted.internet.protocol import ClientFactory, Protocol 8 8 9 9 10 class _WrappingProtocol(Protocol): 10 11 """I wrap another protocol in order to notify my user when a connection has 11 12 been made. … … 23 24 """ 24 25 25 26 self.wrappedProtocol.makeConnection(self.transport) 26 self.factory. deferred.callback(self.wrappedProtocol)27 self.factory.onFirstConnection.callback(self.wrappedProtocol) 27 28 28 29 def dataReceived(self, data): 29 30 return self.wrappedProtocol.dataReceived(data) … … 32 33 return self.wrappedProtocol.connectionLost(reason) 33 34 34 35 class _WrappingFactory(ClientFactory): 36 """I wrap a factory in order to wrap the protocols it builds.""" 35 37 protocol = _WrappingProtocol 36 38 37 39 def __init__(self, wrappedFactory): 40 """ 41 @param wrappedFactory: A provider of I{IProtocolFactory} whose 42 buildProtocol method will be called and whose resulting protocol will be 43 wrapped. 44 """ 38 45 self.wrappedFactory = wrappedFactory 39 self. deferred= defer.Deferred()46 self.onFirstConnection = defer.Deferred() 40 47 41 48 def buildProtocol(self, addr): 42 49 try: 43 50 proto = self.wrappedFactory.buildProtocol(addr) 44 51 except: 45 self. deferred.errback()52 self.onFirstConnection.errback() 46 53 else: 47 54 return self.protocol(self, proto) 48 55 49 56 def clientConnectionFailed(self, connector, reason): 50 self. deferred.errback(reason)57 self.onFirstConnection.errback(reason) 51 58 52 59 53 class TCPEndpoint(object): 54 implements(interfaces.IClientEndpoint, interfaces.IServerEndpoint) 60 class TCPServerEndpoint(object): 61 """I am a TCP server endpoint.""" 62 63 implements(interfaces.IServerEndpoint) 55 64 56 def __init__(self, host, port, connectArgs={}, listenArgs={}, 57 sslContextFactory=None): 65 def __init__(self, reactor, port, listenArgs={}): 58 66 """ 59 @param host: A hostname, used only when connecting 60 @param port: The port number, used both when connecting and listening 61 @param connectArgs: An optional dict of keyword args that will be passed 62 to L{twisted.internet.interfaces.IReactorTCP.connectTCP} 67 @param reactor: The reactor 68 @param port: The port number used listening 63 69 @param listenArgs: An optional dict of keyword args that will be passed 64 70 to L{twisted.internet.interfaces.IReactorTCP.listenTCP} 65 @param sslContextFactory: An optional instance of66 L{twisted.internet._sslverify.OpenSSLCertificateOptions}. If given, it67 makes L{connect} and L{listen} use the corresponding methods from68 L{twisted.internet.interfaces.IReactorSSL}69 71 """ 72 self.reactor = reactor 73 self.port = port 74 self.listenArgs = dict(backlog=50, interface='') 75 self.listenArgs.update(listenArgs) 76 77 def listen(self, serverFactory): 78 wf = _WrappingFactory(serverFactory) 79 return defer.execute(self.reactor.listenTCP, self.port, wf, 80 **self.listenArgs) 81 82 83 class TCPClientEndpoint(object): 84 """I am a TCP client endpoint.""" 85 86 implements(interfaces.IClientEndpoint) 87 88 def __init__(self, reactor, host, port, connectArgs={}): 89 """ 90 @param reactor: The reactor 91 @param host: A hostname, used when connecting 92 @param port: The port number, used when connecting 93 @param connectArgs: An optional dict of keyword args that will be passed 94 to L{twisted.internet.interfaces.IReactorTCP.connectTCP} 95 """ 96 self.reactor = reactor 70 97 self.host = host 71 98 self.port = port 72 99 self.connectArgs = dict(timeout=30, bindAddress=None) 73 100 self.connectArgs.update(connectArgs) 101 102 def connect(self, clientFactory): 103 wf = _WrappingFactory(clientFactory) 104 d = defer.execute(self.reactor.connectTCP, self.host, self.port, wf, 105 **self.connectArgs) 106 d.addCallback(lambda _: wf.onFirstConnection) 107 return d 108 109 110 class SSLTCPServerEndpoint(object): 111 """I am an SSL secured TCP server endpoint.""" 112 113 implements(interfaces.IServerEndpoint) 114 115 def __init__(self, reactor, port, sslContextFactory, listenArgs={}): 116 """ 117 @param reactor: The reactor 118 @param port: The port number used listening 119 @param sslContextFactory: An instance of 120 L{twisted.internet._sslverify.OpenSSLCertificateOptions}. 121 @param listenArgs: An optional dict of keyword args that will be passed 122 to L{twisted.internet.interfaces.IReactorTCP.listenTCP} 123 """ 124 self.reactor = reactor 125 self.port = port 126 self.sslContextFactory = sslContextFactory 74 127 self.listenArgs = dict(backlog=50, interface='') 75 128 self.listenArgs.update(listenArgs) 129 130 def listen(self, serverFactory): 131 wf = _WrappingFactory(serverFactory) 132 return defer.execute(self.reactor.listenSSL, self.port, wf, 133 contextFactory=self.sslContextFactory, 134 **self.listenArgs) 135 136 137 class SSLTCPClientEndpoint(object): 138 """I am an SSL secured TCP client endpoint.""" 139 140 implements(interfaces.IClientEndpoint) 141 142 def __init__(self, reactor, host, port, sslContextFactory, connectArgs={}): 143 """ 144 @param reactor: The reactor 145 @param host: A hostname, used when connecting 146 @param port: The port number, used when connecting 147 @param sslContextFactory: An instance of 148 L{twisted.internet._sslverify.OpenSSLCertificateOptions}. 149 @param connectArgs: An optional dict of keyword args that will be passed 150 to L{twisted.internet.interfaces.IReactorTCP.connectTCP} 151 """ 152 self.reactor = reactor 153 self.host = host 154 self.port = port 76 155 self.sslContextFactory = sslContextFactory 156 self.connectArgs = dict(timeout=30, bindAddress=None) 157 self.connectArgs.update(connectArgs) 77 158 78 def connect(self, reactor,clientFactory):159 def connect(self, clientFactory): 79 160 wf = _WrappingFactory(clientFactory) 80 connectArgs = self.connectArgs 81 connectMethod = reactor.connectTCP 82 if self.sslContextFactory: 83 connectMethod = reactor.connectSSL 84 connectArgs["contextFactory"] = self.sslContextFactory 85 86 d = defer.execute(connectMethod, self.host, self.port, wf, **connectArgs) 161 d = defer.execute(self.reactor.connectSSL, self.host, self.port, wf, 162 contextFactory=self.sslContextFactory, 163 **self.connectArgs) 164 d.addCallback(lambda _: wf.onFirstConnection) 165 return d 87 166 88 d.addCallback(lambda _: wf.deferred)89 167 90 return d 168 class UNIXServerEndpoint(object): 169 """I am a UnixSocket server endpoint""" 170 171 implements(interfaces.IServerEndpoint) 91 172 92 def listen(self, reactor, serverFactory): 173 def __init__(self, reactor, address, listenArgs={}): 174 """ 175 @param reactor: The reactor 176 @param address: The path to the Unix socket file, used when listening 177 @param listenArgs: A dict of keyword args that will be passed to 178 L{twisted.internet.interfaces.IReactorUNIX.listenUNIX} 179 """ 180 self.reactor = reactor 181 self.address = address 182 self.listenArgs = dict(backlog=50, mode=0666, wantPID=0) 183 self.listenArgs.update(listenArgs) 184 185 def listen(self, serverFactory): 93 186 wf = _WrappingFactory(serverFactory) 94 listenArgs = self.listenArgs 95 listenMethod = reactor.listenTCP 96 if self.sslContextFactory: 97 listenMethod = reactor.listenSSL 98 listenArgs["contextFactory"] = self.sslContextFactory 99 return defer.execute(listenMethod, self.port, wf, **listenArgs) 187 return defer.execute(self.reactor.listenUNIX, self.address, wf, 188 **self.listenArgs) 100 189 101 class UNIXEndpoint(object):102 implements(interfaces.IClientEndpoint, interfaces.IServerEndpoint)103 190 104 def __init__(self, address, connectArgs={}, listenArgs={}): 191 class UNIXClientEndpoint(object): 192 """I am a UnixSocket client endpoint""" 193 194 implements(interfaces.IClientEndpoint) 195 196 def __init__(self, reactor, address, connectArgs={}): 105 197 """ 106 @param address: The path to the Unix socket file, used both when107 connecting and listening198 @param reactor: The reactor 199 @param address: The path to the Unix socket file, used when connecting 108 200 @param connectArgs: A dict of keyword args that will be passed to 109 201 L{twisted.internet.interfaces.IReactorUNIX.connectUNIX} 110 @param listenArgs: A dict of keyword args that will be passed to111 L{twisted.internet.interfaces.IReactorUNIX.listenUNIX}112 202 """ 113 203 self.reactor = reactor 114 204 self.address = address 115 205 self.connectArgs = dict(timeout=30, checkPID=0) 116 206 self.connectArgs.update(connectArgs) 117 self.listenArgs = dict(backlog=50, mode=0666, wantPID=0)118 self.listenArgs.update(listenArgs)119 207 120 def connect(self, reactor,clientFactory):208 def connect(self, clientFactory): 121 209 wf = _WrappingFactory(clientFactory) 122 d = defer.execute( reactor.connectUNIX, self.address, wf,210 d = defer.execute(self.reactor.connectUNIX, self.address, wf, 123 211 **self.connectArgs) 124 212 125 d.addCallback(lambda _: wf. deferred)213 d.addCallback(lambda _: wf.onFirstConnection) 126 214 127 215 return d 128 129 def listen(self, reactor, serverFactory):130 wf = _WrappingFactory(serverFactory)131 return defer.execute(reactor.listenUNIX, self.address, wf,132 **self.listenArgs) -
twisted/internet/interfaces.py
18 18 19 19 Default implementations are in L{twisted.internet.address}. 20 20 """ 21 22 def buildEndpoint():23 """24 @return: an instance providing both L{IClientEndpoint} and L{IServerEndpoint}25 """26 21 27 22 28 23 ### Reactor Interfaces … … 1303 1298 class IClientEndpoint(Interface): 1304 1299 """Object that represents a remote endpoint that we wish to connect to. 1305 1300 """ 1306 def connect( reactor,clientFactory):1301 def connect(clientFactory): 1307 1302 """ 1308 @param reactor: The reactor1309 1303 @param clientFactory: A provider of L{IProtocolFactory} 1310 1304 @return: A L{Deferred} that results in an L{IProtocol} upon successful 1311 1305 connection otherwise a L{ConnectError} … … 1315 1309 """Object representing an endpoint where we will listen for connections. 1316 1310 """ 1317 1311 1318 def listen( callable):1312 def listen(serverFactory): 1319 1313 """ 1320 @param reactor: The reactor1321 1314 @param serverFactory: A provider of L{IProtocolFactory} 1322 1315 @return: A L{Deferred} that results in an L{IListeningPort} or an 1323 1316 L{CannotListenError} -
twisted/internet/address.py
9 9 from zope.interface import implements 10 10 11 11 from twisted.internet.interfaces import IAddress 12 from twisted.internet.endpoints import TCPEndpoint, UNIXEndpoint13 12 13 14 14 class IPv4Address(object): 15 15 """ 16 16 Object representing an IPv4 socket endpoint. … … 36 36 self.port = port 37 37 self._bwHack = _bwHack 38 38 39 def buildEndpoint(self):40 if self.type == "TCP":41 return TCPEndpoint(self.host, self.port)42 else:43 raise NotImplementedError44 45 39 def __getitem__(self, index): 46 40 warnings.warn("IPv4Address.__getitem__ is deprecated. Use attributes instead.", 47 41 category=DeprecationWarning, stacklevel=2) … … 79 73 self.name = name 80 74 self._bwHack = _bwHack 81 75 82 def buildEndpoint(self):83 return UNIXEndpoint(self.name)84 85 76 def __getitem__(self, index): 86 77 warnings.warn("UNIXAddress.__getitem__ is deprecated. Use attributes instead.", 87 78 category=DeprecationWarning, stacklevel=2) … … 96 87 if isinstance(other, tuple): 97 88 return tuple(self) == other 98 89 elif isinstance(other, UNIXAddress): 99 try: 100 return os.path.samefile(self.name, other.name) 101 except OSError: 102 pass 90 # First do the simple thing and check to see if the names are the 91 # same. If not, and the paths exist, check to see if they point to 92 # the same file. 93 if self.name == other.name: 94 return True 95 else: 96 try: 97 return os.path.samefile(self.name, other.name) 98 except OSError: 99 pass 103 100 return False 104 101 105 102 def __str__(self): 106 return 'UNIX Socket(%r)' % (self.name,)103 return 'UNIXAddress(%r)' % (self.name,) 107 104 108 105 109 106 # These are for buildFactory backwards compatability due to
