mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-26 18:18:25 +00:00
fixup coverage
This commit is contained in:
parent
d6cd1489d6
commit
e2772f3eec
@ -26,10 +26,10 @@ class DestinationKnown(layer.Layer, metaclass=ABCMeta):
|
|||||||
if self.context.options.connection_strategy == "eager":
|
if self.context.options.connection_strategy == "eager":
|
||||||
err = yield commands.OpenConnection(self.context.server)
|
err = yield commands.OpenConnection(self.context.server)
|
||||||
if err:
|
if err:
|
||||||
self._handle_event = self.done
|
self._handle_event = self.done # type: ignore
|
||||||
return err
|
return err
|
||||||
|
|
||||||
self._handle_event = self.child_layer.handle_event
|
self._handle_event = self.child_layer.handle_event # type: ignore
|
||||||
yield from self.child_layer.handle_event(events.Start())
|
yield from self.child_layer.handle_event(events.Start())
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
@ -276,6 +276,22 @@ def test_reverse_eager_connect_failure(tctx: Context):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def test_transparent_eager_connect_failure(tctx: Context, monkeypatch):
|
||||||
|
"""Test that we recover from a transparent mode resolve error."""
|
||||||
|
tctx.options.connection_strategy = "eager"
|
||||||
|
monkeypatch.setattr(platform, "original_addr", lambda sock: ("address", 22))
|
||||||
|
|
||||||
|
assert (
|
||||||
|
Playbook(modes.TransparentProxy(tctx), logs=True)
|
||||||
|
<< GetSocket(tctx.client)
|
||||||
|
>> reply(object())
|
||||||
|
<< OpenConnection(tctx.server)
|
||||||
|
>> reply("something something")
|
||||||
|
<< CloseConnection(tctx.client)
|
||||||
|
>> ConnectionClosed(tctx.client)
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
CLIENT_HELLO = b"\x05\x01\x00"
|
CLIENT_HELLO = b"\x05\x01\x00"
|
||||||
SERVER_HELLO = b"\x05\x00"
|
SERVER_HELLO = b"\x05\x00"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user