Use Fiddler to simulate slow network such as Wifi or Mobile Betwork

Sometimes our development environment is not on a public network, thus we cannot use a real mobile or Wifi network to test the behaviour in a slow/unreliable network.

One way is to use Fiddler as a proxy and to add delay in Fiddler to simulate the slow response.  


Mobile ----------- Notebook -------- Development Server
Device   (Mobile             (LAN or
          Hotspot)            Wifi)
          

Below is the steps:


  1. Download and install Fiddler.
  2. Enable remote connection to Fiddler
    (By default, Fiddler only handles traffic from local.  The mobile device is non-local, thus need to be enabedl)
    1. Open Tools - Options

    2. Under Connections tab, enable "Allow remote computers to connect".



    3. Press OK.  Restart Fiddler to make it effective.

  3. Enable Mobile Hotspot
    1. In Windows notebook, enable "Mobile hotspot".





    2.  You can further configure the Mobile Hotspot by right click on the icon:




    3. You can go to network connections to view the status and IP of the hotspot.  (One quick way is to run "ncpa.cpl" in command prompt.)  You may have multiple adapters generated.  Please focus on the one with "Microsoft Wi-fi Direct Virtual Adapter....".    My IP is 192.168.137.1.




  4. Download Fiddler root certificate to your mobile
    1. Connects your mobile into the Hotspot
    2. Open a browser and navigate to http://192.168.137.1:8888  (or the IP:port if your setting differs).
      (Note: Chrome is tested works, while Opera and DuckDuckGo browser cannot be used.)
    3. Download the root certificate.


    4. Install the root certificate for VP/Applications

  5. Configure Proxy Server in Mobile Phone and verify connections.
    1. Go to Wifi settings.  Find Proxy Settings (usually under Advanced). Change the settings from None to Manual.  Enter your IP address (e.g. 192.168.137.1) and port (e.g. 8888) as your Proxy IP and Port. 
    2. Go to your mobile.  Browse to some webpage.  Then check your Fiddler to see if related host/URL is logged.

  6. Slow down the Fiddler
    1. Open Rules - Customize Rules.  Then "Fiddler ScritEditor" will be opened.
    2. Find the second occurrence of m_SimulateModem.  Then change the two delay value to your desired value.  Save the file.




    3. In Fiddler, go to Rules - Performance, enable "Simulate Modem Speeds".
Reference Delay Value:

The default value is 300ms delay for request, and 150ms delay for response, and the effective simulated bandwidth is as below:

//
Upload bandwidth = 1KB/300ms = (1 * 8/1000) /0.300 ≈ 0.027Mbps
Download bandwidth = 1KB/150ms = (1 * 8/1000) /0.150 ≈ 0.053Mbps
(1MB = 1024 KB ≈ 1000 KB In order to simplify the calculation, we use 1000 Multiple , Ignore error )
//







Comments

Popular Posts