It seems I found what I did wrong: I placed my class wrapper with HttpsUtils2 class into session.
After I declared my class wrapper with HttpsUtils2 class as member variable of server handler. (Now I have two server handler classes and accordingly two wrappers/httputils2) problems disappeared and I hope will not come back.
Sub hc_ResponseSuccess (Response As OkHttpResponse, TaskId As Int)
Response.GetAsynchronously("response", File.OpenOutput(TempDir, TaskId), False), _
True, TaskId)
End Sub
I add to each file special prefix to avoid naming conflict between HttpUtils2 instances working in concurrent server threads.
B4X:
Sub hc_ResponseSuccess (Response As OkHttpResponse, a_iTaskId As Int)
Response.GetAsynchronously("response", File.OpenOutput(TaskResponseContentDirName, TaskResponseContentFileName(a_iTaskId), False), _
True, a_iTaskId)
End Sub