@Test(groups = "unit")
public void readTimeout() throws Exception {

    ISessionContainer sessionContainer = Mockito.mock(ISessionContainer.class);
    QueryCompatibilityMode queryCompatibilityMode = QueryCompatibilityMode.Default;
    UserAgentContainer userAgentContainer = new UserAgentContainer();
    GlobalEndpointManager globalEndpointManager = Mockito.mock(GlobalEndpointManager.class);
    Mockito.doReturn(new URL("https://localhost"))
            .when(globalEndpointManager).resolveServiceEndpoint(Mockito.any());
    CompositeHttpClient<ByteBuf, ByteBuf> httpClient = Mockito.mock(CompositeHttpClient.class);
    Mockito.doReturn(Observable.error(ReadTimeoutException.INSTANCE))
            .when(httpClient).submit(Mockito.any(RxClient.ServerInfo.class), Mockito.any(HttpClientRequest.class));
    RxGatewayStoreModel storeModel = new RxGatewayStoreModel(
            sessionContainer,
            ConsistencyLevel.Session,
            queryCompatibilityMode,
            userAgentContainer,
            globalEndpointManager,
            httpClient);
    RxDocumentServiceRequest dsr = RxDocumentServiceRequest.createFromName(
            OperationType.Read, "/dbs/db/colls/col/docs/docId", ResourceType.Document);
    dsr.getHeaders().put("key", "value");
    dsr.requestContext = Mockito.mock(DocumentServiceRequestContext.class);
    Observable<RxDocumentServiceResponse> resp = storeModel.processMessage(dsr);
    validateFailure(resp, FailureValidator.builder()
            .instanceOf(DocumentClientException.class)
            .causeInstanceOf(ReadTimeoutException.class)
            .documentClientExceptionHeaderRequestContainsEntry("key", "value")
            .statusCode(0).build());
}