'Is that posibble to modify APK to pass all traffic via VPN?

Is that possible to modify, patch Android app, to pass all application traffic through some ip (country region) ? For example inject code for pass traffic through VPN conenction or maybe via proxy. Application wrote on cocos2d-x (lua + java) and I see additional libs, like okhttp3, protobuf, retrofit etc. Maybe i can modify okhttp3 to force use it proxy or vpn, and all APK traffic will now come from new country ip what i need ? Do someone had some experience in such things ?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source