使用代理时 HttpClient 响应为 null (Charles)

发布于 2024-10-08 04:40:43 字数 300 浏览 5 评论 0原文

我有一些返回 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

心不设防 2024-10-15 04:40:43

所以我不知道为什么响应返回空,但我能够使用 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.

心是晴朗的。 2024-10-15 04:40:43

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文