Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Best way to analyze http traffic sent by my java code?

I have some java code both new (using Apache commons http libraries) and old (strictly using java 1.4 API) and am trying to rewrite the old code using the newer apache commons libraries. However, it isn't working and I'm struggling to find out why. The requests are being sent, but my newer code times out on the receiving server which I don't have access to. Since the old code works, I must have mucked up the http request. It would be very useful to use some sort of HTTP traffic sniffer to examine exactly what is being sent so I can see what differences there are.

I've downloaded a few http sniffers from the web (this one and that one) but neither capture any of the http data being sent by my java code (but they do work when I send random requests from a browser). Any ideas out there on how I can get my hands on this data?

like image 460
Chris Knight Avatar asked Jan 31 '11 16:01

Chris Knight


2 Answers

Use wireshark.

It's great, free, open-source, cross-platform, and can highlight different network layers, and it's not running from some dubious website that looks like SEO spam.

Snort is another good one, but it's more geared toward intrusion detection and automated responses to that. Still, it has a great sniffer.

like image 59
Sdaz MacSkibbons Avatar answered Sep 28 '22 22:09

Sdaz MacSkibbons


Typically I find that packet sniffing is too low level for troubleshooting HTTP. Try a reverse proxy; personally I like Charles as it works the same in Windows, Mac OS X and Linux; Fiddler is a popular on Windows.

like image 29
Uriah Carpenter Avatar answered Sep 28 '22 22:09

Uriah Carpenter