+
    Dfj                        R t ^ RIHt ^ RIHtHtHtHtHt ^ RI	H
t
 ^ RIHtHtHtHt ^ RIHt ^ RIHt ^ RIHtHt ^ RIHtHtHtHtHt ^ R	IHt  ^ R
IHt ]t^ RI H!t!H"t" ^ RI#H$t$H%t%H&t&H't'H(t( ^ RI)H*t* ^ RI+H,t,H-t-H.t. ^ RI/H0t0H1t1 ^ RI2H3t3H4t4H5t5 ^ RI6H7t7H8t8H9t9H:t: ^ RI;H<t<H=t=H>t> ^ RI?H@t@ ^ RIAHBtBHCtCHDtDHEtEHFtF ^ RIGHHtH ^ RIIHJtJHKtKHLtLHMtMHNtN ^ RIOHPtP ^ RIQHRtR ^ RISHTtT ^ RIUHVtVHWtWHXtX ^ RIYHZtZ ^ RI[H\t\H]t] ^ RI^H_t_ ^ RI`Hata ]Z! R 4      tbR!tc]Z! R 4      e   R"tc ! R# R$4      tdR% te ! R& R']D4      tf ! R( R)]B4      tg]"! ]74       ! R* R+]B4      4       th ! R, R-]d]H]C4      ti ! R. R/]d]H4      tj ! R0 R14      tk ! R2 R34      tl ! R4 R54      tm ! R6 R7]l]m]H]M4      tn ! R8 R9]k]m]H]M4      to ! R: R;]N]H4      tp]q! 4       P                  ]iP                  4       4       ]q! 4       P                  ]jP                  4       4       ]q! 4       P                  ]nP                  4       4       ]q! 4       P                  ]oP                  4       4       ]q! 4       P                  ]pP                  4       4        ! R< R=]H]E4      tt]q! 4       P                  ]tP                  4       4       ]! ]]R>8g  R?4       ! R@ RA]a4      4       tuR#   ] d    Rt ELfi ; i)Bz/
Tests for implementations of L{IReactorUNIX}.
)md5)closefstatstatunlinkurandom)pformat)AF_INETSOCK_STREAM
SOL_SOCKETsocket)S_IMODE)pack)mkstempmktemp)AnyCallableOptionalSequenceType)skipIf)AF_UNIXN)	Interfaceimplementer)baseerror
interfacesreactortcp)UNIXAddress)DeferredfailgatherResults)UNIXClientEndpointUNIXServerEndpoint)CannotListenErrorConnectionClosedFileDescriptorOverrun)IFileDescriptorReceiverIReactorFDSetIReactorSocketIReactorUNIX)ClientFactoryDatagramProtocolServerFactory)LoopingCall)ConnectableProtocolConnectionTestsMixinEndpointCreatorStreamClientTestsMixinrunProtocolsWithReactor)ReactorBuilder)ClosingFactoryMyClientFactoryMyServerFactoryStreamTransportTestsMixinWriteSequenceTestsMixin)nativeString)Failure)_coerceToFilesystemEncoding)addObservererrremoveObserver)requireModule)platformplatformTypeAccumulatingProtocol)TestCaseztwisted.python.sendmsg z>sendmsg extension unavailable, extended UNIX features disabledc                   *   a  ] tR t^Mt o RtR tRtV tR# )UNIXFamilyMixinzC
Test-helper defining mixin for things related to AF_UNIX sockets.
c                    RpV P                  4       p\        WQ4      ! W#VR7      pVP                  4        V P                  \	        \        V4      P                  4      V4       R# )ze
Assert that the mode of the created unix socket is set to the mode
specified to the reactor method.
i  )modeN)buildReactorgetattrstopListeningassertEqualr   r   st_mode)self
methodNamepathfactoryrK   r   unixPorts   &&&&   A/usr/lib/python3/dist-packages/twisted/internet/test/test_unix.py	_modeTestUNIXFamilyMixin._modeTestR   sS    
 ##%7/DI d!3!34d;     N)__name__
__module____qualname____firstlineno____doc__rW   __static_attributes____classdictcell____classdict__s   @rV   rI   rI   M   s     	< 	<rY   rI   c                F    \        \        ^d4      4      P                  4       # )zA
Return a new, unique abstract namespace path to be listened on.
)r   r   	hexdigest)cases   &rV   _abstractPathrg   ^   s     ws|&&((rY   c                   V   a  ] tR t^et o Rt]P                  3tR tR t	V 3R lt
RtV tR# )UNIXCreatorz 
Create UNIX socket end points.
c                2    \        RRR7      p\        W4      # )z#
Construct a UNIX server endpoint.
.sock.suffixdir)r   r$   )rQ   r   rS   s   && rV   serverUNIXCreator.serverl   s    
 W#.!'00rY   c                ,    \        WP                  4      # )z#
Construct a UNIX client endpoint.
)r#   name)rQ   r   serverAddresss   &&&rV   clientUNIXCreator.clientt   s     "'+=+=>>rY   c                V   < V ^8  d   Qh/ S[ S[S[S[,          ,          ,          ;R&   #    requiredInterfacesr   r   r   r   )formatrc   s   "rV   __annotate__UNIXCreator.__annotate__e   s      
 !$y/!:;X rY   rZ   N)r[   r\   r]   r^   r_   r   r+   rz   rp   ru   __annotate_func__r`   ra   rb   s   @rV   ri   ri   e   s.      @J?V?V>X1?  rY   ri   c                   :   a  ] tR t^{t o RtRtR tR tR tRt	V t
R# )SendFileDescriptorz
L{SendFileDescriptorAndBytes} sends a file descriptor and optionally some
normal bytes and then closes its connection.

@ivar reason: The reason the connection was lost, after C{connectionLost}
    is called.
Nc                    Wn         W n        R# )z
@param fd: A C{int} giving a file descriptor to send over the
    connection.

@param data: A C{str} giving data to send over the connection, or
    L{None} if no data is to be sent.
N)fddata)rQ   r   r   s   &&&rV   __init__SendFileDescriptor.__init__   s     	rY   c                    V P                   P                  V P                  4       V P                  '       d&   V P                   P	                  V P                  4       V P                   P                  4        R# )zV
Send C{self.fd} and, if it is not L{None}, C{self.data}.  Then close the
connection.
N)	transportsendFileDescriptorr   r   writeloseConnectionrQ   s   &rV   connectionMade!SendFileDescriptor.connectionMade   sI    
 	))$''2999NN  +%%'rY   c                >    \         P                  ! W4       Wn        R # N)r0   connectionLostreasonrQ   r   s   &&rV   r   !SendFileDescriptor.connectionLost   s    **48rY   )r   r   r   )r[   r\   r]   r^   r_   r   r   r   r   r`   ra   rb   s   @rV   r   r   {   s%      F	( rY   r   c                   D   a  ] tR t^t o RtRtRtR tR tR t	R t
RtV tR# )ReceiveFileDescriptora]  
L{ReceiveFileDescriptor} provides an API for waiting for file descriptors to
be received.

@ivar reason: The reason the connection was lost, after C{connectionLost}
    is called.

@ivar waiting: A L{Deferred} which fires with a file descriptor once one is
    received, or with a failure if the connection is lost with no descriptor
    arriving.
Nc                ~    V P                   f   \        4       V n        V P                  # \        V P                   4      # )z
Return a L{Deferred} which will fire with the next file descriptor
received, or with a failure if the connection is or has already been
lost.
)r   r    waitingr!   r   s   &rV   waitForDescriptor'ReceiveFileDescriptor.waitForDescriptor   s0     ;;#:DL<<$$rY   c                J    V P                   P                  V4       RV n         R# )zi
Fire the waiting Deferred, initialized by C{waitForDescriptor}, with the
file descriptor just received.
N)r   callback)rQ   
descriptors   &&rV   fileDescriptorReceived,ReceiveFileDescriptor.fileDescriptorReceived   s    
 	j)rY   c           	         V P                   e<   V P                   P                  \        \        RV: R24      4      4       RV n         R# R# )a/  
Fail the waiting Deferred, if it has not already been fired by
C{fileDescriptorReceived}.  The bytes sent along with a file descriptor
are guaranteed to be delivered to the protocol's C{dataReceived} method
only after the file descriptor has been delivered to the protocol's
C{fileDescriptorReceived}.
NzReceived bytes (z) before descriptor.)r   errbackr<   	ExceptionrQ   r   s   &&rV   dataReceived"ReceiveFileDescriptor.dataReceived   sF     <<#LL  	$4TH<P"QRS  DL	 $rY   c                    \         P                  ! W4       V P                  e#   V P                  P                  V4       RV n        Wn        R# )zR
Fail the waiting Deferred, initialized by C{waitForDescriptor}, if there
is one.
N)r0   r   r   r   r   r   s   &&rV   r   $ReceiveFileDescriptor.connectionLost   s:    
 	**48<<#LL  (DLrY   )r   r   )r[   r\   r]   r^   r_   r   r   r   r   r   r   r`   ra   rb   s   @rV   r   r      s/     
 FG
% 	 	rY   r   c                   H  a  ] tR t^t o Rt]3t]! 4       tR t	]
! ]P                  ! 4       '       * R4      R 4       tR t]
! ]P                  ! 4       '       * R4      R 4       tR t]
! ]'       * ]4      R 4       t]
! R	R
4      R 4       t]
! ]'       * ]4      R 4       tR t]
! ]'       * ]4      R 4       t]
! ]P0                  ! 4       R4      ]
! ]'       * ]4      R 4       4       t]
! ]'       * ]4      R 4       t]
! ]'       * ]4      R 4       t]
! ]'       * ]4      R 4       tRtV tR# )UNIXTestsBuilderz5
Builder defining tests relating to L{IReactorUNIX}.
c                X    V P                  RV P                  4       \        4       4       R# )z[
The UNIX socket created by L{IReactorUNIX.listenUNIX} is created with
the mode specified.

listenUNIXN)rW   r   r.   r   s   &rV   	test_modeUNIXTestsBuilder.test_mode   s    
 	|T[[]MODrY   8Abstract namespace UNIX sockets only supported on Linux.c                    \        V 4      pV P                  4       pVP                  ! RV,           \        4       4      pV P	                  VP                  4       \        RV,           4      4       R# )z
On Linux, a UNIX socket path may begin with C{' '} to indicate
a socket in the abstract namespace.  L{IReactorUNIX.listenUNIX}
accepts such a path.
 N)rg   rL   r   r.   rO   getHostr   rQ   rS   r   ports   &   rV   #test_listenOnLinuxAbstractNamespace4UNIXTestsBuilder.test_listenOnLinuxAbstractNamespace   sS     T"##%!!$+}?TD[)ABrY   c                   R pV P                  \        P                  RV4       V P                  4       pV P	                  \
        4      ;_uu_ 4        VP                  ! R\        4       4       RRR4       R#   + '       g   i     R# ; i)z}
L{IReactorUNIX.listenUNIX} raises L{CannotListenError} if the
underlying port's createInternetSocket raises a socket error.
c                     \        R 4      h)z FakeBasePort forced socket.error)OSErrorr   s   &rV   raiseSocketError=UNIXTestsBuilder.test_listenFailure.<locals>.raiseSocketError  s    <==rY   createInternetSocketznot-usedN)patchr   BasePortrL   assertRaisesr%   r   r.   )rQ   r   r   s   &  rV   test_listenFailure#UNIXTestsBuilder.test_listenFailure   s`    	> 	

4=="8:JK##%011z=?; 2111s   A88B		c                    \        V 4      pV P                  4       pVP                  ! RV,           \        4       4      pV P	                  VP                  4       \        RV,           4      4       R# )zK
L{IReactorUNIX.connectUNIX} also accepts a Linux abstract namespace
path.
r   N)rg   rL   connectUNIXr,   rO   getDestinationr   )rQ   rS   r   	connectors   &   rV   $test_connectToLinuxAbstractNamespace5UNIXTestsBuilder.test_connectToLinuxAbstractNamespace  sV     T"##%''t]_E	113[5MNrY   c                <    ! R R\         4      pV! 4       pV! 4       p\        WW0P                  4       V P                  VP                  R,          VP                  R,          4       V P                  VP                  R,          VP                  R,          4       R# )z
A client's transport's C{getHost} and C{getPeer} return L{UNIXAddress}
instances which have the filesystem path of the host and peer ends of
the connection.
c                   &   a  ] tR tRt o R tRtV tR# )4UNIXTestsBuilder.test_addresses.<locals>.SaveAddressi"  c                    \        VP                  4       VP                  4       R 7      V n        VP	                  4        R# ))hostpeerN)dictr   getPeer	addressesr   )rQ   r   s   &&rV   makeConnectionCUNIXTestsBuilder.test_addresses.<locals>.SaveAddress.makeConnection#  s3    !%"**,93D3D3F" ((*rY   )r   N)r[   r\   r]   r^   r   r`   ra   rb   s   @rV   SaveAddressr   "  s     + +rY   r   r   r   N)r0   r4   	endpointsrO   r   )rQ   r   rp   ru   s   &   rV   test_addressesUNIXTestsBuilder.test_addresses  sy    	+- 	+ fnnE))&163C3CF3KL))&163C3CF3KLrY   c                p  a aaa ^ RI Ho \        4       oSP                  R4       \        SP	                  4       R4      o\        4       pVP                  4       pVVV 3R lpVP                  V4       VP                  \        R4       VP                  V3R l4       \        S SVS P                  4       R# )z
L{IUNIXTransport.sendFileDescriptor} accepts an integer file descriptor
and sends a copy of it to the process reading from the connection.
)fromfd   junkc                    < S! V \         \        4      p\        V 4       SP                  SP	                  4       VP	                  4       4       SP                  SP                  4       VP                  4       4       R # r   )r	   r
   r   rO   getsocknameassertNotEqualfileno)r   receivedr   srQ   s   & rV   checkDescriptorAUNIXTestsBuilder.test_sendFileDescriptor.<locals>.checkDescriptor@  sY    j';?H* Q]]_h.B.B.DE
 
HOO,=>rY   z-Sending file descriptor encountered a problemc                 8   < SP                   P                  4       # r   r   r   ignoredrp   s   &rV   <lambda>:UNIXTestsBuilder.test_sendFileDescriptor.<locals>.<lambda>P      &"2"2"A"A"CrY   N)rG       )r   r   bindr   r   r   r   addCallback
addErrbackr?   addBothr4   r   )rQ   ru   dr   r   r   rp   s   f   @@@rV   test_sendFileDescriptor(UNIXTestsBuilder.test_sendFileDescriptor1  s     	"H	w#AHHJ8&($$&	? 	
o&	SIJ			CDffdnnErY   Tzfails under LXC in Debian CIc                     ! R R\         4      p ! R R\         4      pV! 4       pV! 4       pWCn        \        WW@P                  4       V P	                  VP
                  R4       R# )zm
If a L{IUNIXTransport.sendFileDescriptor} call fills up
the send buffer, any registered producer is paused.
c                   &   a  ] tR tRt o R tRtV tR# )SUNIXTestsBuilder.test_sendFileDescriptorTriggersPauseProducing.<locals>.DoesNotReadi[  c                :    V P                   P                  4        R # r   )r   pauseProducingr   s   &rV   r   bUNIXTestsBuilder.test_sendFileDescriptorTriggersPauseProducing.<locals>.DoesNotRead.connectionMade\  s    --/rY   rZ   Nr[   r\   r]   r^   r   r`   ra   rb   s   @rV   DoesNotReadr   [  s     0 0rY   r   c                   B   a  ] tR tRt o RtR tR tR tR tR t	Rt
V tR	# )
`UNIXTestsBuilder.test_sendFileDescriptorTriggersPauseProducing.<locals>.SendsManyFileDescriptorsi_  Fc                2  a  \        4       S n         S P                  P                  S R 4       V 3R lp\        V4      S n        S P                  P
                  S P                  n        S P                  P                  ^ 4      P                  \        R4       R# )Tc                     < S P                   P                  S P                  P                  4       4       S P                   P	                  R 4       R# )   xN)r   r   r   r   r   r   s   rV   senderUNIXTestsBuilder.test_sendFileDescriptorTriggersPauseProducing.<locals>.SendsManyFileDescriptors.connectionMade.<locals>.senderf  s4    NN55dkk6H6H6JKNN((.rY   zSend loop failureN)
r   r   registerProducerr/   taskr   clockstartr   r?   )rQ   r   s   f rV   r   oUNIXTestsBuilder.test_sendFileDescriptorTriggersPauseProducing.<locals>.SendsManyFileDescriptors.connectionMadeb  sf    $h//d;/ (/	"&.."8"8				"--c3FGrY   c                &    V P                  4        R # r   _disconnectr   s   &rV   stopProducingnUNIXTestsBuilder.test_sendFileDescriptorTriggersPauseProducing.<locals>.SendsManyFileDescriptors.stopProducingn        "rY   c                &    V P                  4        R # r   r  r   s   &rV   resumeProducingpUNIXTestsBuilder.test_sendFileDescriptorTriggersPauseProducing.<locals>.SendsManyFileDescriptors.resumeProducingq  r	  rY   c                h    R V n         V P                  P                  4        V P                  4        R# )TN)pausedr   unregisterProducerr  r   s   &rV   r   oUNIXTestsBuilder.test_sendFileDescriptorTriggersPauseProducing.<locals>.SendsManyFileDescriptors.pauseProducingt  s%    "113  "rY   c                    V P                   P                  4        V P                  P                  4        V P                  P                  P                  4        R # r   )r   stopr   abortConnectionotherr   s   &rV   r  lUNIXTestsBuilder.test_sendFileDescriptorTriggersPauseProducing.<locals>.SendsManyFileDescriptors._disconnecty  s6    		 ..0

$$446rY   )r  r   r   N)r[   r\   r]   r^   r  r   r  r  r   r  r`   ra   rb   s   @rV   SendsManyFileDescriptorsr   _  s)     F
H###
7 7rY   r  z*sendFileDescriptor producer was not pausedN)r0   r  r4   r   
assertTruer  )rQ   r   r  rp   ru   s   &    rV   -test_sendFileDescriptorTriggersPauseProducing>UNIXTestsBuilder.test_sendFileDescriptorTriggersPauseProducingT  sS    	0- 	0	7': 	7> *+fnnE'STrY   c                  a \        4       p\        VP                  4       R4      o\        4       p. pVP	                  4       pVP                  VP                  4       VP                  V3R l4       \        V SW P                  4       V P                  V^ ,          \        4       V^ ,          P                  \        4       V P                  SP                  P                  \        4       R# )a7  
If L{IUNIXTransport.sendFileDescriptor} is used to queue a greater
number of file descriptors than the number of bytes sent using
L{ITransport.write}, the connection is closed and the protocol connected
to the transport has its C{connectionLost} method called with a failure
wrapping L{FileDescriptorOverrun}.
Nc                 8   < SP                   P                  4       # r   r   r   s   &rV   r   =UNIXTestsBuilder.test_fileDescriptorOverrun.<locals>.<lambda>  r   rY   )r   r   r   r   r   r   appendr4   r   assertIsInstancer<   trapr&   r   valuer'   )rQ   cargoru   resultr   rp   s   &    @rV   test_fileDescriptorOverrun+UNIXTestsBuilder.test_fileDescriptorOverrun  s     #ELLND9&($$&			&-- 			CDffnnEfQi1q	'(fmm113HIrY   c                t  a ^ RI Hp ^ RIHp ^ RIHp R o\        \        4       ! V3R lR\        4      4       p ! R RV4      pV! \        \        4      w  rxV P                  VP                  4       V P                  VP                  4       V! 4       p	V! W4      p
\        4       w  r\        4       w  rV P                  \        V4       V P                  \        V4       R	pW.pV! V4      w  ppV! WV4       V
P                  4        V P!                  \#        V	P$                  4      V4       V P'                  \)        V4      P+                  \)        V	P$                  4      4      4       V	P$                  '       d6   V Uu. uF  pS! V4      NK  	  ppV P!                  VV	P,                  4       R
# R
# u upi )a9  
Drive _SendmsgMixin via sendmsg socket calls to check that
L{IFileDescriptorReceiver.fileDescriptorReceived} is called once
for each file descriptor received in the ancillary messages.

@param ancillaryPacker: A callable that will be given a list of
    two file descriptors and should return a two-tuple where:
    The first item is an iterable of zero or more (cmsg_level,
    cmsg_type, cmsg_data) tuples in the same order as the given
    list for actual sending via sendmsg; the second item is an
    integer indicating the expected number of FDs to be received.

socketpair)_SendmsgMixinsendmsgc                 H    \        V 4      pVP                  VP                  3# r   )r   st_devst_ino)r   fss   & rV   deviceInodeTupleTUNIXTestsBuilder._sendmsgMixinFileDescriptorReceivedDriver.<locals>.deviceInodeTuple  s    rBIIryy))rY   c                   4   <a  ] tR tRt o R tV3R ltRtV tR# )PUNIXTestsBuilder._sendmsgMixinFileDescriptorReceivedDriver.<locals>.FakeProtocoli  c                "    . V n         . V n        R # r   )fdsdeviceInodesReceivedr   s   &rV   r   YUNIXTestsBuilder._sendmsgMixinFileDescriptorReceivedDriver.<locals>.FakeProtocol.__init__  s    ,.)rY   c                   < V P                   P                  V4       V P                  P                  S! V4      4       \        V4       R # r   )r4  r  r5  r   )rQ   r   r/  s   &&rV   r   gUNIXTestsBuilder._sendmsgMixinFileDescriptorReceivedDriver.<locals>.FakeProtocol.fileDescriptorReceived  s4    #))001A"1EFb	rY   )r5  r4  N)r[   r\   r]   r^   r   r   r`   ra   )rc   r/  s   @rV   FakeProtocolr2    s     / rY   r9  c                   B   a  ] tR tRt o RtR tR tR tR tR t	Rt
V tR	# )
PUNIXTestsBuilder._sendmsgMixinFileDescriptorReceivedDriver.<locals>.FakeReceiveri     c                    Wn         W n        R # r   )r   protocol)rQ   sktprotos   &&&rV   r   YUNIXTestsBuilder._sendmsgMixinFileDescriptorReceivedDriver.<locals>.FakeReceiver.__init__  s    ! %rY   c                    R # r   rZ   r   s   &&rV   _dataReceived^UNIXTestsBuilder._sendmsgMixinFileDescriptorReceivedDriver.<locals>.FakeReceiver._dataReceived      rY   c                    R # r   rZ   r   s   &rV   r   XUNIXTestsBuilder._sendmsgMixinFileDescriptorReceivedDriver.<locals>.FakeReceiver.getHost  rE  rY   c                    R # r   rZ   r   s   &rV   r   XUNIXTestsBuilder._sendmsgMixinFileDescriptorReceivedDriver.<locals>.FakeReceiver.getPeer  rE  rY   c                    R # r   rZ   )rQ   os   &&rV   _getLogPrefix^UNIXTestsBuilder._sendmsgMixinFileDescriptorReceivedDriver.<locals>.FakeReceiver._getLogPrefix  rE  rY   )r>  r   N)r[   r\   r]   r^   
bufferSizer   rC  r   r   rL  r`   ra   rb   s   @rV   FakeReceiverr;    s(     J& rY   rO  s   some data needs to be sentN)r   r'  twisted.internet.unixr(  twisted.python.sendmsgr*  r   r(   r0   r   r
   
addCleanupr   r   r   doReadrO   lenr4  assertFalsesetintersectionr5  )rQ   ancillaryPackerr'  r(  r*  r9  rO  
sendSocket
recvSocketr@  receiver	fileOneFDfileOneName	fileTwoFDfileTwoName
dataToSend	fdsToSend	ancillaryexpectedCountr   deviceInodesSentr/  s   &&                   @rV   )_sendmsgMixinFileDescriptorReceivedDriver:UNIXTestsBuilder._sendmsgMixinFileDescriptorReceivedDriver  so   : 	&72	* 
,	-	. 	 
.		= 	& ",G[!A

(()
(()
2 ")	!(	,,2
*	#29#= 	=
	2 	UYY7 	Y44S^DE 999?HIy 0 4yI-u/I/IJ Is   F5c                B   a ^ RI Ho V3R lpV P                  V4       R# )z
_SendmsgMixin handles multiple file descriptors per recvmsg, calling
L{IFileDescriptorReceiver.fileDescriptorReceived} once per received
file descriptor. Scenario: single CMSG with two FDs.

SCM_RIGHTSc                 8   < \         S\        R .V O5!  3.p^pW3# )iir   r   )ra  rb  rc  ri  s   &  rV   rX  [UNIXTestsBuilder.test_multiFileDescriptorReceivedPerRecvmsgOneCMSG.<locals>.ancillaryPacker	  s*    $j$t2Hi2HIJIM++rY   NrQ  ri  re  rQ   rX  ri  s   & @rV   1test_multiFileDescriptorReceivedPerRecvmsgOneCMSGBUNIXTestsBuilder.test_multiFileDescriptorReceivedPerRecvmsgOneCMSG   s     	6	,
 	66GrY   z=Multi control message ancillary sendmsg not supported on Mac.c                B   a ^ RI Ho V3R lpV P                  V4       R# )z
_SendmsgMixin handles multiple file descriptors per recvmsg, calling
L{IFileDescriptorReceiver.fileDescriptorReceived} once per received
file descriptor. Scenario: two CMSGs with one FD each.
rh  c           	      \   < V  Uu. uF  p\         S\        R V4      3NK  	  pp^pW#3# u upi )irl  )ra  r   rb  rc  ri  s   &   rV   rX  \UNIXTestsBuilder.test_multiFileDescriptorReceivedPerRecvmsgTwoCMSGs.<locals>.ancillaryPacker  s8    KTU9R*j$sB-@9IUM++ Vs   )Nrn  ro  s   & @rV   2test_multiFileDescriptorReceivedPerRecvmsgTwoCMSGsCUNIXTestsBuilder.test_multiFileDescriptorReceivedPerRecvmsgTwoCMSGs  s     	6	,
 	66GrY   c                z  aa ^ RI Ho R pV3R lp. p\        VP                  4       V P	                  \
        VP                  4       V P                  SRV4       V P                  V4       Ro\        ;QJ d    V3R lV 4       F  '       g   K   RM	  RM! V3R lV 4       4      pV P                  VR	4       R
# )z
_SendmsgMixin handles multiple file descriptors per recvmsg, calling
L{IFileDescriptorReceiver.fileDescriptorReceived} once per received
file descriptor. Scenario: unsupported CMSGs.
r)  c                     . p^ pW3# )r   rZ   )ra  rb  rc  s   &  rV   rX  [UNIXTestsBuilder.test_multiFileDescriptorReceivedPerRecvmsgBadCMSG.<locals>.ancillaryPacker3  s    IM++rY   c                 6   < R pR.p^ pSP                  W4V4      # )s	   some data)NNrY   )ReceivedMessage)r?  argskwargsr   rb  flagsr*  s   &*,   rV   fakeRecvmsgUnsupportedAncillarykUNIXTestsBuilder.test_multiFileDescriptorReceivedPerRecvmsgBadCMSG.<locals>.fakeRecvmsgUnsupportedAncillary8  s(    D*+IE**4EBBrY   recvmsgz#received unsupported ancillary datac              3   <   <"   T F  pSVR ,          9   x  K  	  R# 5i)r|   NrZ   ).0eexpectedMessages   & rV   	<genexpr>UUNIXTestsBuilder.test_multiFileDescriptorReceivedPerRecvmsgBadCMSG.<locals>.<genexpr>G  s     CFqOq{2Fs   TFz+Expected message not found in logged eventsN)
twisted.pythonr*  r>   r  rR  r@   r   re  anyr  )rQ   rX  r  eventsfoundr  r*  s   &    @@rV   1test_multiFileDescriptorReceivedPerRecvmsgBadCMSGBUNIXTestsBuilder.test_multiFileDescriptorReceivedPerRecvmsgBadCMSG$  s     	+	,
	C FMM"6

7I'FG66G @CFCCFCCLMrY   c                   ^ RI Hp V! 4       w  r#. p\        VP                  4       V P	                  \
        VP                  4        ! R R\        4      pV! VP                  4       R4      p\        4       p\        WWpP                  4       VP                  4        VP                  R4       V P                  RVP                  R4      4       RpR	p	\        VP                   VP"                  V	VR
7      p
V F5  pV
P%                  4        F  w  rWP'                  V4      8w  g   K   K2  	   R# 	  V P)                  RV
: R\+        V4      : R24       R# )z
If associated with a protocol which does not provide
L{IFileDescriptorReceiver}, file descriptors received by the
L{IUNIXTransport} implementation are closed and a warning is emitted.
r&  c                   &   a  ] tR tRt o R tRtV tR# )RUNIXTestsBuilder.test_avoidLeakingFileDescriptors.<locals>.RecordEndpointAddressesi^  c                    V P                   P                  4       V n        V P                   P                  4       V n        \
        P                  V 4       R # r   )r   r   hostAddressr   peerAddressr   r   r   s   &rV   r   aUNIXTestsBuilder.test_avoidLeakingFileDescriptors.<locals>.RecordEndpointAddresses.connectionMade_  s:    #'>>#9#9#; #'>>#9#9#; "11$7rY   )r  r  Nr   rb   s   @rV   RecordEndpointAddressesr  ^  s     8 8rY   r  r   FrY   r<  z%(protocolName)s (on %(hostAddress)r) does not provide IFileDescriptorReceiver; closing file descriptor received (from %(peerAddress)r).r0   )r  r  protocolNamer|   zExpected event (z) not found in logged events ()N)r   r'  r>   r  rR  r@   r   r   r0   r4   r   r   setblockingrO   recvr   r  r  itemsgetr!   r   )rQ   r'  probeClientprobeServerr  r  rp   ru   r|   clsNameexpectedEventlogEventkvs   &             rV    test_avoidLeakingFileDescriptors1UNIXTestsBuilder.test_avoidLeakingFileDescriptorsJ  s6    	&#-< FMM"6	8&8 	8 )););)=wG$&fnnE 	 	&k..t45: 	
 ( **** 	
 H%++-Q' .
   II "rY   c                z  a  \        \        4       ! V 3R lR\        4      4       p\        4       p\	        VP                  4       R4      pV! 4       p\        S W4S P                  4       S P                  \        VP                  ^ ,          4       S P                  R\        VP                  R,          4      4       R# )zl
L{IUNIXTransport.sendFileDescriptor} sends file descriptors before
L{ITransport.write} sends normal bytes.
c                   :   <a  ] tR tRt o R tV3R ltR tRtV tR# )JUNIXTestsBuilder.test_descriptorDeliveredBeforeBytes.<locals>.RecordEventsi  c                @    \         P                  ! V 4       . V n        R # r   )r0   r   r  r   s   &rV   r   YUNIXTestsBuilder.test_descriptorDeliveredBeforeBytes.<locals>.RecordEvents.connectionMade  s    #2248 rY   c                |   < SP                  \        V4       V P                  P                  \	        V4      4       R # r   )rR  r   r  r  type)	innerSelfr   rQ   s   &&rV   r   aUNIXTestsBuilder.test_descriptorDeliveredBeforeBytes.<locals>.RecordEvents.fileDescriptorReceived  s*    z2  ''Z(89rY   c                <    V P                   P                  V4       R # r   )r  extendr   s   &&rV   r   WUNIXTestsBuilder.test_descriptorDeliveredBeforeBytes.<locals>.RecordEvents.dataReceived  s    ""4(rY   )r  N)	r[   r\   r]   r^   r   r   r   r`   ra   )rc   rQ   s   @rV   RecordEventsr    s     !:) )rY   r  r   :   NNN)r   r(   r0   r   r   r   r4   r   rO   intr  bytes)rQ   r  r!  rp   ru   s   f    rV   #test_descriptorDeliveredBeforeBytes4UNIXTestsBuilder.test_descriptorDeliveredBeforeBytes  s     
,	-
	). 
	) 
.
	) #ELLNG<fdnnEfmmA./%b(9":;rY   rZ   N)r[   r\   r]   r^   r_   r+   rz   ri   r   r   r   rB   isLinuxr   r   r   r   r*  sendmsgSkipReasonr   r  r#  re  rp  isMacOSXrv  r  r  r  r`   ra   rb   s   @rV   r   r      s     'IE E
C	
C< EO	OM, K*+ F , FD D01.U 2.U` K*+J ,J.aKF K*+H ,H G K*+H ,	
H K*+#N ,#NJ K*+J ,JX K*+< ,<rY   r   c                      a  ] tR tRt o Rt]P                  3tR t]	! ]
P                  ! 4       '       * R4      R 4       tRtV tR# )UNIXDatagramTestsBuilderi  z=
Builder defining tests relating to L{IReactorUNIXDatagram}.
c                X    V P                  RV P                  4       \        4       4       R# )zk
The UNIX socket created by L{IReactorUNIXDatagram.listenUNIXDatagram}
is created with the mode specified.
listenUNIXDatagramN)rW   r   r-   r   s   &rV   test_listenMode(UNIXDatagramTestsBuilder.test_listenMode  s    
 	+T[[]<L<NOrY   r   c                    \        V 4      pV P                  4       pVP                  ! RV,           \        4       4      pV P	                  VP                  4       \        RV,           4      4       R# )z
On Linux, a UNIX socket path may begin with C{' '} to indicate a
socket in the abstract namespace.  L{IReactorUNIX.listenUNIXDatagram}
accepts such a path.
r   N)rg   rL   r  r-   rO   r   r   r   s   &   rV   r   <UNIXDatagramTestsBuilder.test_listenOnLinuxAbstractNamespace  sU     T"##%))$+7G7IJTD[)ABrY   rZ   N)r[   r\   r]   r^   r_   r   IReactorUNIXDatagramrz   r  r   rB   r  r   r`   ra   rb   s   @rV   r  r    sN      %99;
P E	C		CrY   r  c                   D   a  ] tR tRt o Rt]]3tR tR t	V 3R lt
RtV tR# )SocketUNIXMixini  zV
Mixin which uses L{IReactorSocket.adoptStreamPort} to hand out listening
UNIX ports.
c                D   \        \        4      p\        RRR7      pVP                  V4       VP	                  ^4       VP                  R4        VP                  ! VP                  4       VP                  V4      VP                  4        #   TP                  4        i ; i)zR
Get a UNIX port from a reactor, wrapping an already-initialized file
descriptor.
rk   rl   rm   F)
r   r   r   r   listenr  adoptStreamPortr   familyr   )rQ   r   rT   portSockrS   s   &&&  rV   getListeningPort SocketUNIXMixin.getListeningPort  sv    
 '?W#.dU#	**8??+<hoowWNNHNNs   +B Bc                <    VP                   ! VP                  V4      # a  
Connect to a listening UNIX socket.

@param reactor: The reactor under test.
@type reactor: L{IReactorUNIX}

@param address: The listening's address.
@type address: L{UNIXAddress}

@param factory: The client factory.
@type factory: L{ClientFactory}

@return: The connector
r   rs   rQ   r   addressrT   s   &&&&rV   connectToListener!SocketUNIXMixin.connectToListener       ""7<<99rY   c                V   < V ^8  d   Qh/ S[ S[S[S[,          ,          ,          ;R&   # rx   r{   )r|   rc   s   "rV   r}   SocketUNIXMixin.__annotate__  s"      !$y/!:;  rY   rZ   N)r[   r\   r]   r^   r_   r+   r*   rz   r  r  r   r`   ra   rb   s   @rV   r  r    s+      	?
 :7  rY   r  c                   0   a  ] tR tRt o RtR tR tRtV tR# )ListenUNIXMixini  zN
Mixin which uses L{IReactorTCP.listenUNIX} to hand out listening UNIX
ports.
c                @    \        RRR7      pVP                  ! W24      # )z 
Get a UNIX port from a reactor
rk   rl   rm   )r   r   )rQ   r   rT   rS   s   &&& rV   r   ListenUNIXMixin.getListeningPort	  s!    
 W#.!!$00rY   c                <    VP                   ! VP                  V4      # r  r  r  s   &&&&rV   r  !ListenUNIXMixin.connectToListener  r  rY   rZ   N)	r[   r\   r]   r^   r_   r  r  r`   ra   rb   s   @rV   r  r    s     
1: :rY   r  c                   >   a  ] tR tRt o ]3tR tR tV 3R ltRt	V t
R# )UNIXPortTestsMixini#  c                T    V R\        VP                  4       P                  4      : 2# )zJ
Get the message expected to be logged when a UNIX port starts listening.
z starting on r;   r   rs   )rQ   r   rT   s   &&&rV   #getExpectedStartListeningLogMessage6UNIXPortTestsMixin.getExpectedStartListeningLogMessage&  s'     -T\\^5H5H(I'LMMrY   c                P    R\        VP                  4       P                  4       R2# )z:
Get the expected connection lost message for a UNIX port
z(UNIX Port z Closed)r  )rQ   r   s   &&rV   getExpectedConnectionLostLogMsg2UNIXPortTestsMixin.getExpectedConnectionLostLogMsg,  s%     \$,,.*=*=>?xHHrY   c                V   < V ^8  d   Qh/ S[ S[S[S[,          ,          ,          ;R&   # rx   r{   )r|   rc   s   "rV   r}   UNIXPortTestsMixin.__annotate__#  s      $y/!:;M rY   rZ   N)r[   r\   r]   r^   r+   rz   r  r  r   r`   ra   rb   s   @rV   r  r  #  s      ?KoNI  rY   r  c                       ] tR tRtRtRtR# )UNIXPortTestsBuilderi3  z&
Tests for L{IReactorUNIX.listenUnix}
rZ   Nr[   r\   r]   r^   r_   r`   rZ   rY   rV   r  r  3      rY   r  c                       ] tR tRtRtRtR# )UNIXFDPortTestsBuilderi>  z+
Tests for L{IReactorUNIX.adoptStreamPort}
rZ   Nr  rZ   rY   rV   r  r  >  r  rY   r  c                   <   a  ] tR tRt o ]]]3tR tR t	R t
RtV tR# )%UNIXAdoptStreamConnectionTestsBuilderiI  c                   V P                  4       p^ RIHp  ! R R\        4      pV! \        \
        4      w  rEVP                  R4       V P                  VP                  4       V P                  VP                  4       VP                  4       pV! 4       pVP                  ! V\        V4      pV P                  V4       R# )zh
{IReactorSocket.adoptStreamConnection} returns None if the given
factory's buildProtocol returns None.
r&  c                   &   a  ] tR tRt o R tRtV tR# )XUNIXAdoptStreamConnectionTestsBuilder.test_buildProtocolReturnsNone.<locals>.NoneFactoryi^  c                    R # r   rZ   )rQ   r  s   &&rV   buildProtocolfUNIXAdoptStreamConnectionTestsBuilder.test_buildProtocolReturnsNone.<locals>.NoneFactory.buildProtocol_  s    rY   rZ   N)r[   r\   r]   r^   r  r`   ra   rb   s   @rV   NoneFactoryr  ^  s      rY   r  FN)rL   r   r'  r.   r   r
   r  rR  r   r   adoptStreamConnectionassertIsNone)	rQ   r   r'  r  s1s2s1FDrT   r"  s	   &        rV   test_buildProtocolReturnsNoneCUNIXAdoptStreamConnectionTestsBuilder.test_buildProtocolReturnsNoneP  s     ##%%	- 	 G[1
u!!yy{-..tWgF&!rY   c                   a  V 3R lpS P                  4       pS P                  VRRR7      pVP                  V4       S P                  V4       R# )z.
Helper method to test UNIX server addresses.
c                 <  < V w  rp \        R VP                  4       P                  4      pSP                  RVP                  P
                  : RV: R2\        VP                  4      4       SP                  RVP                  P
                  : RV: 2VP                  P                  4       VP                  P                  ^ ,          pSP                  V\        4       VP                  P                  4        R#   TP                  P                  4        i ; i)rG   z<AccumulatingProtocol #z on >zAccumulatingProtocol,,N)r=   r   rs   rO   r   	sessionnostrlogstrrT   peerAddressesr  r   r   )	protocolsru   rp   r   portPathr  rQ   s   &     rV   	connectedOUNIXAdoptStreamConnectionTestsBuilder.test_ServerAddressUNIX.<locals>.connectedq  s    #, FD26r4<<>;N;NO  ''118=(()   ''118=$$++ %nn::1=%%k;?   //1  //1s   CC? ?DN)	interfaceaddressFamily)rL   getConnectedClientAndServerr   
runReactor)rQ   r  r   r   s   f   rV   test_ServerAddressUNIX<UNIXAdoptStreamConnectionTestsBuilder.test_ServerAddressUNIXl  sN    
	2, ##%,,t4 - 
 	
i  rY   c                  aaaa \        4       p\        4       Vn        \        4       o\        4       Sn        \        4       Sn        \	        4       p\        4       Vn        \        4       Vn        \        RRR7      pSP                  ! Wd4      oVV3R lpVP                  P                  V4       \        VP                  SP                  .4      pV3R lp	VP                  V	4       \        4       oSP                  V	4       \        VP                  SP                  .4      p
VV3R lpV
P                  V4       SP                  ! SP                  4       P                  V4       S# )a  
Return a L{Deferred} firing with a L{MyClientFactory} and
L{MyServerFactory} connected pair, and the listening C{Port}. The
particularity is that the server protocol has been obtained after doing
a C{adoptStreamConnection} against the original server connection.
rk   rl   rm   c                    < SP                   ! V P                  4       SP                  ! V P                  4       SP                  ! V P                  P	                  4       \
        S4       R # r   )removeReaderr   removeWriterr  r   r   )r@  r   rp   s   &rV   firstServerConnected_UNIXAdoptStreamConnectionTestsBuilder.getConnectedClientAndServer.<locals>.firstServerConnected  sF      1  1))%//*@*@*BGVTrY   c                 N   < SP                   '       d   SP                  ! 4        V # r   )runningr  )r"  r   s   &rV   r  OUNIXAdoptStreamConnectionTestsBuilder.getConnectedClientAndServer.<locals>.stop  s    MrY   c                 6   < V w  rSP                  WS34       R # r   )r   )r  ru   rp   deferredr   s   &  rV   r  PUNIXAdoptStreamConnectionTestsBuilder.getConnectedClientAndServer.<locals>.start  s    &NFvt45rY   )r8   r    protocolConnectionMadeprotocolConnectionLostr7   r   r   r   r"   r   r   r   r   rs   )rQ   r   r
  r  firstServerru   rS   r  lostDeferredr  startDeferredr  r  r   rp   s   &f&&        @@@rV   r  AUNIXAdoptStreamConnectionTestsBuilder.getConnectedClientAndServer  s&    &'-5Z* "(0
%(0
% "(0
%(0
% W#.!!$4	U
 	**667KL$**F,I,IJ
	
 	T":D!%**F,I,IJ
	6 	!!%(DLLN//8rY   rZ   N)r[   r\   r]   r^   r)   r*   r+   rz   r  r  r  r`   ra   rb   s   @rV   r  r  I  s+     "8 !D6 6rY   r  c                   J   a  ] tR tRt o Rt]3tRt]R 4       t	R t
R tRtV tR# )UnixClientTestsBuilderi  z/
Define tests for L{IReactorUNIX.connectUNIX}.
Nc                V    V P                   f   \        V 4      V n         V P                   # )zs
Return a path usable by C{connectUNIX} and C{listenUNIX}.

@return: A path instance, built with C{_abstractPath}.
)_pathrg   r   s   &rV   rS   UnixClientTestsBuilder.path  s$     ::&t,DJzzrY   c                <    VP                   ! V P                  V4      # )z
Start an UNIX server with the given C{factory}.

@param reactor: The reactor to create the UNIX port in.

@param factory: The server factory.

@return: A UNIX port instance.
)r   rS   rQ   r   rT   s   &&&rV   r  UnixClientTestsBuilder.listen  s     !!$))W55rY   c                <    VP                   ! V P                  V4      # )z
Start an UNIX client with the given C{factory}.

@param reactor: The reactor to create the connection in.

@param factory: The client factory.

@return: A UNIX connector instance.
)r   rS   r(  s   &&&rV   connectUnixClientTestsBuilder.connect  s     ""499g66rY   )r%  )r[   r\   r]   r^   r_   r+   rz   r%  propertyrS   r  r+  r`   ra   rb   s   @rV   r#  r#    s:      'E 
6
7 
7rY   r#  posixz%UNIX sockets only supported on POSIX.c                   R   a  ] tR tRt o RtRtR tV 3R lR ltR tR t	R	 t
R
tV tR# )RealSocketTestsi  z$
Test real UNIX socket connections.
unixpathc                  "   \         P                  P                  \        4      '       g   Q h\	        4       p\        P
                  ! V P                  V4      p\        V\        P                  4      '       g   Q hW!n
        V P                  VP                  4       \        4       p\        P                  ! V P                  V4       VP                  G Rj  xL
  VP                   '       g   Q hV P#                  VP                   P$                  4       V P#                  VP&                  4       VP(                  P+                  \,        P.                  4       R#  L5i)zd
A port created with L{IReactorTCP.listenUNIX} can be connected to with
L{IReactorTCP.connectUNIX}.
N)r   r+   
providedByr   r6   r   rS   
isinstancer   Portr   rR  cleanUpr7   r   r  lastProtocolr  madedisconnected
lostReasonr  r   ConnectionDone)rQ   fr   clientFs   &   rV   test_closePortInProtocolFactory/RealSocketTests.test_closePortInProtocolFactory  s     
 &&11'::::!!$))Q/$))))		"!#DIIw/#####,,112))* 4 45 	s   CEEE-A.Ec                >   < V ^8  d   QhRS[ S[S[.R3,          RR/# )ry   r   Nreturn)r   rE   )r|   rc   s   "rV   r}   RealSocketTests.__annotate__  s.     2 2 "68L!Mt!ST2	2rY   c                ~  "   \         P                  P                  \        4      '       g   Q h\	        4       p\        4       pW2n        \        P                  ! V P                  V4      pV P                  VP                  4       \        4       p\        4       pWen        \        P                  ! V P                  V4       \        W6.4      G Rj  xL
 w  rxV! Wx4       VP                  '       g   Q hVP                  '       g   Q hVP                  P                  4        VP                  P                  4        R#  Ll5i)zq
Invoke the given callback with a client protocol and a server protocol
which have been connected to each other.
N)r   r+   r3  r   r8   r    r  r   rS   rR  rN   r7   r   r"   r   r   )	rQ   r   serverFactoryserverConnMader   r=  clientConnMadeserverProtocolclientProtocols	   &&       rV   _connectedClientAndServerTest-RealSocketTests._connectedClientAndServerTest  s      &&11'::::')9A/=,!!$))];**+!#(0
)7&DIIw//<,0
 *
& 	0''''''''''  //1  //1*
s   CD=D;3D=9D=c                X   a "   R V 3R llpS P                  V4      G Rj  xL
  R#  L5i)z
The transport of a protocol connected with L{IReactorTCP.connectUNIX} or
L{IReactor.TCP.listenUNIX} can have L{ITCPTransport.getTcpNoDelay} or
L{ITCPTransport.setTcpNoDelay} called without error.
c                4    V ^8  d   QhR\         R\         RR/# ry   rG  rH  rA  NrD   )r|   s   "rV   r}   5RealSocketTests.test_tcpNoDelay.<locals>.__annotate__A  s$     
	? 
	?0
	?BV
	?
	?rY   c                   < W3 F  p\         P                  P                  VP                  4      '       g   Q hVP                  pSP	                  VP                  4       ^ 4       VP                  R4       SP	                  VP                  4       ^ 4       VP                  R4       SP	                  VP                  4       ^ 4       K  	  R# )r   TFN)r   ITCPTransportr3  r   rO   getTcpNoDelaysetTcpNoDelayrG  rH  pr   rQ   s   &&  rV   check.RealSocketTests.test_tcpNoDelay.<locals>.checkA  s     %5!//::1;;GGGGKK	  !8!8!:A>''-  !8!8!:A>''.  !8!8!:A> 6rY   NrI  rQ   rU  s   f rV   test_tcpNoDelayRealSocketTests.test_tcpNoDelay:  s&     
	? 
	? 00777   *(*c                X   a "   R V 3R llpS P                  V4      G Rj  xL
  R#  L5i)z
The transport of a protocol connected with L{IReactorTCP.connectUNIX} or
L{IReactor.TCP.listenUNIX} can have its I{SO_KEEPALIVE} state inspected
and manipulated with L{ITCPTransport.getTcpKeepAlive} and
L{ITCPTransport.setTcpKeepAlive}.
c                4    V ^8  d   QhR\         R\         RR/# rM  rD   )r|   s   "rV   r}   7RealSocketTests.test_tcpKeepAlive.<locals>.__annotate__W  s)     
	E 
	E0
	EBV
	E
	ErY   c                   < W3 F  p\         P                  P                  VP                  4      '       g   Q hVP                  pSP	                  VP                  4       R 4       VP                  R4       SP	                  VP                  4       R4       VP                  R 4       SP	                  VP                  4       R 4       K  	  R# )FTN)r   rP  r3  r   rO   getTcpKeepAlivesetTcpKeepAliverS  s   &&  rV   rU  0RealSocketTests.test_tcpKeepAlive.<locals>.checkW  s     %5!//::1;;GGGGKK	  !:!:!<eD))$/  !:!:!<dC))%0  !:!:!<eD 6rY   NrW  rX  s   f rV   test_tcpKeepAlive!RealSocketTests.test_tcpKeepAliveO  s(     
	E 
	E 00777r[  c                (  "   \         P                  P                  \        4      '       g   Q h\	        4       p\        P
                  ! RV^R7       VP                  G Rj  xL
  VP                  P                  \        P                  4       R#  L/5i)zR
Tests whether attempting to establish connection to non-existing UNIX path fails
znon-existing)timeoutN)r   r+   r3  r   r7   r   failDeferredr   r  r   ConnectError)rQ   r=  s   & rV   test_FailingRealSocketTests.test_Failinge  sj      &&11'::::!#NGQ?""""E../ 	#s   AB B!0BrZ   N)r[   r\   r]   r^   r_   rS   r>  rI  rY  rc  ri  r`   ra   rb   s   @rV   r0  r0    s4      D6,2 2<8*8,
0 
0rY   r0  )vr_   hashlibr   osr   r   r   r   r   pprintr   r   r	   r
   r   r   structr   tempfiler   r   typingr   r   r   r   r   unittestr   r   _AF_UNIXImportErrorzope.interfacer   r   twisted.internetr   r   r   r   r   twisted.internet.addressr   twisted.internet.deferr    r!   r"   twisted.internet.endpointsr#   r$   twisted.internet.errorr%   r&   r'   twisted.internet.interfacesr(   r)   r*   r+   twisted.internet.protocolr,   r-   r.   twisted.internet.taskr/   &twisted.internet.test.connectionmixinsr0   r1   r2   r3   r4   #twisted.internet.test.reactormixinsr5   twisted.internet.test.test_tcpr6   r7   r8   r9   r:   twisted.python.compatr;   twisted.python.failurer<   twisted.python.filepathr=   twisted.python.logr>   r?   r@   twisted.python.reflectrA   twisted.python.runtimerB   rC   twisted.test.test_tcprE   twisted.trial.unittestrF   r*  r  rI   rg   ri   r   r   r   r  r  r  r  r  r  r  globalsupdatemakeTestCaseClassesr#  r0  rZ   rY   rV   <module>r     s  
  2 2  ; ;   $ : : * G 1 B B 0 @ @ M 
  U T -  ?  / * ? ? ? 0 9 6 +
0
1 )*6K 
< <")?/ ?,", "J $%;/ ; &;|S<8L S<lC CB*: *:Z: :@I I 		{,C^ {| 	  !557 8 	  )==? @ 	  %99; < 	  ';;= > 	  6JJL M*7^-C *7Z 	  ';;= > !HIp0h p0 Jp0U  Gs   J4 4	K K