使用代理时 HttpClient 响应为 null (Charles)
我有一些返回 JSON 的休息服务运行良好。但是当我让模拟器通过网络代理(Charles)运行时,突然我的 getResponse() 得到了 null。
令人沮丧的是,我可以看到查尔斯的回应和请求看起来很棒。
- 当模拟器通过代理运行时,还有其他人看到过 org.apache.http.client.HttpClient 的问题吗?
- 关于如何解决这个问题的建议?
- 我应该切换到另一个代理吗?我知道提琴手,但那只是电脑......
- 还有其他想法吗?
谢谢 :)
I have some rest services returning JSON that are working just fine. BUT when I make the emulator run through a web proxy (Charles) then all of the sudden I'm getting null for the getResponse().
Whats frustrating is that I can see in Charles that the response and request look great.
- Anyone else seen problems with org.apache.http.client.HttpClient when the emulator is running through a proxy?
- Suggestions on how to get around this?
- Should I switch to another proxy? I know of fiddler but that is pc only...
- Any other ideas?
Thanks :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
所以我不知道为什么响应返回空,但我能够使用 HTTP 嗅探器而不是代理查看流量。我使用了 HTTPScoop,这是一个不错的小应用程序。
使用 HTTPScoop 的好处还在于,当我打开互联网共享并让我的手机使用 Mac 上的 WiFi 时,我还可以看到实际设备上的流量。因此,这对于调试手机本身发生的情况非常有用。
So I don't know why the response is coming back null, but I was able to view the traffic with an HTTP sniffer NOT a proxy. I used HTTPScoop, which is a nice little app.
Also the nice thing about using HTTPScoop is that I can also see traffic on my actual device when I turn on internet sharing and have my phone use the wifi from my mac. So this is a good deal for debugging what happens on the phone itself.
Charles 使用 sdk r13 和以下模拟器参数:
-http-proxy localhost.:8888 -port 5554 -debug-proxy
这已被证实在我的 mac 上工作。
Charles works with sdk r13 and the following emulator arguments:
-http-proxy localhost.:8888 -port 5554 -debug-proxy
this was confirmed working on my mac.