### Question:
RetryingSolrServer extends SolrClient { @Override public void close() { isShuttingDown.countDown(); try { solrServer.close(); } catch (IOException e) { throw new RuntimeException(e); } } RetryingSolrServer(SolrClient solrServer, 
                            RetryPolicyFactory retryPolicyFactory, 
                            MetricsFacade metrics); final SolrClient getUnderlyingSolrServer(); @Override NamedList<Object> request(final SolrRequest request, String collection); @Override DocumentObjectBinder getBinder(); @Override void close();  }### Answer:
@Test public void testRetries() throws Exception { new DefaultRetryPolicyFactory(); SolrQuery query = getDefaultQuery(); FailingSolrServer failingSolrServer = new FailingSolrServer(solrServer); SolrClient solr = new RetryingSolrServer( failingSolrServer, new DefaultRetryPolicyFactory(new FlexibleBoundedExponentialBackoffRetry( TimeUnit.MILLISECONDS.toNanos(1), TimeUnit.MILLISECONDS.toNanos(1000), 20, TimeUnit.MINUTES.toNanos(5))), getMetricsFacade() ); Assert.assertNotNull(solr.query(query)); Assert.assertEquals(FailingSolrServer.SUCCESS, failingSolrServer.getNumRequests()); Assert.assertEquals(FailingSolrServer.SUCCESS - 1, failingSolrServer.getNumInjectedFailures()); solr.query(query); Assert.assertEquals(FailingSolrServer.SUCCESS + 1, failingSolrServer.getNumRequests()); Assert.assertEquals(FailingSolrServer.SUCCESS - 1, failingSolrServer.getNumInjectedFailures()); failingSolrServer.reset(); Assert.assertNotNull(solr.query(query)); Assert.assertEquals(FailingSolrServer.SUCCESS, failingSolrServer.getNumRequests()); Assert.assertEquals(FailingSolrServer.SUCCESS - 1, failingSolrServer.getNumInjectedFailures()); solr.query(query); Assert.assertEquals(FailingSolrServer.SUCCESS + 1, failingSolrServer.getNumRequests()); Assert.assertEquals(FailingSolrServer.SUCCESS - 1, failingSolrServer.getNumInjectedFailures()); failingSolrServer.reset(); solr.close(); try { solr.query(query); fail(); } catch (RetriesExhaustedException e) { assertTrue(e.getCause() instanceof FailingSolrServer.InjectedSolrServerException); Assert.assertEquals(1, failingSolrServer.getNumRequests()); Assert.assertEquals(1, failingSolrServer.getNumInjectedFailures()); } }