ϪfdZddlmZedZerddlmZddlmZddlm Z ddl m Z m Z ddl mZGd d ejZy ) z, Tests for L{twisted.conch.ssh.forwarding}. ) requireModule cryptography) forwarding) IPv6Address)deterministicResolvingReactor)MemoryReactorClockStringTransport)unittestc0eZdZdZesdZdeddfdZddZy) TestSSHConnectForwardingChannelzH Unit and integration tests for L{SSHConnectForwardingChannel}. zCannot run without cryptographyreactorreturnNc|jdd}|jd}|jd}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. rN) peerAddress) tcpClients connectors buildProtocolr getDestinationmakeConnection)selfr factory connectorprotocol transports D/usr/lib/python3/dist-packages/twisted/conch/test/test_forwarding.pymakeTCPConnectionz1TestSSHConnectForwardingChannel.makeTCPConnectionsZ$$Q'*&&q) ((.# 0H0H0JK  *ctjd}t}t|dg|_|j d|j ||j|j|j|jtj|jtddd|jjjy)z When a hostname is sent as part of forwarding requests, it is resolved using HostnameEndpoint's resolver. )zfwd.example.org)hostportz::1NTCPr )rSSHConnectForwardingChannelrr_reactor channelOpenrsuccessResultOf_channelOpenDeferredassertIsInstanceclientSSHForwardingClient assertEqualrrgetPeer)rsut memoryReactors r test_channelOpenHostnameRequestsz@TestSSHConnectForwardingChannel.test_channelOpenHostnameRequests+s 44>WX*, 4]UGL   }- S556 cjj**H*HI  ud +SZZ-A-A-I-I-K r)rN) __name__ __module__ __qualname____doc__rskiprrr/rrr r s* 0 +); + + rr N)r3twisted.python.reflectrrtwisted.conch.sshrtwisted.internet.addressr$twisted.internet.test.test_endpointsrtwisted.internet.testingrr twisted.trialr TestCaser r5rrr=s= 1^, ,0NH"( h&7&7( r