Thank you
@DonManfred for pointing me to the right path.
I've been struggling to resolve this problem over three days now, searching about HttpServer including one of thread you just refer. I just not notice
@Erel state that calling sleep or wait for will pause the sub or calling return
So i modify the code using old fashion way how to handle JobDone event without using wait for, the result/problem still remain.
I see on okHttpUtil2
source code and CallSubDelayed was fired there on Download method, so i guess this is why my code does not work (terminated).
So my conclusion is calling REST API on HandleRequest event is impossible.
What i'm going to achieve ?
I plan to create android app as a bridge between app on several desktop pc to do some rest call to a web over internet. The desktop pc has NO internet connection, while the android i want to build will connect to WiFi which HAS internet connection. Both desktop pc and android device was manage in the same network by network admin.
The android app will act similar to EDC (Electonic Data Capture) machine with specific job. So using HttpServer is the most simpler i can do to handle desktop app request and make some rest api and send the respond/result to desktop app.
Since its not possible using HttpServer i will use another way to resolve
Thank you