Secrets to Debugging Network Traffic

As many of you know, I am Java Programmer and a cURL fan. When I am demonstrating an API to a customer or another IBMer, I tend to default to either method to demonstrate the API.

I was demonstrating a download API that was being redirected, and throwing an error on a different Node.  In order to debug the traffic, I used a couple of different methods.

1 – For Java

I added -Djavax.net.debug=ssl:handshake:verbose  to the Java VM Arguments.  In Eclipse, I configure the Run Configuration -> VM Arguments.

java -Djavax.net.debug=ssl:handshake:verbose  MyAPIDemo

I absolutely make sure you have enough buffer in your console window.  I right click and update to a 100,000 lines.  I like to keep it as high as possible to capture all the details.

Scroll Through the output and find out what actually happened in the request.

2 – For cURL

I add -vv which is super verbose to the command

curl -H "Authorization: Basic asdfljkfasdf" https://api.com/api -vv

I read through and find out why my API failed.

You can read more about the configuration in the IBM JDK Documentation.

Leave a Reply

Your email address will not be published. Required fields are marked *