How to Intercept and Debug All Java HTTP. HTTP Toolkit can capture, inspect and rewrite any JVM HTTP from fresh or already running processes. Let's see how Java agents and Byte Buddy make this possible.
Building debugging tools for the JVM, with Java agents and Byte Buddy.
Java and the JVM more generally are widely used for services everywhere, but often challenging to debug and manually test, particularly in complicated microservice architectures.
HTTP requests and responses are the core of interactions between these services, and with their external APIs, but they're also often invisible and inaccessible. It's hard to examine all outgoing requests, simulate unusual responses & errors in a running system, or mock dependencies during manual testing & prototyping.
Over the last couple of weeks, I've built a Java agent which can do this, completely automatically. It can seize control of all HTTP & HTTPS requests in any JVM, either at startup or attaching later, to redirect them to a proxy and trust that proxy to decrypt all HTTPS, allowing MitM of all JVM traffic. Zero code changes or manual configuration required.
This means you can pick any JVM process - your own locally running service, Gradle, Intellij, anything you like - and inspect, breakpoint, and mock all of its HTTP(S) requests in 2 seconds flat.
In this article, I want to walk you through the details of how this is possible, so you can understand some of the secret powers of the JVM, learn how to transform raw bytecode for yourself, and build on the examples and source code behind this to build your own debugging & instrumentation tools.
If you just want to try this out right now, **[go download HTTP Toolkit**](https://httptoolkit.tech/java/).
If you want to know how on earth this is possible, and how you can write code that does the same, read on:
Guidelines for Java Code Reviews.Get a jump-start on your next code review session with this list.
What is OpenJDK? OpenJDk or Open Java Development Kit is a free, open-source framework of the Java Platform, Standard Edition (or Java SE).
Minimum Java Knowledge Requirements for Your First Coding Job. If you are still wondering about it then this article is for you.
Java Coding Standards. The guidelines provided by Java are intended to improve the readability of code and make it consistent across the wide spectrum of Java…
In this article, we will talk about the most important new feature introduced with Java 10, officially called local variable type inference. An extremely important function in java. You will regret skipping this article.