Skip to content

1. How to embed the proxy in other application

Tamás Kőhegyi edited this page Jun 3, 2021 · 4 revisions

Embedding JAR

If you're using Java, the easiest way to get started is to embed the project directly. The jar is available in maven.

Related gradle.build file should look like:

repositories {
    mavenCentral()
    ...
}
    
dependencies {
    implementation('website.magyar:mitm-java-proxy:2.0.20.99')
    ...
}    

mitmJavaProxy works with JDK8, JDK11 and JDK13, the suggested JDK version is OpenJDK13.

Proxy Classes to be used

website.magyar.mitm.proxy.ProxyServer - is the proxy itself

website.magyar.mitm.proxy.RequestInterceptor - is the request interceptor interface class

website.magyar.mitm.proxy.ResponseInterceptor - is the response interceptor interface class

website.magyar.mitm.proxy.http.MitmJavaProxyHttpRequest - is the captured request itself, available via the request interceptor and ready to be manipulated/used

website.magyar.mitm.proxy.http.MitmJavaProxyHttpResponse - is the captured response itself, available via the response interceptor and ready to be manipulated/used

That's all classes to be used. Everything else is up to you.

Now continue with How to start and stop the proxy.