Debug HTTP calls from code using Wireshark

Wireshark Filter

Http calls from code are pretty common now a days. Sometime it is very difficult to understand when calls are failing, lot of things could go wrong. Some one them are –

  1. Server firewall might be blocking the call.
  2. My firewall could be the issue.
  3. Maybe server not accepting the call because I’m not sending right param or header.

However, one of my favourite tool to debug this kind of situation Wireshark. Install it from here. You can check this video to learn it or see tutorial online.

Once you have installed and running the application, you can separate network calls that you are making from your code using filter.

Use following filter –

ip.dst == 10.200.96.106 && http

ip.dst is the ip of destination server and http is refers to calls from browser.

Happy debugging 🙂

Attach debugger in IntelliJ with Spring Boot application

intellij idea

If you run your java application inside the IntelliJ, you can do it with the green debug button. But, if you are running the application from command line, like me, it’s the way to go –

Step 1: Run your application with debug jvm arguments.

$ mvn spring-boot:run -Drun.jvmArguments="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005"

Step 2: Configure IntelliJ.

  • Select menu Run -> Edit Configurations
  • Create new Remote Configuration. Default configuration works with 5005 port. Change if you see fit.
  • Connect application by running (green bug icon!) Remote Configuration created on last step.

Step 3: Happy debugging 🙂