I've read the discussion, and now I am working on my own simple Android firewall. Here is the algorithm they used.
I was able to forward packets. If I remember correctly I just needed to read the TCP header and open another socket to that destination and send it headerless.
So now I need to write data to my Wi-Fi or 3G network interface if I understand them correctly. How to do that?