based on http://sourceforge.net/projects/poxy/