Пример #1
0
        def _introduce(adave):
            # The third way is to mangle the location hints, which will
            # result in a failure during negotiation as it attempts to
            # establish a TCP connection.

            (tubid, location_hints, name) = decode_furl(adave.tracker.url)
            # highly unlikely that there's anything listening on this port
            location_hints = [("tcp", "127.0.0.1", 2)]
            adave.tracker.url = encode_furl(tubid, location_hints, name)
            return self.shouldFail(ConnectionRefusedError, "Bad.test_location",
                                   "Connection was refused by other side",
                                   self.acarol.callRemote, "set", adave)
Пример #2
0
 def _introduce(adave):
     # The second way is to mangle the tubid, which will result in a
     # failure during negotiation. We mangle it by reversing the
     # characters: this makes it syntactically valid but highly
     # unlikely to remain the same. NOTE: this will have to change
     # when we modify the way gifts are referenced, since tracker.url
     # is scheduled to go away.
     (tubid, location_hints, name) = decode_furl(adave.tracker.url)
     tubid = "".join(reversed(tubid))
     adave.tracker.url = encode_furl(tubid, location_hints, name)
     return self.shouldFail(BananaError, "Bad.test_tubid",
                            "unknown TubID", self.acarol.callRemote,
                            "set", adave)
Пример #3
0
        def _introduce(adave):
            # The third way is to mangle the location hints, which will
            # result in a failure during negotiation as it attempts to
            # establish a TCP connection.

            (encrypted, tubid, location_hints, name) = \
                decode_furl(adave.tracker.url)
            # highly unlikely that there's anything listening on this port
            location_hints = [ ("ipv4", "127.0.0.1", 2) ]
            adave.tracker.url = encode_furl(encode_furl, tubid,
                                            location_hints, name)
            return self.shouldFail(ConnectionRefusedError, "Bad.test_location",
                                   "Connection was refused by other side",
                                   self.acarol.callRemote, "set", adave)
Пример #4
0
 def _introduce(adave):
     # The second way is to mangle the tubid, which will result in a
     # failure during negotiation. We mangle it by reversing the
     # characters: this makes it syntactically valid but highly
     # unlikely to remain the same. NOTE: this will have to change
     # when we modify the way gifts are referenced, since tracker.url
     # is scheduled to go away.
     (encrypted, tubid, location_hints, name) = \
         decode_furl(adave.tracker.url)
     tubid = "".join(reversed(tubid))
     adave.tracker.url = encode_furl(encode_furl, tubid,
                                     location_hints, name)
     return self.shouldFail(BananaError, "Bad.test_tubid", "unknown TubID",
                            self.acarol.callRemote, "set", adave)
Пример #5
0
 def _introduce(adave):
     # The next form of mangling is to connect to a port which never
     # responds, which could happen if a firewall were silently
     # dropping the TCP packets. We can't accurately simulate this
     # case, but we can connect to a port which accepts the connection
     # and then stays silent. This should trigger the overall
     # connection timeout.
     (tubid, location_hints, name) = decode_furl(adave.tracker.url)
     location_hints = [("tcp", "127.0.0.1", p.getHost().port)]
     adave.tracker.url = encode_furl(tubid, location_hints, name)
     self.tubD.options['connect_timeout'] = 2
     return self.shouldFail(
         NegotiationError, "Bad.test_hang",
         "no connection established within client timeout",
         self.acarol.callRemote, "set", adave)
Пример #6
0
 def _introduce(adave):
     # The next form of mangling is to connect to a port which never
     # responds, which could happen if a firewall were silently
     # dropping the TCP packets. We can't accurately simulate this
     # case, but we can connect to a port which accepts the connection
     # and then stays silent. This should trigger the overall
     # connection timeout.
     (encrypted, tubid, location_hints, name) = \
         decode_furl(adave.tracker.url)
     location_hints = [ ("ipv4", "127.0.0.1", p.getHost().port) ]
     adave.tracker.url = encode_furl(encode_furl, tubid,
                                     location_hints, name)
     self.tubD.options['connect_timeout'] = 2
     return self.shouldFail(NegotiationError, "Bad.test_hang",
                            "no connection established within client timeout",
                            self.acarol.callRemote, "set", adave)