0

My app is under development running in an emulator and I need to route traffic through Fiddler now and then to inspect and test.

How do I make the HttpURLConnection class to simply follow the PC's proxy settings instead of having to set a proxy in code?

It is easier to press F12 to turn Fiddler on/off than to add code and use a config file.

Old Geezer
  • 14,854
  • 31
  • 111
  • 198
  • What do you mean? You tagged your question with `android` and mentioned an 'app' what does it have to do with your **PC** proxy settings? – Oleg Sep 14 '17 at 01:10
  • An Android app under development running in an emulator. If Fiddler is turned on, the proxy settings for the PC (development host) is set to route through Fiddler (localhost:8888). This can be switched on/off interactively at Fiddler by pressing F12. If `HttpURLConnection` can be configured to follow the host's proxy settings, I can selectively decide whether a particular connection activity will go through Fiddler. If I use code to add a `Proxy` object to `HttpURLConnection`, it will take a lot of work to have fine grain proxy on/off. – Old Geezer Sep 14 '17 at 01:15
  • But if the host is your PC and you create the connection from an android phone(or emulator) it doesn't matter what are the proxy settings on the PC. – Oleg Sep 14 '17 at 01:19
  • I don't want set up the app to use a proxy. As the app is in an emulator on a PC, I want the app (emulator) to use whatever the host is configured to use. Http connection classes for other frameworks typically can follow the host's proxy settings. Can Java's be configured to do the same also? (In production, the app won't be using any proxies.) – Old Geezer Sep 14 '17 at 01:46
  • Java can https://stackoverflow.com/questions/376101/setting-jvm-jre-to-use-windows-proxy-automatically I don't think it's going to help your android app inside an emulator, you should check if you can configure the emulator to do it. – Oleg Sep 14 '17 at 01:50
  • Thanks for the lead. I will ask the `android-studio` tag about `useSystemProxies`. – Old Geezer Sep 14 '17 at 01:59

1 Answers1

0

It is possible to configure a proxy in the emulator:

enter image description here

Old Geezer
  • 14,854
  • 31
  • 111
  • 198