Skip to content

1. How to embed the proxy in other application

Tamás Kőhegyi edited this page Dec 30, 2020 · 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 jcenter.

Related gradle.build file should look like:

repositories {
    jcenter()
    ...
}
    
dependencies {
    implementation('org.rockhill.mitm:mitmJavaProxy:2.0.17.57')
    ...
}    

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

Proxy Classes to be used

org.rockhill.mitm.proxy.ProxyServer - is the proxy itself

org.rockhill.mitm.proxy.RequestInterceptor - is the request interceptor interface class

org.rockhill.mitm.proxy.ResponseInterceptor - is the response interceptor interface class

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

org.rockhill.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.

Clone this wiki locally