Current Path : /usr/lib/python2.7/dist-packages/twisted/test/ |
Current File : //usr/lib/python2.7/dist-packages/twisted/test/test_unix.pyc |
=Nc @ si d Z d d l Z d d l Z d d l Z d d l Z d d l Z d d l m Z m Z m Z m Z m Z m Z m Z d d l m Z d d l m Z d d l m Z m Z d e j f d YZ d e j f d YZ d e j f d YZ d e j f d YZ d e j f d YZ e j e d sGd e _ n e j! e d sed e _ n d S( sK Tests for implementations of L{IReactorUNIX} and L{IReactorUNIXDatagram}. iN( t interfacest reactort protocolt errort addresst defert utils( t lockfile( t unittest( t MyServerFactoryt MyClientFactoryt FailedConnectionClientFactoryc B s e Z d Z d Z RS( c C s | | _ d S( N( t onFail( t selfR ( ( s: /usr/lib/python2.7/dist-packages/twisted/test/test_unix.pyt __init__ s c C s | j j | d S( N( R t errback( R t connectort reason( ( s: /usr/lib/python2.7/dist-packages/twisted/test/test_unix.pyt clientConnectionFailed s ( t __name__t __module__R R ( ( ( s: /usr/lib/python2.7/dist-packages/twisted/test/test_unix.pyR s t UnixSocketTestCasec B sh e Z d Z d Z d Z d Z d Z d Z d Z d Z d Z d Z d Z RS( s Test unix sockets. c s j } j t t j } _ t j | } j | j t j t j t j } j | j | j | j | f d } | j | | S( s The address passed to the server factory's C{buildProtocol} method and the address returned by the connected protocol's transport's C{getPeer} method match the address the client socket is bound to. c sB t j } j j | g j | j j | d S( N( R t UNIXAddresst assertEqualt peerAddressest transportt getPeer( t protot expected( R t peernamet serverFactory( s: /usr/lib/python2.7/dist-packages/twisted/test/test_unix.pyt cbConnMade/ s ( t mktempR R t Deferredt protocolConnectionMadeR t listenUNIXt addCleanupt stopListeningt sockett AF_UNIXt SOCK_STREAMt closet bindt connectt addCallback( R t filenamet connMadet unixPortt unixSocketR ( ( R R R s: /usr/lib/python2.7/dist-packages/twisted/test/test_unix.pyt test_peerBind s c s j t } t j } | | _ t j | } j | j t t j } | _ t j } t j | | g } f d } | j | | S( s L{IReactorUNIX.connectUNIX} can be used to connect a client to a server started with L{IReactorUNIX.listenUNIX}. c sI | \ } } j j t j g | j j | j j d S( N( R R R R R t loseConnection( t .0t serverProtocolt clientProtocol( R R- t clientFactory( s: /usr/lib/python2.7/dist-packages/twisted/test/test_unix.pyt allConnectedG s ( R R R R! R"