I have an appointment where I need to create a proxy server that will manipulate some requests / responses that it receives, implement caching, etc.
Firstly, I want to create a simple proxy that simply passes all requests and responses. I did a few searches on the Internet, and I'm a little confused about how to listen for requests on a specific port and receive HTTP requests. I stumbled upon the Socket
, ServerSocket
, HttpURLConnection
, but I'm not sure how all this interacts. I tried to read the documents, but they are all intertwined and a little difficult to understand.
Can you point me in the right direction, which classes should I use for this purpose, and perhaps share a snippet to listen on the port, get the headers of HTTP requests, etc.?
source share