Mock response when original connection failed

Hi, everyone

     Recently, I tried to analyze some apps on Android Emulator. However, some network connections always failed to connect remote server. Does someone know that how to mock (return) a response when the original connection failed using Mitmproxy?

     Thanks for any advice about this.

Hi,

If you specify --no-upstream-cert, you can return a mock response before mitmproxy attempts to connect upstream. :slight_smile:

Thanks a lot. Sorry about responding later.
I have tried your advice and it is nice.
Now I have another question.
Dose mitmproxy support the ‘adaptive’ mock response? Namely, only when the original request doesn’t receive any response, then, mitmproxy return a mock response and the other normal requests remain unchanged.

Thanks