
[XMc           @   s  d  Z  d d l m Z d d l m Z d d l m Z d d l m Z m	 Z	 d d l m
 Z
 d d l m Z m Z d d l m Z m Z d d	 l m Z m Z d d
 l m Z d d l m Z d d l m Z d d l m Z e d  j j d  Z e e  j j d  Z  e
 j! e j"  Z# e
 j! e  j"  Z$ yv d d l% m& Z& d d l' m( Z( m) Z) m* Z* m+ Z+ d d l, m- Z- e) j. e j/    Z0 e+ j. e j/    Z1 e2 Z3 Wn e4 k
 rd Z3 n Xd e f d     YZ5 d e5 f d     YZ6 d e f d     YZ7 d e j8 f d     YZ9 d e: f d     YZ; d e; e j8 f d      YZ< d! e; e j8 f d"     YZ= d# e; e j8 f d$     YZ> d% e j8 f d&     YZ? d' e j8 f d(     YZ@ d) d*  ZA d+ e j8 f d,     YZB d- e j8 f d.     YZC d/ S(0   s   
Test the C{I...Endpoint} implementations that wrap the L{IReactorTCP},
L{IReactorSSL}, and L{IReactorUNIX} interfaces found in
L{twisted.internet.endpoints}.
i(   t   EPERM(   t
   implements(   t   unittest(   t   errort
   interfaces(   t	   endpoints(   t   IPv4Addresst   UNIXAddress(   t   ClientFactoryt   Protocol(   t   MemoryReactort   RaisingMemoryReactor(   t   Failure(   t   plugins(   t	   getModule(   t   FilePaths   twisted.tests
   server.pemt   fake_CAs(   t   makeCertificate(   t   CertificateOptionst   Certificatet   KeyPairt   PrivateCertificate(   t   ContextTypes.   OpenSSL is required to construct SSL Endpointst   TestProtocolc           B   s2   e  Z d  Z d   Z d   Z d   Z d   Z RS(   sx   
    Protocol whose only function is to callback deferreds on the
    factory when it is connected or disconnected.
    c         C   s   g  |  _  g  |  _ d |  _ d  S(   Ni    (   t   datat   connectionsLostt   connectionMadeCalls(   t   self(    (    sH   /usr/lib/python2.7/dist-packages/twisted/internet/test/test_endpoints.pyt   __init__0   s    		c         C   s   |  j  d 7_  d  S(   Ni   (   R   (   R   (    (    sH   /usr/lib/python2.7/dist-packages/twisted/internet/test/test_endpoints.pyt   connectionMade5   s    c         C   s   |  j  j |  d  S(   N(   R   t   append(   R   R   (    (    sH   /usr/lib/python2.7/dist-packages/twisted/internet/test/test_endpoints.pyt   dataReceived9   s    c         C   s   |  j  j |  d  S(   N(   R   R   (   R   t   reason(    (    sH   /usr/lib/python2.7/dist-packages/twisted/internet/test/test_endpoints.pyt   connectionLost=   s    (   t   __name__t
   __module__t   __doc__R   R   R   R!   (    (    (    sH   /usr/lib/python2.7/dist-packages/twisted/internet/test/test_endpoints.pyR   *   s
   			t   TestHalfCloseableProtocolc           B   s6   e  Z d  Z e e j  d   Z d   Z d   Z RS(   s   
    A Protocol that implements L{IHalfCloseableProtocol} and records that
    its C{readConnectionLost} and {writeConnectionLost} methods.
    c         C   s#   t  j |   t |  _ t |  _ d  S(   N(   R   R   t   Falset   readLostt	   writeLost(   R   (    (    sH   /usr/lib/python2.7/dist-packages/twisted/internet/test/test_endpoints.pyR   I   s    	c         C   s   t  |  _ d  S(   N(   t   TrueR'   (   R   (    (    sH   /usr/lib/python2.7/dist-packages/twisted/internet/test/test_endpoints.pyt   readConnectionLostO   s    c         C   s   t  |  _ d  S(   N(   R)   R(   (   R   (    (    sH   /usr/lib/python2.7/dist-packages/twisted/internet/test/test_endpoints.pyt   writeConnectionLostS   s    (	   R"   R#   R$   R   R   t   IHalfCloseableProtocolR   R*   R+   (    (    (    sH   /usr/lib/python2.7/dist-packages/twisted/internet/test/test_endpoints.pyR%   B   s
   		t   TestFactoryc           B   s   e  Z d  Z e Z RS(   s   
    Simple factory to be used both when connecting and listening. It contains
    two deferreds which are called back when my protocol connects and
    disconnects.
    (   R"   R#   R$   R   t   protocol(    (    (    sH   /usr/lib/python2.7/dist-packages/twisted/internet/test/test_endpoints.pyR-   X   s   t   WrappingFactoryTestsc           B   s_   e  Z d  Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z	 d   Z
 d	   Z RS(
   sS   
    Test the behaviour of our ugly implementation detail C{_WrappingFactory}.
    c            sg   d t  f d     Y} t j |   d  } | j d    j | j t  } | j   f d    | S(   s   
        An exception raised in C{buildProtocol} of our wrappedFactory
        results in our C{onConnection} errback being fired.
        t   BogusFactoryc           B   s   e  Z d  Z d   Z RS(   sZ   
            A one off factory whose C{buildProtocol} raises an C{Exception}.
            c         S   s   t  d   d  S(   Ns   My protocol is poorly defined.(   t
   ValueError(   R   t   addr(    (    sH   /usr/lib/python2.7/dist-packages/twisted/internet/test/test_endpoints.pyt   buildProtocols   s    (   R"   R#   R$   R3   (    (    (    sH   /usr/lib/python2.7/dist-packages/twisted/internet/test/test_endpoints.pyR0   n   s   c            s     j  |  j d  S(   Ns   My protocol is poorly defined.(   s   My protocol is poorly defined.(   t   assertEqualst   args(   t   e(   R   (    sH   /usr/lib/python2.7/dist-packages/twisted/internet/test/test_endpoints.pyt   <lambda>|   s   N(	   R   R   t   _WrappingFactoryt   NoneR3   t   assertFailuret   _onConnectionR1   t   addCallback(   R   R0   t   wft   d(    (   R   sH   /usr/lib/python2.7/dist-packages/twisted/internet/test/test_endpoints.pyt   test_failedBuildProtocolh   s    	c         C   s   t  j t   d  } | j d  } | j d  | j d  |  j | j j	 d g  | j d  |  j | j j	 d d g  d S(   s   
        The wrapped C{Protocol}'s C{dataReceived} will get called when our
        C{_WrappingProtocol}'s C{dataReceived} gets called.
        t   foot   barN(
   R   R8   R-   R9   R3   t   makeConnectionR   R4   t   _wrappedProtocolR   (   R   R=   t   p(    (    sH   /usr/lib/python2.7/dist-packages/twisted/internet/test/test_endpoints.pyt    test_wrappedProtocolDataReceived   s    c         C   sg   t  j t   d  } | j d  } t   } | j |  |  j | j |  |  j | j	 j |  d S(   so   
        Our transport is properly hooked up to the wrappedProtocol when a
        connection is made.
        N(
   R   R8   R-   R9   R3   t   objectRB   R4   t	   transportRC   (   R   R=   RD   t   dummyTransport(    (    sH   /usr/lib/python2.7/dist-packages/twisted/internet/test/test_endpoints.pyt   test_wrappedProtocolTransport   s    	c         C   sT   t    } t j | d  } | j d  } | j d  |  j | j j d g  d S(   s   
        Our wrappedProtocol's connectionLost method is called when
        L{_WrappingProtocol.connectionLost} is called.
        t   failN(	   R-   R   R8   R9   R3   R!   R4   RC   R   (   R   t   tfR=   RD   (    (    sH   /usr/lib/python2.7/dist-packages/twisted/internet/test/test_endpoints.pyt"   test_wrappedProtocolConnectionLost   s
    	c            sy   t  j t   d  } t t j d d   } | j d |  g      f d   } | j j	 |  |  j
   | g  d S(   s   
        Calls to L{_WrappingFactory.clientConnectionLost} should errback the
        L{_WrappingFactory._onConnection} L{Deferred}
        t   stringRJ   c            s     j  |   d  S(   N(   R   (   t   f(   t   errors(    sH   /usr/lib/python2.7/dist-packages/twisted/internet/test/test_endpoints.pyt   gotError   s    N(   R   R8   R-   R9   R   R   t   ConnectErrort   clientConnectionFailedR;   t
   addErrbackR4   (   R   R=   t   expectedFailureRP   (    (   RO   sH   /usr/lib/python2.7/dist-packages/twisted/internet/test/test_endpoints.pyt   test_clientConnectionFailed   s    c         C   sD   t    } t   } t j | |  } |  j t j j |  t  d S(   sx   
        Our  L{_WrappingProtocol} should be an L{IHalfCloseableProtocol} if
        the C{wrappedProtocol} is.
        N(	   RF   R%   R   t   _WrappingProtocolR4   R   R,   t
   providedByR)   (   R   t   cdt   hcpRD   (    (    sH   /usr/lib/python2.7/dist-packages/twisted/internet/test/test_endpoints.pyt"   test_wrappingProtocolHalfCloseable   s
    		c         C   s;   t    } t j d |  } |  j t j j |  t  d S(   s   
        Our L{_WrappingProtocol} should not provide L{IHalfCloseableProtocol}
        if the C{WrappedProtocol} doesn't.
        N(	   R   R   RV   R9   R4   R   R,   RW   R&   (   R   t   tpRD   (    (    sH   /usr/lib/python2.7/dist-packages/twisted/internet/test/test_endpoints.pyt%   test_wrappingProtocolNotHalfCloseable   s    	c         C   s<   t    } t j d |  } | j   |  j | j t  d S(   s~   
        L{_WrappingProtocol.readConnectionLost} should proxy to the wrapped
        protocol's C{readConnectionLost}
        N(   R%   R   RV   R9   R*   R4   R'   R)   (   R   RY   RD   (    (    sH   /usr/lib/python2.7/dist-packages/twisted/internet/test/test_endpoints.pyt&   test_wrappedProtocolReadConnectionLost   s    	
c         C   s<   t    } t j d |  } | j   |  j | j t  d S(   s   
        L{_WrappingProtocol.writeConnectionLost} should proxy to the wrapped
        protocol's C{writeConnectionLost}
        N(   R%   R   RV   R9   R+   R4   R(   R)   (   R   RY   RD   (    (    sH   /usr/lib/python2.7/dist-packages/twisted/internet/test/test_endpoints.pyt'   test_wrappedProtocolWriteConnectionLost   s    	
(   R"   R#   R$   R?   RE   RI   RL   RU   RZ   R\   R]   R^   (    (    (    sH   /usr/lib/python2.7/dist-packages/twisted/internet/test/test_endpoints.pyR/   c   s   								t   EndpointTestCaseMixinc           B   sV   e  Z d  Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z	 d   Z
 RS(	   sJ   
    Generic test methods to be mixed into all endpoint test classes.
    c         C   s   |  j  |  d d S(   s   
        Retrieve a single factory that has connected using the given reactor.
        (This behavior is valid for TCP and SSL but needs to be overridden for
        UNIX.)

        @param reactor: a L{MemoryReactor}
        i    i   (   t   expectedClients(   R   t   reactor(    (    sH   /usr/lib/python2.7/dist-packages/twisted/internet/test/test_endpoints.pyt   retrieveConnectedFactory   s    c            s   t    } t   } t    } |  j | |  \ } } } | j |  } g      f d   } | j |  |  j |  }	 |	 j j |  |  j   | g  |  j	 |  }
 |  j t
 |
  d  |  j |
 d |  d S(   s}   
        A client endpoint can connect and returns a deferred who gets called
        back with a protocol instance.
        c            s     j  |   d  S(   N(   R   (   RD   (   t   receivedProtos(    sH   /usr/lib/python2.7/dist-packages/twisted/internet/test/test_endpoints.pyt
   checkProto  s    i   i    N(   RF   R
   t   createClientEndpointt   connectR<   Rb   R;   t   callbackR4   R`   t   lent   assertConnectArgs(   R   t   protot   mreactort   clientFactoryt   ept   expectedArgst   ignoredDestR>   Rd   t   factoryR`   (    (   Rc   sH   /usr/lib/python2.7/dist-packages/twisted/internet/test/test_endpoints.pyt   test_endpointConnectSuccess  s    			c   	         s   t  j d d  } t d |  } t   } |  j | |  \ } } } | j |  } g      f d   } | j |  |  j   | g  d S(   st   
        If an endpoint tries to connect to a non-listening port it gets
        a C{ConnectError} failure.
        RM   s   Connection Failedt   connectExceptionc            s     j  |  j  d  S(   N(   R   t   value(   RN   (   t   receivedExceptions(    sH   /usr/lib/python2.7/dist-packages/twisted/internet/test/test_endpoints.pyt   checkFailure7  s    N(   R   RQ   R   RF   Re   Rf   RS   R4   (	   R   t   expectedErrorRk   Rl   Rm   t   ignoredArgsRo   R>   Ru   (    (   Rt   sH   /usr/lib/python2.7/dist-packages/twisted/internet/test/test_endpoints.pyt   test_endpointConnectFailure%  s    	c   	         s   t    } t   } |  j | |  \ } } } | j |  } g      f d   } | j |  | j   |  j t    d    d } |  j | j	 t
 j  |  j | j	 j |  d S(   s   
        Calling L{Deferred.cancel} on the L{Deferred} returned from
        L{IStreamClientEndpoint.connect} is errbacked with an expected
        L{ConnectingCancelledError} exception.
        c            s     j  |   d  S(   N(   R   (   RN   (   t   receivedFailures(    sH   /usr/lib/python2.7/dist-packages/twisted/internet/test/test_endpoints.pyRu   P  s    i   i    N(   R
   RF   Re   Rf   RS   t   cancelR4   Rh   t   assertIsInstanceRs   R   t   ConnectingCancelledErrort   address(	   R   Rk   Rl   Rm   Rw   R}   R>   Ru   t   failure(    (   Ry   sH   /usr/lib/python2.7/dist-packages/twisted/internet/test/test_endpoints.pyt    test_endpointConnectingCancelled?  s    		

c            s   t    } t   } |  j | |  \ } } } | j |  } g      f d   } | j |  |  j   | g  |  j |  j |  | g  d S(   ss   
        An endpoint can listen and returns a deferred that gets called back
        with a port instance.
        c            s     j  |  j    d  S(   N(   R   t   getHost(   t   port(   t   receivedHosts(    sH   /usr/lib/python2.7/dist-packages/twisted/internet/test/test_endpoints.pyt   checkPortAndServero  s    N(   R
   RF   t   createServerEndpointt   listenR<   R4   t   expectedServers(   R   Rk   Rp   Rm   Rn   t   expectedHostR>   R   (    (   R   sH   /usr/lib/python2.7/dist-packages/twisted/internet/test/test_endpoints.pyt   test_endpointListenSuccess_  s    		c   	         s   t    } t j d d |  } t d |  } |  j | |  \ } } } | j t     } g      f d   } | j |  |  j   | g  d S(   s   
        When an endpoint tries to listen on an already listening port, a
        C{CannotListenError} failure is errbacked.
        t    iP   t   listenExceptionc            s     j  |  j  d  S(   N(   R   Rs   (   RN   (   Rt   (    sH   /usr/lib/python2.7/dist-packages/twisted/internet/test/test_endpoints.pyRu     s    N(   RF   R   t   CannotListenErrorR   R   R   RS   R4   (	   R   Rp   t	   exceptionRk   Rm   Rw   Ro   R>   Ru   (    (   Rt   sH   /usr/lib/python2.7/dist-packages/twisted/internet/test/test_endpoints.pyt   test_endpointListenFailurex  s    	c         C   s   t    } t   } |  j | | |  j    \ } } } | j |  |  j |  } |  j t |  d  |  j | d |  d S(   sn   
        The endpoint should pass it's connectArgs parameter to the reactor's
        listen methods.
        i   i    N(	   RF   R
   Re   t   connectArgsRf   R`   R4   Rh   Ri   (   R   Rp   Rk   Rm   Rn   t   ignoredHostR`   (    (    sH   /usr/lib/python2.7/dist-packages/twisted/internet/test/test_endpoints.pyt"   test_endpointConnectNonDefaultArgs  s    		c         C   si   t    } t   } |  j | | |  j    \ } } } | j |  |  j |  } |  j | | g  d S(   sm   
        The endpoint should pass it's listenArgs parameter to the reactor's
        listen methods.
        N(   RF   R
   R   t
   listenArgsR   R   R4   (   R   Rp   Rk   Rm   Rn   R   R   (    (    sH   /usr/lib/python2.7/dist-packages/twisted/internet/test/test_endpoints.pyt!   test_endpointListenNonDefaultArgs  s    		(   R"   R#   R$   Rb   Rq   Rx   R   R   R   R   R   (    (    (    sH   /usr/lib/python2.7/dist-packages/twisted/internet/test/test_endpoints.pyR_      s   		 		 			t   TCP4EndpointsTestCasec           B   sM   e  Z d  Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z	 RS(   s"   
    Tests for TCP Endpoints.
    c         C   s   | j  S(   sD   
        @return: List of calls to L{IReactorTCP.listenTCP}
        (   t
   tcpServers(   R   Ra   (    (    sH   /usr/lib/python2.7/dist-packages/twisted/internet/test/test_endpoints.pyR     s    c         C   s   | j  S(   sE   
        @return: List of calls to L{IReactorTCP.connectTCP}
        (   t
   tcpClients(   R   Ra   (    (    sH   /usr/lib/python2.7/dist-packages/twisted/internet/test/test_endpoints.pyR`     s    c         C   sn   | \ } } } } } | \ } }	 }
 } } |  j  | |  |  j  | |	  |  j  | |  |  j  | |  d S(   s]  
        Compare host, port, timeout, and bindAddress in C{receivedArgs}
        to C{expectedArgs}.  We ignore the factory because we don't
        only care what protocol comes out of the
        C{IStreamClientEndpoint.connect} call.

        @param receivedArgs: C{tuple} of (C{host}, C{port}, C{factory},
            C{timeout}, C{bindAddress}) that was passed to
            L{IReactorTCP.connectTCP}.
        @param expectedArgs: C{tuple} of (C{host}, C{port}, C{factory},
            C{timeout}, C{bindAddress}) that we expect to have been passed
            to L{IReactorTCP.connectTCP}.
        N(   R4   (   R   t   receivedArgsRn   t   hostR   t   ignoredFactoryt   timeoutt   bindAddressR   t   expectedPortt   _ignoredFactoryt   expectedTimeoutt   expectedBindAddress(    (    sH   /usr/lib/python2.7/dist-packages/twisted/internet/test/test_endpoints.pyRi     s    c         C   s   i d d 6d d 6S(   sK   
        @return: C{dict} of keyword arguments to pass to connect.
        i
   R   t	   localhosti  R   (   R   i  (    (   R   (    (    sH   /usr/lib/python2.7/dist-packages/twisted/internet/test/test_endpoints.pyR     s    c         C   s   i d d 6d d 6S(   sI   
        @return: C{dict} of keyword arguments to pass to listen
        id   t   backlogs	   127.0.0.1t	   interface(    (   R   (    (    sH   /usr/lib/python2.7/dist-packages/twisted/internet/test/test_endpoints.pyR     s    c         K   sm   t  d d d  } | d k r' i  } n  t j | | j |  | j | | j d d  | j d d  f | f S(	   s  
        Create an L{TCP4ServerEndpoint} and return the values needed to verify
        its behaviour.

        @param reactor: A fake L{IReactorTCP} that L{TCP4ServerEndpoint} can
            call L{IReactorTCP.listenTCP} on.
        @param factory: The thing that we expect to be passed to our
            L{IStreamServerEndpoint.listen} implementation.
        @param listenArgs: Optional dictionary of arguments to
            L{IReactorTCP.listenTCP}.
        t   TCPs   0.0.0.0i    R   i2   R   R   N(   R   R9   R   t   TCP4ServerEndpointR   t   get(   R   Ra   Rp   R   R}   (    (    sH   /usr/lib/python2.7/dist-packages/twisted/internet/test/test_endpoints.pyR     s    			c         K   sd   t  d d d  } t j | | j | j |  | j | j | | j d d  | j d d  f | f S(   s  
        Create an L{TCP4ClientEndpoint} and return the values needed to verify
        its behavior.

        @param reactor: A fake L{IReactorTCP} that L{TCP4ClientEndpoint} can
            call L{IReactorTCP.connectTCP} on.
        @param clientFactory: The thing that we expect to be passed to our
            L{IStreamClientEndpoint.connect} implementation.
        @param connectArgs: Optional dictionary of arguments to
            L{IReactorTCP.connectTCP}
        R   R   iP   R   i   R   N(   R   R   t   TCP4ClientEndpointR   R   R   R9   (   R   Ra   Rl   R   R}   (    (    sH   /usr/lib/python2.7/dist-packages/twisted/internet/test/test_endpoints.pyRe     s    	(
   R"   R#   R$   R   R`   Ri   R   R   R   Re   (    (    (    sH   /usr/lib/python2.7/dist-packages/twisted/internet/test/test_endpoints.pyR     s   						t   SSL4EndpointsTestCasec           B   se   e  Z d  Z e r e Z n  d   Z d   Z d   Z d   Z d   Z	 d   Z
 d   Z d   Z RS(	   s"   
    Tests for SSL Endpoints.
    c         C   s   | j  S(   sD   
        @return: List of calls to L{IReactorSSL.listenSSL}
        (   t
   sslServers(   R   Ra   (    (    sH   /usr/lib/python2.7/dist-packages/twisted/internet/test/test_endpoints.pyR   /  s    c         C   s   | j  S(   sE   
        @return: List of calls to L{IReactorSSL.connectSSL}
        (   t
   sslClients(   R   Ra   (    (    sH   /usr/lib/python2.7/dist-packages/twisted/internet/test/test_endpoints.pyR`   6  s    c         C   s   | \ } } } } } } | \ }	 }
 } } } } |  j  | |	  |  j  | |
  |  j  | |  |  j  | |  |  j  | |  d S(   s  
        Compare host, port, contextFactory, timeout, and bindAddress in
        C{receivedArgs} to C{expectedArgs}.  We ignore the factory because we
        don't only care what protocol comes out of the
        C{IStreamClientEndpoint.connect} call.

        @param receivedArgs: C{tuple} of (C{host}, C{port}, C{factory},
            C{contextFactory}, C{timeout}, C{bindAddress}) that was passed to
            L{IReactorSSL.connectSSL}.
        @param expectedArgs: C{tuple} of (C{host}, C{port}, C{factory},
            C{contextFactory}, C{timeout}, C{bindAddress}) that we expect to
            have been passed to L{IReactorSSL.connectSSL}.
        N(   R4   (   R   R   Rn   R   R   R   t   contextFactoryR   R   R   R   R   t   expectedContextFactoryR   R   (    (    sH   /usr/lib/python2.7/dist-packages/twisted/internet/test/test_endpoints.pyRi   =  s    c         C   s   i d d 6d d 6S(   sK   
        @return: C{dict} of keyword arguments to pass to connect.
        i
   R   R   i  R   (   s	   localhosti  (    (   R   (    (    sH   /usr/lib/python2.7/dist-packages/twisted/internet/test/test_endpoints.pyR   X  s    c         C   s   i d d 6d d 6S(   sI   
        @return: C{dict} of keyword arguments to pass to listen
        id   R   s	   127.0.0.1R   (    (   R   (    (    sH   /usr/lib/python2.7/dist-packages/twisted/internet/test/test_endpoints.pyR   _  s    c         C   s|   t  d d d d  \ |  _ |  _ t  d d d d  \ |  _ |  _ t d |  j d |  j d	 t  |  _ t d	 t  |  _ d
 S(   sF   
        Set up client and server SSL contexts for use later.
        t   Os   Server Test Certificatet   CNt   servers   Client Test Certificatet   clientt
   privateKeyt   certificatet   requireCertificateN(	   R   t   sKeyt   sCertt   cKeyt   cCertR   R&   t   serverSSLContextt   clientSSLContext(   R   (    (    sH   /usr/lib/python2.7/dist-packages/twisted/internet/test/test_endpoints.pyt   setUpf  s    		c         K   sd   t  d d d  } t j | | j |  j |  | j | |  j | j d d  | j d d  f | f S(   s  
        Create an L{SSL4ServerEndpoint} and return the tools to verify its
        behaviour.

        @param factory: The thing that we expect to be passed to our
            L{IStreamServerEndpoint.listen} implementation.
        @param reactor: A fake L{IReactorSSL} that L{SSL4ServerEndpoint} can
            call L{IReactorSSL.listenSSL} on.
        @param listenArgs: Optional dictionary of arguments to
            L{IReactorSSL.listenSSL}.
        R   s   0.0.0.0i    R   i2   R   R   (   R   R   t   SSL4ServerEndpointR   R   R   (   R   Ra   Rp   R   R}   (    (    sH   /usr/lib/python2.7/dist-packages/twisted/internet/test/test_endpoints.pyR   x  s    	c      	   K   s   t  d d d  } | d k r' i  } n  t j | | j | j |  j |  | j | j | |  j | j d d  | j d d  f | f S(   s  
        Create an L{SSL4ClientEndpoint} and return the values needed to verify
        its behaviour.

        @param reactor: A fake L{IReactorSSL} that L{SSL4ClientEndpoint} can
            call L{IReactorSSL.connectSSL} on.
        @param clientFactory: The thing that we expect to be passed to our
            L{IStreamClientEndpoint.connect} implementation.
        @param connectArgs: Optional dictionary of arguments to
            L{IReactorSSL.connectSSL}
        R   R   iP   R   i   R   N(   R   R9   R   t   SSL4ClientEndpointR   R   R   R   (   R   Ra   Rl   R   R}   (    (    sH   /usr/lib/python2.7/dist-packages/twisted/internet/test/test_endpoints.pyRe     s    		(   R"   R#   R$   t   skipSSLt   skipR   R`   Ri   R   R   R   R   Re   (    (    (    sH   /usr/lib/python2.7/dist-packages/twisted/internet/test/test_endpoints.pyR   '  s   								t   UNIXEndpointsTestCasec           B   sV   e  Z d  Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z	 d   Z
 RS(	   s)   
    Tests for UnixSocket Endpoints.
    c         C   s   |  j  |  d d S(   s   
        Override L{EndpointTestCaseMixin.retrieveConnectedFactory} to account
        for different index of 'factory' in C{connectUNIX} args.
        i    i   (   R`   (   R   Ra   (    (    sH   /usr/lib/python2.7/dist-packages/twisted/internet/test/test_endpoints.pyRb     s    c         C   s   | j  S(   sF   
        @return: List of calls to L{IReactorUNIX.listenUNIX}
        (   t   unixServers(   R   Ra   (    (    sH   /usr/lib/python2.7/dist-packages/twisted/internet/test/test_endpoints.pyR     s    c         C   s   | j  S(   sG   
        @return: List of calls to L{IReactorUNIX.connectUNIX}
        (   t   unixClients(   R   Ra   (    (    sH   /usr/lib/python2.7/dist-packages/twisted/internet/test/test_endpoints.pyR`     s    c         C   sX   | \ } } } } | \ } } }	 }
 |  j  | |  |  j  | |	  |  j  | |
  d S(   s  
        Compare path, timeout, checkPID in C{receivedArgs} to C{expectedArgs}.
        We ignore the factory because we don't only care what protocol comes
        out of the C{IStreamClientEndpoint.connect} call.

        @param receivedArgs: C{tuple} of (C{path}, C{timeout}, C{checkPID})
            that was passed to L{IReactorUNIX.connectUNIX}.
        @param expectedArgs: C{tuple} of (C{path}, C{timeout}, C{checkPID})
            that we expect to have been passed to L{IReactorUNIX.connectUNIX}.
        N(   R4   (   R   R   Rn   t   pathR   R   t   checkPIDt   expectedPathR   R   t   expectedCheckPID(    (    sH   /usr/lib/python2.7/dist-packages/twisted/internet/test/test_endpoints.pyRi     s
    c         C   s   i d d 6d d 6S(   sK   
        @return: C{dict} of keyword arguments to pass to connect.
        i
   R   i   R   (    (   R   (    (    sH   /usr/lib/python2.7/dist-packages/twisted/internet/test/test_endpoints.pyR     s    c         C   s   i d d 6d d 6d d 6S(   sI   
        @return: C{dict} of keyword arguments to pass to listen
        id   R   i  t   modei   t   wantPID(    (   R   (    (    sH   /usr/lib/python2.7/dist-packages/twisted/internet/test/test_endpoints.pyR     s    c         K   sg   t  |  j    } t j | | j |  | j | | j d d  | j d d  | j d d  f | f S(   s  
        Create an L{UNIXServerEndpoint} and return the tools to verify its
        behaviour.

        @param reactor: A fake L{IReactorUNIX} that L{UNIXServerEndpoint} can
            call L{IReactorUNIX.listenUNIX} on.
        @param factory: The thing that we expect to be passed to our
            L{IStreamServerEndpoint.listen} implementation.
        @param listenArgs: Optional dictionary of arguments to
            L{IReactorUNIX.listenUNIX}.
        R   i2   R   i  R   i    (   R   t   mktempR   t   UNIXServerEndpointt   nameR   (   R   Ra   Rp   R   R}   (    (    sH   /usr/lib/python2.7/dist-packages/twisted/internet/test/test_endpoints.pyR     s    	c         K   sX   t  |  j    } t j | | j |  | j | | j d d  | j d d  f | f S(   s  
        Create an L{UNIXClientEndpoint} and return the values needed to verify
        its behaviour.

        @param reactor: A fake L{IReactorUNIX} that L{UNIXClientEndpoint} can
            call L{IReactorUNIX.connectUNIX} on.
        @param clientFactory: The thing that we expect to be passed to our
            L{IStreamClientEndpoint.connect} implementation.
        @param connectArgs: Optional dictionary of arguments to
            L{IReactorUNIX.connectUNIX}
        R   i   R   i    (   R   R   R   t   UNIXClientEndpointR   R   (   R   Ra   Rl   R   R}   (    (    sH   /usr/lib/python2.7/dist-packages/twisted/internet/test/test_endpoints.pyRe     s    	(   R"   R#   R$   Rb   R   R`   Ri   R   R   R   Re   (    (    (    sH   /usr/lib/python2.7/dist-packages/twisted/internet/test/test_endpoints.pyR     s   							t   ParserTestCasec           B   s   e  Z d  Z d Z d   Z d   Z d   Z d   Z d   Z d   Z	 d   Z
 d	   Z d
   Z d   Z d   Z d   Z RS(   sK   
    Tests for L{endpoints._parseServer}, the low-level parsing logic.
    t   Factoryc         O   s   t  j | |   S(   sT   
        Provide a hook for test_strports to substitute the deprecated API.
        (   R   t   _parseServer(   R   t   at   kw(    (    sH   /usr/lib/python2.7/dist-packages/twisted/internet/test/test_endpoints.pyt   parse"  s    c         C   sC   |  j  |  j d |  j  d d |  j f i d d 6d d 6f  d S(	   sN   
        Simple strings with a 'tcp:' prefix should be parsed as TCP.
        s   tcp:80R   iP   R   R   i2   R   N(   R4   R   RN   (   R   (    (    sH   /usr/lib/python2.7/dist-packages/twisted/internet/test/test_endpoints.pyt   test_simpleTCP)  s    c         C   sC   |  j  |  j d |  j  d d |  j f i d d 6d d 6f  d S(	   sU   
        TCP port descriptions parse their 'interface' argument as a string.
        s   tcp:80:interface=127.0.0.1R   iP   s	   127.0.0.1R   i2   R   N(   R4   R   RN   (   R   (    (    sH   /usr/lib/python2.7/dist-packages/twisted/internet/test/test_endpoints.pyt   test_interfaceTCP1  s    c         C   sC   |  j  |  j d |  j  d d |  j f i d d 6d d 6f  d S(	   sU   
        TCP port descriptions parse their 'backlog' argument as an integer.
        s   tcp:80:backlog=6R   iP   R   R   i   R   N(   R4   R   RN   (   R   (    (    sH   /usr/lib/python2.7/dist-packages/twisted/internet/test/test_endpoints.pyt   test_backlogTCP:  s    c         C   sJ   |  j  |  j d |  j  d d |  j f i d d 6d d 6t d 6f  d	 S(
   s   
        L{endpoints._parseServer} returns a C{'UNIX'} port description with
        defaults for C{'mode'}, C{'backlog'}, and C{'wantPID'} when passed a
        string with the C{'unix:'} prefix and no other parameter values.
        s   unix:/var/run/fingert   UNIXs   /var/run/fingeri  R   i2   R   R   N(   R4   R   RN   R)   (   R   (    (    sH   /usr/lib/python2.7/dist-packages/twisted/internet/test/test_endpoints.pyt   test_simpleUNIXC  s    c         C   sJ   |  j  |  j d |  j  d d |  j f i d d 6d d 6t d 6f  d	 S(
   sK   
        C{mode} can be set by including C{"mode=<some integer>"}.
        s   unix:/var/run/finger:mode=0660R   s   /var/run/fingeri  R   i2   R   R   N(   R4   R   RN   R)   (   R   (    (    sH   /usr/lib/python2.7/dist-packages/twisted/internet/test/test_endpoints.pyt   test_modeUNIXO  s    c         C   sJ   |  j  |  j d |  j  d d |  j f i d d 6d d 6t d 6f  d	 S(
   sM   
        C{wantPID} can be set to false by included C{"lockfile=0"}.
        s   unix:/var/run/finger:lockfile=0R   s   /var/run/fingeri  R   i2   R   R   N(   R4   R   RN   R&   (   R   (    (    sH   /usr/lib/python2.7/dist-packages/twisted/internet/test/test_endpoints.pyt   test_wantPIDUNIXY  s    c         C   sJ   |  j  |  j d |  j  d d |  j f i d d 6d d 6t d 6f  d	 S(
   sf   
        Backslash can be used to escape colons and backslashes in port
        descriptions.
        s   unix:foo\:bar\=baz\:qux\\R   s   foo:bar=baz:qux\i  R   i2   R   R   N(   R4   R   RN   R)   (   R   (    (    sH   /usr/lib/python2.7/dist-packages/twisted/internet/test/test_endpoints.pyt   test_escapec  s    c         C   s   |  j  t j d  d  d S(   s   
        L{endpoints.quoteStringArgument} should quote backslashes and colons
        for interpolation into L{endpoints.serverFromString} and
        L{endpoints.clientFactory} arguments.
        s   some : stuff \s   some \: stuff \\N(   R4   R   t   quoteStringArgument(   R   (    (    sH   /usr/lib/python2.7/dist-packages/twisted/internet/test/test_endpoints.pyt   test_quoteStringArgumentn  s    c         C   sJ   |  j  |  j d |  j  d d |  j f i d d 6d d 6t d 6f  d	 S(
   s   
        In strports descriptions, '=' in a parameter value does not need to be
        quoted; it will simply be parsed as part of the value.
        s   unix:address=foo=barR   s   foo=bari  R   i2   R   R   N(   R4   R   RN   R)   (   R   (    (    sH   /usr/lib/python2.7/dist-packages/twisted/internet/test/test_endpoints.pyt   test_impliedEscapex  s    c         C   sM   |  j  |  j d |  j d  d d |  j f i d d 6d d 6t d 6f  d	 S(
   s   
        For compatibility with the old L{twisted.application.strports.parse},
        the third 'mode' argument may be specified to L{endpoints.parse} to
        indicate a default other than TCP.
        t   filenamet   unixR   i  R   i2   R   R   N(   R4   R   RN   R)   (   R   (    (    sH   /usr/lib/python2.7/dist-packages/twisted/internet/test/test_endpoints.pyt   test_nonstandardDefault  s    c         C   s    |  j  t |  j d |  j  d S(   se   
        L{strports.parse} raises C{ValueError} when given an unknown endpoint
        type.
        s   bogus-type:nothingN(   t   assertRaisesR1   R   RN   (   R   (    (    sH   /usr/lib/python2.7/dist-packages/twisted/internet/test/test_endpoints.pyt   test_unknownType  s    (   R"   R#   R$   RN   R   R   R   R   R   R   R   R   R   R   R   R   (    (    (    sH   /usr/lib/python2.7/dist-packages/twisted/internet/test/test_endpoints.pyR     s   								
	
		
		t   ServerStringTestsc           B   sV   e  Z d  Z d   Z d   Z e r0 e e _ n  d   Z d   Z d   Z	 d   Z
 RS(   sC   
    Tests for L{twisted.internet.endpoints.serverFromString}.
    c         C   s~   t    } t j | d  } |  j | t j  |  j | j |  |  j | j d  |  j | j	 d  |  j | j
 d  d S(   s   
        When passed a TCP strports description, L{endpoints.serverFromString}
        returns a L{TCP4ServerEndpoint} instance initialized with the values
        from the string.
        s&   tcp:1234:backlog=12:interface=10.0.0.1i  i   s   10.0.0.1N(   RF   R   t   serverFromStringR{   R   t   assertIdenticalt   _reactorR4   t   _portt   _backlogt
   _interface(   R   Ra   R   (    (    sH   /usr/lib/python2.7/dist-packages/twisted/internet/test/test_endpoints.pyt   test_tcp  s    	c         C   s   t    } t j | d t t f  } |  j | t j  |  j | j |  |  j | j	 d  |  j | j
 d  |  j | j d  | j j   } |  j | t  d S(   s   
        When passed an SSL strports description, L{endpoints.serverFromString}
        returns a L{SSL4ServerEndpoint} instance initialized with the values
        from the string.
        s?   ssl:1234:backlog=12:privateKey=%s:certKey=%s:interface=10.0.0.1i  i   s   10.0.0.1N(   RF   R   R   t   escapedPEMPathNameR{   R   R   R   R4   R   R   R   t   _sslContextFactoryt
   getContextR   (   R   Ra   R   t   ctx(    (    sH   /usr/lib/python2.7/dist-packages/twisted/internet/test/test_endpoints.pyt   test_ssl  s    	c         C   s   t    } t j | d  } |  j | t j  |  j | j |  |  j | j d  |  j | j	 d  |  j | j
 d  |  j | j t  d S(   s   
        When passed a UNIX strports description, L{endpoint.serverFromString}
        returns a L{UNIXServerEndpoint} instance initialized with the values
        from the string.
        s0   unix:/var/foo/bar:backlog=7:mode=0123:lockfile=1s   /var/foo/bari   iS   N(   RF   R   R   R{   R   R   R   R4   t   _addressR   t   _modet   _wantPIDR)   (   R   Ra   t   endpoint(    (    sH   /usr/lib/python2.7/dist-packages/twisted/internet/test/test_endpoints.pyt	   test_unix  s    		c         C   s5   |  j  t t j d d  } |  j t |  d  d S(   s  
        The older service-based API (L{twisted.internet.strports.service})
        allowed an implicit default of 'tcp' so that TCP ports could be
        specified as a simple integer, but we've since decided that's a bad
        idea, and the new API does not accept an implicit default argument; you
        have to say 'tcp:' now.  If you try passing an old implicit port number
        to the new API, you'll get a C{ValueError}.
        t   4321sq   Unqualified strport description passed to 'service'.Use qualified endpoint descriptions; for example, 'tcp:4321'.N(   R   R1   R   R   R9   R4   t   str(   R   Rs   (    (    sH   /usr/lib/python2.7/dist-packages/twisted/internet/test/test_endpoints.pyt   test_implicitDefaultNotAllowed  s
    		c         C   s5   |  j  t t j d d  } |  j t |  d  d S(   sq   
        L{endpoints.serverFromString} raises C{ValueError} when given an
        unknown endpoint type.
        s   ftl:andromeda/carcosa/hali/2387s   Unknown endpoint type: 'ftl'N(   R   R1   R   R   R9   R4   R   (   R   Rs   (    (    sH   /usr/lib/python2.7/dist-packages/twisted/internet/test/test_endpoints.pyR     s    		c         C   s   t  |   t   } t j | d  } d d l m } |  j | j |  |  j | j	 | d d f  |  j | j
 t d d d d	   d
 S(   s   
        L{endpoints.serverFromString} looks up plugins of type
        L{IStreamServerEndpoint} and constructs endpoints from them.
        s   fake:hello:world:yes=no:up=downi(   t   faket   hellot   worldt   yest   not   upt   downN(   t   addFakePluginRF   R   R   t   twisted.plugins.fakeendpointR   R   t   parserR4   R5   t   kwargst   dict(   R   t   notAReactort   fakeEndpointR   (    (    sH   /usr/lib/python2.7/dist-packages/twisted/internet/test/test_endpoints.pyt   test_typeFromPlugin  s    
	(   R"   R#   R$   R   R   R   R   R   R   R   R  (    (    (    sH   /usr/lib/python2.7/dist-packages/twisted/internet/test/test_endpoints.pyR     s   					s   fakeendpoint.pyc            s   d d l      j j    t j      f d   } |  j |  t |  j    } | j   t	 t
  j j |  j | j |   t j j | j  d S(   s   
    For the duration of C{testCase}, add a fake plugin to twisted.plugins which
    contains some sample endpoint parsers.
    iNc              s+     j  j     j  j    t j (d  S(   N(   t   modulest   cleart   updateR   t   __path__(    (   t   syst   savedModulest   savedPluginPath(    sH   /usr/lib/python2.7/dist-packages/twisted/internet/test/test_endpoints.pyt   cleanup  s    (   R  R  t   copyR   R  t
   addCleanupR   R   t   createDirectoryR   R"   t   filePatht   siblingt   copyTot   childR   R   (   t   testCaset   dropinSourceR  t   fp(    (   R  R
  R	  sH   /usr/lib/python2.7/dist-packages/twisted/internet/test/test_endpoints.pyR   	  s    	
t   ClientStringTestsc           B   sD   e  Z d  Z d   Z d   Z d   Z d   Z d   Z d   Z RS(   sC   
    Tests for L{twisted.internet.endpoints.clientFromString}.
    c         C   s   t    } t j | d  } |  j | t j  |  j | j |  |  j | j d  |  j | j	 d  |  j | j
 d  |  j | j d  d S(   s   
        When passed a TCP strports description, L{endpointClient} returns a
        L{TCP4ClientEndpoint} instance initialized with the values from the
        string.
        s=   tcp:host=example.com:port=1234:timeout=7:bindAddress=10.0.0.2s   example.comi  i   s   10.0.0.2N(   RF   R   t   clientFromStringR{   R   R   R   R4   t   _hostR   t   _timeoutt   _bindAddress(   R   Ra   R   (    (    sH   /usr/lib/python2.7/dist-packages/twisted/internet/test/test_endpoints.pyR   #  s    		c         C   sE   t    } t j | d  } |  j | j d  |  j | j d  d S(   s{   
        A TCP strports description may omit I{timeout} or I{bindAddress} to
        allow the default to be used.
        s   tcp:host=example.com:port=1234i   N(   RF   R   R  R4   R  R  R9   (   R   Ra   R   (    (    sH   /usr/lib/python2.7/dist-packages/twisted/internet/test/test_endpoints.pyt   test_tcpDefaults5  s    		c         C   s~   t    } t j | d  } |  j | t j  |  j | j |  |  j | j d  |  j | j	 d  |  j | j
 t  d S(   s   
        When passed a UNIX strports description, L{endpointClient} returns a
        L{UNIXClientEndpoint} instance initialized with the values from the
        string.
        s+   unix:path=/var/foo/bar:lockfile=1:timeout=9s   /var/foo/bari	   N(   RF   R   R  R{   R   R   R   R4   t   _pathR  t	   _checkPIDR)   (   R   Ra   R   (    (    sH   /usr/lib/python2.7/dist-packages/twisted/internet/test/test_endpoints.pyR   B  s    		c         C   s?   t  j t   d  } |  j | j d  |  j | j t  d S(   sz   
        A UNIX strports description may omit I{lockfile} or I{timeout} to allow
        the defaults to be used.
        s   unix:path=/var/foo/bari   N(   R   R  RF   R4   R  R  R&   (   R   R   (    (    sH   /usr/lib/python2.7/dist-packages/twisted/internet/test/test_endpoints.pyt   test_unixDefaultsS  s    c         C   s   t  |   t   } t j | d  } d d l m } |  j | j |  |  j | j	 d  |  j | j
 t d d d d	   d
 S(   s   
        L{endpoints.clientFromString} looks up plugins of type
        L{IStreamClientEndpoint} and constructs endpoints from them.
        s   cfake:alpha:beta:cee=dee:num=1i(   t
   fakeClientt   alphat   betat   ceet   deet   numt   1N(   R   R!  (   R   RF   R   R  R   R  R   R   R4   R5   R   R   (   R   R  t   clientEndpointR  (    (    sH   /usr/lib/python2.7/dist-packages/twisted/internet/test/test_endpoints.pyR  ]  s    
	c         C   s5   |  j  t t j d d  } |  j t |  d  d S(   sq   
        L{endpoints.serverFromString} raises C{ValueError} when given an
        unknown endpoint type.
        s   ftl:andromeda/carcosa/hali/2387s   Unknown endpoint type: 'ftl'N(   R   R1   R   R  R9   R4   R   (   R   Rs   (    (    sH   /usr/lib/python2.7/dist-packages/twisted/internet/test/test_endpoints.pyR   l  s    		(	   R"   R#   R$   R   R  R   R  R  R   (    (    (    sH   /usr/lib/python2.7/dist-packages/twisted/internet/test/test_endpoints.pyR    s   				
	t   SSLClientStringTestsc           B   s8   e  Z d  Z e r e Z n  d   Z d   Z d   Z RS(   sU   
    Tests for L{twisted.internet.endpoints.clientFromString} which require SSL.
    c         C   s  t    } t j | d t t t f  } |  j | t j  |  j | j |  |  j	 | j
 d  |  j	 | j d  |  j	 | j d  |  j	 | j d  | j } |  j | t  | j   } |  j | t  |  j	 t | j  t  t | j  } | j t | j   |  j	 | t  g  t j d  t j d  g D]6 } | j   j   j d  r<t j | j     ^ q<} |  j	 g  | j! D] } t |  ^ q|  d	 S(
   s   
        When passed an SSL strports description, L{clientFromString} returns a
        L{SSL4ClientEndpoint} instance initialized with the values from the
        string.
        sd   ssl:host=example.net:port=4321:privateKey=%s:certKey=%s:bindAddress=10.0.0.3:timeout=3:caCertsDir=%ss   example.neti  i   s   10.0.0.3s
   thing1.pems
   thing2.pems   .pemN("   RF   R   R  R   t   escapedCAsPathNameR{   R   R   R   R4   R  R   R  R  R   R   R   R   R   R   t   testCertificateR   t   _setPrivateKeyR   R   t   testPrivateCertificatet   casPathR  t   basenamet   lowert   endswitht   loadPEMt
   getContentt   caCerts(   R   Ra   R   t   certOptionsR   t   privateCertt   xt   expectedCerts(    (    sH   /usr/lib/python2.7/dist-packages/twisted/internet/test/test_endpoints.pyR     s6    		"6%c         C   s   d t  f d     Y} t j d  j   } | | _ |  j g  t j |  D] } t |  ^ qJ t j	 t j d  j
    g  d S(   s   
        If a certificate in the directory is unreadable,
        L{endpoints._loadCAsFromDir} will ignore that certificate.
        t   UnreadableFilePathc           B   s   e  Z d    Z RS(   c         S   sA   t  j |   } | t j d  j   k r9 t t   n | Sd  S(   Ns
   thing2.pem(   R   R1  R,  R  t   IOErrorR    (   R   R   (    (    sH   /usr/lib/python2.7/dist-packages/twisted/internet/test/test_endpoints.pyR1    s    (   R"   R#   R1  (    (    (    sH   /usr/lib/python2.7/dist-packages/twisted/internet/test/test_endpoints.pyR7    s   t   ignoreds
   thing1.pemN(   R   R,  R  t   parentt	   clonePathR4   R   t   _loadCAsFromDirR   R0  R1  (   R   R7  t   casPathCloneR5  (    (    sH   /usr/lib/python2.7/dist-packages/twisted/internet/test/test_endpoints.pyt   test_unreadableCertificate  s    		%c         C   sg   t    } t j | d  } | j } |  j | t  |  j | j t  | j	   } |  j | t
  d S(   s   
        When passed an SSL strports description without any extra parameters,
        L{clientFromString} returns a simple non-verifying endpoint that will
        speak SSL.
        s%   ssl:host=simple.example.org:port=4321N(   RF   R   R  R   R{   R   R4   t   verifyR&   R   R   (   R   Ra   R   R3  R   (    (    sH   /usr/lib/python2.7/dist-packages/twisted/internet/test/test_endpoints.pyt   test_sslSimple  s    		(   R"   R#   R$   R   R   R   R>  R@  (    (    (    sH   /usr/lib/python2.7/dist-packages/twisted/internet/test/test_endpoints.pyR'  {  s   		&	N(D   R$   t   errnoR    t   zope.interfaceR   t   twisted.trialR   t   twisted.internetR   R   R   t   twisted.internet.addressR   R   t   twisted.internet.protocolR   R	   t   twisted.test.proto_helpersR
   R   t   twisted.python.failureR   t   twistedR   t   twisted.python.modulesR   t   twisted.python.filepathR   R  R  t   pemPathR"   R,  R   R   R   R(  t   twisted.test.test_sslverifyR   t   twisted.internet.sslR   R   R   R   t   OpenSSL.SSLR   R0  R1  R)  R+  R&   R   t   ImportErrorR   R%   R-   t   TestCaseR/   RF   R_   R   R   R   R   R   R   R  R'  (    (    (    sH   /usr/lib/python2.7/dist-packages/twisted/internet/test/test_endpoints.pyt   <module>   sR   "

ll}q]