Simulate no network using Retrofit and MockWebServer
Retrofit has a retrofit-mock module which offers a MockRestAdapter class whose purpose is to simulate network delay and errors. This is a used in conjunction with the normal RestAdapter to create an instance of your service. You can see a full example in the samples/mock-github-client/ folder of the repo: https://github.com/square/retrofit/tree/parent-1.9.0/retrofit-samples/mock-github-client MockRestAdapter offers these APIs: setDelay … Read more