Java: Display request of an HttpURLConnection before sending
tcpdump will work, but it can be hard to make it do what you want. NetCat is more user-friendly (here's the project page: http://netcat.sourceforge.net/ - most Unix platforms already include it).
nc -l 9999
This will listen on TCP port 9999, and when an HTTP client connects, it'll print out the full text of the request.
You can put the HttpURLConnection in debug mode by enabling java.logging with
-Djava.util.logging.config.file=logging.properties
and put in logging.properties (by default in JRE_HOME\lib) the following property
sun.net.www.protocol.http.HttpURLConnection.level = ALL