I want to create a simple anonymous proxy server to demonstrate an experiment.

I want to monitor the input packets and output packets of this proxy as well.

Are there any available software or code to achieve this?