# Simulate slow netowrk connection

**URL:** https://discourse.mitmproxy.org/t/simulate-slow-netowrk-connection/114
**Category:** help
**Created:** [July 30, 2016, 10:16pm UTC](https://discourse.mitmproxy.org/t/simulate-slow-netowrk-connection/114 "2016-07-30T22:16:11Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![qakapil](https://avatars.discourse-cdn.com/v4/letter/q/9f8e36/32.png) [@qakapil](https://discourse.mitmproxy.org/u/qakapil)
#### Post date: [July 30, 2016, 10:16pm UTC](https://discourse.mitmproxy.org/t/simulate-slow-netowrk-connection/114/1 "2016-07-30T22:16:11Z")

</div>

Hi,

I am using mitmproxy to test and monitor API calls for our iOS app. Now my next use-case is to test how our app reacts in slow network conditions. I was wondering how I can use Mitmproxy to simulate a slow network connection. First thought which came to my mind is to have random time.sleep() in my def response() methods, but probably this is a very naive way to achieve this ? Any suggestions ?

Regards,  
Kapil.

---

<div class="post-metadata">

### Author: ![qakapil](https://avatars.discourse-cdn.com/v4/letter/q/9f8e36/32.png) [@qakapil](https://discourse.mitmproxy.org/u/qakapil)
#### Post date: [August 2, 2016, 7:53am UTC](https://discourse.mitmproxy.org/t/simulate-slow-netowrk-connection/114/2 "2016-08-02T07:53:57Z")

</div>

Unfortunately no response to my query yet. I hope it was not an ignorable stupid question which I asked 🙂

Regards,  
Kapil.

---

<div class="post-metadata">

### Author: ![mhils](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mitmproxy.org/mhils/32/7_2.png) [@mhils](https://discourse.mitmproxy.org/u/mhils)
#### Post date: [August 9, 2016, 1:47am UTC](https://discourse.mitmproxy.org/t/simulate-slow-netowrk-connection/114/3 "2016-08-09T01:47:15Z")

</div>

Hi @qakapil,

You can use `time.sleep()` in the response hook (don’t forget to set the concurrent decorator in that case), but to be honest we don’t really have good means in mitmproxy to simulate connection troubles at the moment. I’d suggest checking for a dedicated app that does packet dropping, slowdown, etc.

Cheers,  
Max
