RequestSender.sendRequests checks if the response returns a new API config, then changes the hosts and retries the request. Callbacks will be executed by the subsequent request.
Socket layer is modified to allow disconnecting of old socket and connecting a new one. Important to note is that you need to wait until socket is connected to disconnect it successfully.
New API and Dev server configs are saved in shared preferences from APIConfig.
Testing steps
Added couple of unit tests in ChangeHostTest.java.
Most modifications are tested manually.
Background
Change API and Dev server endpoints based on API response. HTTP status will be 200 OK and success false. Example of response:
Implementation
RequestSender.sendRequests
checks if the response returns a new API config, then changes the hosts and retries the request. Callbacks will be executed by the subsequent request.Socket layer is modified to allow disconnecting of old socket and connecting a new one. Important to note is that you need to wait until socket is connected to disconnect it successfully.
New API and Dev server configs are saved in shared preferences from
APIConfig
.Testing steps
Added couple of unit tests in
ChangeHostTest.java
. Most modifications are tested manually.