
    Vh                         d Z ddlmZ  ed      Zer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  G d	 d
ej                        Zy)z,
Tests for L{twisted.conch.ssh.forwarding}.
    )requireModulecryptography)
forwarding)IPv6Address)deterministicResolvingReactor)MemoryReactorClockStringTransport)unittestc                   0    e Zd ZdZesdZdeddfdZddZy)	TestSSHConnectForwardingChannelzH
    Unit and integration tests for L{SSHConnectForwardingChannel}.
    zCannot run without cryptographyreactorreturnNc                     |j                   d   d   }|j                  d   }|j                  d      }t        |j	                               }|j                  |       y)z
        Fake that connection was established for first connectTCP request made
        on C{reactor}.

        @param reactor: Reactor on which to fake the connection.
        @type  reactor: A reactor.
        r      N)peerAddress)
tcpClients
connectorsbuildProtocolr	   getDestinationmakeConnection)selfr   factory	connectorprotocol	transports         R/home/dcms/DCMS/lib/python3.12/site-packages/twisted/conch/test/test_forwarding.pymakeTCPConnectionz1TestSSHConnectForwardingChannel.makeTCPConnection   sZ     $$Q'*&&q)	((.#	0H0H0JK		*    c                    t        j                  d      }t               }t        |dg      |_        |j                  d       | j                  |       | j                  |j                         | j                  |j                  t         j                         | j                  t        ddd      |j                  j                  j                                y)z
        When a hostname is sent as part of forwarding requests, it
        is resolved using HostnameEndpoint's resolver.
        )zfwd.example.org  )hostportz::1NTCPr    )r   SSHConnectForwardingChannelr   r   _reactorchannelOpenr   successResultOf_channelOpenDeferredassertIsInstanceclientSSHForwardingClientassertEqualr   r   getPeer)r   sutmemoryReactors      r    test_channelOpenHostnameRequestsz@TestSSHConnectForwardingChannel.test_channelOpenHostnameRequests+   s    
 44>WX*,4]UGL}-S556 	cjj**H*HIud+SZZ-A-A-I-I-K	
r   )r   N)	__name__
__module____qualname____doc__r   skipr   r   r/    r   r   r   r      s*     0+); + +
r   r   N)r3   twisted.python.reflectr   r   twisted.conch.sshr   twisted.internet.addressr   $twisted.internet.test.test_endpointsr   twisted.internet.testingr   r	   twisted.trialr
   TestCaser   r5   r   r   <module>r=      s=   
 1^,, 0 N H "(
h&7&7 (
r   