### Question:
RxGatewayStoreModel implements RxStoreModel { @Override public Observable<RxDocumentServiceResponse> processMessage(RxDocumentServiceRequest request) { this.applySessionToken(request); Observable<RxDocumentServiceResponse> responseObs = invokeAsync(request); return responseObs.onErrorResumeNext( e -> { DocumentClientException dce = Utils.as(e, DocumentClientException.class); if (dce == null) { logger.error("unexpected failure {}", e.getMessage(), e); return Observable.error(e); } if ((!ReplicatedResourceClientUtils.isMasterResource(request.getResourceType())) && (dce.getStatusCode() == HttpConstants.StatusCodes.PRECONDITION_FAILED || dce.getStatusCode() == HttpConstants.StatusCodes.CONFLICT || ( dce.getStatusCode() == HttpConstants.StatusCodes.NOTFOUND && !Exceptions.isSubStatusCode(dce, HttpConstants.SubStatusCodes.READ_SESSION_NOT_AVAILABLE)))) { this.captureSessionToken(request, dce.getResponseHeaders()); } return Observable.error(dce); } ).map(response -> { this.captureSessionToken(request, response.getResponseHeaders()); return response; } ); } RxGatewayStoreModel(
            ISessionContainer sessionContainer,
            ConsistencyLevel defaultConsistencyLevel,
            QueryCompatibilityMode queryCompatibilityMode,
            UserAgentContainer userAgentContainer,
            GlobalEndpointManager globalEndpointManager,
            CompositeHttpClient<ByteBuf, ByteBuf> httpClient); Observable<RxDocumentServiceResponse> performRequest(RxDocumentServiceRequest request, HttpMethod method); @Override Observable<RxDocumentServiceResponse> processMessage(RxDocumentServiceRequest request);  }### Answer:
@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: .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()); }