You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@accumulo.apache.org by GitBox <gi...@apache.org> on 2018/01/12 01:15:45 UTC

[GitHub] ctubbsii closed pull request #341: ACCUMULO-3902 Ensure [Batch]Scanners are closed in ITs

ctubbsii closed pull request #341: ACCUMULO-3902 Ensure [Batch]Scanners are closed in ITs
URL: https://github.com/apache/accumulo/pull/341
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/test/src/main/java/org/apache/accumulo/test/AuditMessageIT.java b/test/src/main/java/org/apache/accumulo/test/AuditMessageIT.java
index c99ba98ef2..be4af24fd0 100644
--- a/test/src/main/java/org/apache/accumulo/test/AuditMessageIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/AuditMessageIT.java
@@ -367,21 +367,20 @@ public void testDataOperationsAudits() throws AccumuloSecurityException, Accumul
 
     // Start testing activities here
     // A regular scan
-    Scanner scanner = auditConnector.createScanner(OLD_TEST_TABLE_NAME, auths);
-    for (Map.Entry<Key,Value> entry : scanner) {
-      System.out.println("Scanner row: " + entry.getKey() + " " + entry.getValue());
+    try (Scanner scanner = auditConnector.createScanner(OLD_TEST_TABLE_NAME, auths)) {
+      for (Map.Entry<Key,Value> entry : scanner) {
+        System.out.println("Scanner row: " + entry.getKey() + " " + entry.getValue());
+      }
     }
-    scanner.close();
 
     // A batch scan
-    BatchScanner bs = auditConnector.createBatchScanner(OLD_TEST_TABLE_NAME, auths, 1);
-    bs.fetchColumn(new Text("cf1"), new Text("cq1"));
-    bs.setRanges(Arrays.asList(new Range("myRow", "myRow~")));
-
-    for (Map.Entry<Key,Value> entry : bs) {
-      System.out.println("BatchScanner row: " + entry.getKey() + " " + entry.getValue());
+    try (BatchScanner bs = auditConnector.createBatchScanner(OLD_TEST_TABLE_NAME, auths, 1)) {
+      bs.fetchColumn(new Text("cf1"), new Text("cq1"));
+      bs.setRanges(Arrays.asList(new Range("myRow", "myRow~")));
+      for (Map.Entry<Key,Value> entry : bs) {
+        System.out.println("BatchScanner row: " + entry.getKey() + " " + entry.getValue());
+      }
     }
-    bs.close();
 
     // Delete some data.
     auditConnector.tableOperations().deleteRows(OLD_TEST_TABLE_NAME, new Text("myRow"), new Text("myRow~"));
@@ -425,8 +424,7 @@ public void testDeniedAudits() throws AccumuloSecurityException, AccumuloExcepti
     try {
       auditConnector.tableOperations().offline(OLD_TEST_TABLE_NAME);
     } catch (AccumuloSecurityException ex) {}
-    try {
-      Scanner scanner = auditConnector.createScanner(OLD_TEST_TABLE_NAME, auths);
+    try (Scanner scanner = auditConnector.createScanner(OLD_TEST_TABLE_NAME, auths)) {
       scanner.iterator().next().getKey();
     } catch (RuntimeException ex) {}
     try {
diff --git a/test/src/main/java/org/apache/accumulo/test/BadDeleteMarkersCreatedIT.java b/test/src/main/java/org/apache/accumulo/test/BadDeleteMarkersCreatedIT.java
index e997d8bc2c..6c8fde234d 100644
--- a/test/src/main/java/org/apache/accumulo/test/BadDeleteMarkersCreatedIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/BadDeleteMarkersCreatedIT.java
@@ -163,16 +163,16 @@ public void test() throws Exception {
     sleepUninterruptibly(timeoutFactor * 15, TimeUnit.SECONDS);
     log.info("Verifying that delete markers were deleted");
     // look for delete markers
-    Scanner scanner = c.createScanner(MetadataTable.NAME, Authorizations.EMPTY);
-    scanner.setRange(MetadataSchema.DeletesSection.getRange());
-    for (Entry<Key,Value> entry : scanner) {
-      String row = entry.getKey().getRow().toString();
-      if (!row.contains("/" + tableId + "/")) {
-        log.info("Ignoring delete entry for a table other than the one we deleted");
-        continue;
+    try (Scanner scanner = c.createScanner(MetadataTable.NAME, Authorizations.EMPTY)) {
+      scanner.setRange(MetadataSchema.DeletesSection.getRange());
+      for (Entry<Key,Value> entry : scanner) {
+        String row = entry.getKey().getRow().toString();
+        if (!row.contains("/" + tableId + "/")) {
+          log.info("Ignoring delete entry for a table other than the one we deleted");
+          continue;
+        }
+        Assert.fail("Delete entry should have been deleted by the garbage collector: " + entry.getKey().getRow().toString());
       }
-      Assert.fail("Delete entry should have been deleted by the garbage collector: " + entry.getKey().getRow().toString());
     }
   }
-
 }
diff --git a/test/src/main/java/org/apache/accumulo/test/BalanceFasterIT.java b/test/src/main/java/org/apache/accumulo/test/BalanceFasterIT.java
index 70e94f761f..e3ed95a45e 100644
--- a/test/src/main/java/org/apache/accumulo/test/BalanceFasterIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/BalanceFasterIT.java
@@ -74,28 +74,32 @@ public void test() throws Exception {
     // give a short wait for balancing
     sleepUninterruptibly(10, TimeUnit.SECONDS);
     // find out where the tabets are
-    Scanner s = conn.createScanner(MetadataTable.NAME, Authorizations.EMPTY);
-    s.fetchColumnFamily(MetadataSchema.TabletsSection.CurrentLocationColumnFamily.NAME);
-    s.setRange(MetadataSchema.TabletsSection.getRange());
-    Map<String,Integer> counts = new HashMap<>();
-    while (true) {
-      int total = 0;
-      counts.clear();
-      for (Entry<Key,Value> kv : s) {
-        String host = kv.getValue().toString();
-        if (!counts.containsKey(host))
-          counts.put(host, 0);
-        counts.put(host, counts.get(host) + 1);
-        total++;
+    Iterator<Integer> i;
+    try (Scanner s = conn.createScanner(MetadataTable.NAME, Authorizations.EMPTY)) {
+      s.fetchColumnFamily(MetadataSchema.TabletsSection.CurrentLocationColumnFamily.NAME);
+      s.setRange(MetadataSchema.TabletsSection.getRange());
+      Map<String,Integer> counts = new HashMap<>();
+      while (true) {
+        int total = 0;
+        counts.clear();
+        for (Entry<Key,Value> kv : s) {
+          String host = kv.getValue().toString();
+          if (!counts.containsKey(host))
+            counts.put(host, 0);
+          counts.put(host, counts.get(host) + 1);
+          total++;
+        }
+        // are enough tablets online?
+        if (total > 1000)
+          break;
       }
-      // are enough tablets online?
-      if (total > 1000)
-        break;
+
+      // should be on all three servers
+      assertTrue(counts.size() == 3);
+      // and distributed evenly
+      i = counts.values().iterator();
     }
-    // should be on all three servers
-    assertTrue(counts.size() == 3);
-    // and distributed evenly
-    Iterator<Integer> i = counts.values().iterator();
+
     int a = i.next();
     int b = i.next();
     int c = i.next();
@@ -103,5 +107,4 @@ public void test() throws Exception {
     assertTrue(Math.abs(a - c) < 3);
     assertTrue(a > 330);
   }
-
 }
diff --git a/test/src/main/java/org/apache/accumulo/test/BatchWriterInTabletServerIT.java b/test/src/main/java/org/apache/accumulo/test/BatchWriterInTabletServerIT.java
index b9560b6c1a..2fe00447b3 100644
--- a/test/src/main/java/org/apache/accumulo/test/BatchWriterInTabletServerIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/BatchWriterInTabletServerIT.java
@@ -104,24 +104,23 @@ private void test(String t1, String t2, Connector c, IteratorSetting itset, int
     c.tableOperations().attachIterator(t2, summer);
 
     Map.Entry<Key,Value> actual;
-    // Scan t1 with an iterator that writes to table t2
-    Scanner scanner = c.createScanner(t1, Authorizations.EMPTY);
-    scanner.addScanIterator(itset);
-    actual = Iterators.getOnlyElement(scanner.iterator());
-    Assert.assertTrue(actual.getKey().equals(k, PartialKey.ROW_COLFAM_COLQUAL));
-    Assert.assertEquals(BatchWriterIterator.SUCCESS_VALUE, actual.getValue());
-    scanner.close();
+    try (Scanner scanner = c.createScanner(t1, Authorizations.EMPTY)) {
+      // Scan t1 with an iterator that writes to table t2
+      scanner.addScanIterator(itset);
+      actual = Iterators.getOnlyElement(scanner.iterator());
+      Assert.assertTrue(actual.getKey().equals(k, PartialKey.ROW_COLFAM_COLQUAL));
+      Assert.assertEquals(BatchWriterIterator.SUCCESS_VALUE, actual.getValue());
+    }
 
-    // ensure entries correctly wrote to table t2
-    scanner = c.createScanner(t2, Authorizations.EMPTY);
-    actual = Iterators.getOnlyElement(scanner.iterator());
-    log.debug("t2 entry is " + actual.getKey().toStringNoTime() + " -> " + actual.getValue());
-    Assert.assertTrue(actual.getKey().equals(k, PartialKey.ROW_COLFAM_COLQUAL));
-    Assert.assertEquals(numEntriesToWritePerEntry, Integer.parseInt(actual.getValue().toString()));
-    scanner.close();
+    try (Scanner scanner = c.createScanner(t2, Authorizations.EMPTY)) {
+      // ensure entries correctly wrote to table t2
+      actual = Iterators.getOnlyElement(scanner.iterator());
+      log.debug("t2 entry is " + actual.getKey().toStringNoTime() + " -> " + actual.getValue());
+      Assert.assertTrue(actual.getKey().equals(k, PartialKey.ROW_COLFAM_COLQUAL));
+      Assert.assertEquals(numEntriesToWritePerEntry, Integer.parseInt(actual.getValue().toString()));
+    }
 
     c.tableOperations().delete(t1);
     c.tableOperations().delete(t2);
   }
-
 }
diff --git a/test/src/main/java/org/apache/accumulo/test/CleanWalIT.java b/test/src/main/java/org/apache/accumulo/test/CleanWalIT.java
index bcefcf8d1d..dac2caf703 100644
--- a/test/src/main/java/org/apache/accumulo/test/CleanWalIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/CleanWalIT.java
@@ -128,20 +128,21 @@ public void test() throws Exception {
   }
 
   private int countLogs(String tableName, Connector conn) throws TableNotFoundException {
-    Scanner scanner = conn.createScanner(MetadataTable.NAME, Authorizations.EMPTY);
-    scanner.fetchColumnFamily(MetadataSchema.TabletsSection.LogColumnFamily.NAME);
-    scanner.setRange(MetadataSchema.TabletsSection.getRange());
     int count = 0;
-    for (Entry<Key,Value> entry : scanner) {
-      log.debug("Saw {}={}", entry.getKey(), entry.getValue());
-      count++;
+    try (Scanner scanner = conn.createScanner(MetadataTable.NAME, Authorizations.EMPTY)) {
+      scanner.fetchColumnFamily(MetadataSchema.TabletsSection.LogColumnFamily.NAME);
+      scanner.setRange(MetadataSchema.TabletsSection.getRange());
+      for (Entry<Key,Value> entry : scanner) {
+        log.debug("Saw {}={}", entry.getKey(), entry.getValue());
+        count++;
+      }
     }
     return count;
   }
 
   int count(String tableName, Connector conn) throws Exception {
-    Scanner s = conn.createScanner(tableName, Authorizations.EMPTY);
-    return Iterators.size(s.iterator());
+    try (Scanner s = conn.createScanner(tableName, Authorizations.EMPTY)) {
+      return Iterators.size(s.iterator());
+    }
   }
-
 }
diff --git a/test/src/main/java/org/apache/accumulo/test/ClientSideIteratorIT.java b/test/src/main/java/org/apache/accumulo/test/ClientSideIteratorIT.java
index 180eed1aa2..dffacee942 100644
--- a/test/src/main/java/org/apache/accumulo/test/ClientSideIteratorIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/ClientSideIteratorIT.java
@@ -99,12 +99,12 @@ public void testIntersect() throws Exception {
     bw.addMutation(m);
     bw.flush();
 
-    final ClientSideIteratorScanner csis = new ClientSideIteratorScanner(conn.createScanner(tableName, new Authorizations()));
     final IteratorSetting si = new IteratorSetting(10, tableName, IntersectingIterator.class);
-    IntersectingIterator.setColumnFamilies(si, new Text[] {new Text("bar"), new Text("foo")});
-    csis.addScanIterator(si);
-
-    checkResults(csis, resultSet3, PartialKey.ROW_COLFAM_COLQUAL);
+    try (ClientSideIteratorScanner csis = new ClientSideIteratorScanner(conn.createScanner(tableName, new Authorizations()))) {
+      IntersectingIterator.setColumnFamilies(si, new Text[] {new Text("bar"), new Text("foo")});
+      csis.addScanIterator(si);
+      checkResults(csis, resultSet3, PartialKey.ROW_COLFAM_COLQUAL);
+    }
   }
 
   @Test
@@ -125,20 +125,20 @@ public void testVersioning() throws Exception {
     bw.addMutation(m);
     bw.flush();
 
-    final Scanner scanner = conn.createScanner(tableName, new Authorizations());
+    try (Scanner scanner = conn.createScanner(tableName, new Authorizations()); ClientSideIteratorScanner csis = new ClientSideIteratorScanner(scanner)) {
 
-    final ClientSideIteratorScanner csis = new ClientSideIteratorScanner(scanner);
-    final IteratorSetting si = new IteratorSetting(10, "localvers", VersioningIterator.class);
-    si.addOption("maxVersions", "2");
-    csis.addScanIterator(si);
+      final IteratorSetting si = new IteratorSetting(10, "localvers", VersioningIterator.class);
+      si.addOption("maxVersions", "2");
+      csis.addScanIterator(si);
 
-    checkResults(csis, resultSet1, PartialKey.ROW_COLFAM_COLQUAL_COLVIS_TIME);
-    checkResults(scanner, resultSet2, PartialKey.ROW_COLFAM_COLQUAL_COLVIS_TIME);
+      checkResults(csis, resultSet1, PartialKey.ROW_COLFAM_COLQUAL_COLVIS_TIME);
+      checkResults(scanner, resultSet2, PartialKey.ROW_COLFAM_COLQUAL_COLVIS_TIME);
 
-    csis.fetchColumnFamily(new Text("colf"));
-    checkResults(csis, resultSet1, PartialKey.ROW_COLFAM_COLQUAL_COLVIS_TIME);
-    csis.clearColumns();
-    csis.fetchColumnFamily(new Text("none"));
-    assertFalse(csis.iterator().hasNext());
+      csis.fetchColumnFamily(new Text("colf"));
+      checkResults(csis, resultSet1, PartialKey.ROW_COLFAM_COLQUAL_COLVIS_TIME);
+      csis.clearColumns();
+      csis.fetchColumnFamily(new Text("none"));
+      assertFalse(csis.iterator().hasNext());
+    }
   }
 }
diff --git a/test/src/main/java/org/apache/accumulo/test/CloneIT.java b/test/src/main/java/org/apache/accumulo/test/CloneIT.java
index 409487f014..64a93fc0e2 100644
--- a/test/src/main/java/org/apache/accumulo/test/CloneIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/CloneIT.java
@@ -111,19 +111,17 @@ public void testFilesChange() throws Exception {
 
     assertEquals(0, rc);
 
-    Scanner scanner = conn.createScanner(tableName, Authorizations.EMPTY);
-    scanner.setRange(new KeyExtent(Table.ID.of("1"), null, null).toMetadataRange());
-
     HashSet<String> files = new HashSet<>();
 
-    for (Entry<Key,Value> entry : scanner) {
-      if (entry.getKey().getColumnFamily().equals(DataFileColumnFamily.NAME))
-        files.add(entry.getKey().getColumnQualifier().toString());
+    try (Scanner scanner = conn.createScanner(tableName, Authorizations.EMPTY)) {
+      scanner.setRange(new KeyExtent(Table.ID.of("1"), null, null).toMetadataRange());
+      for (Entry<Key,Value> entry : scanner) {
+        if (entry.getKey().getColumnFamily().equals(DataFileColumnFamily.NAME))
+          files.add(entry.getKey().getColumnQualifier().toString());
+      }
     }
-
     assertEquals(1, files.size());
     assertTrue(files.contains("../0/default_tablet/1_0.rf"));
-
   }
 
   // test split where files of children are the same
@@ -152,19 +150,18 @@ public void testSplit1() throws Exception {
 
     assertEquals(0, rc);
 
-    Scanner scanner = conn.createScanner(tableName, Authorizations.EMPTY);
-    scanner.setRange(new KeyExtent(Table.ID.of("1"), null, null).toMetadataRange());
-
     HashSet<String> files = new HashSet<>();
-
     int count = 0;
-    for (Entry<Key,Value> entry : scanner) {
-      if (entry.getKey().getColumnFamily().equals(DataFileColumnFamily.NAME)) {
-        files.add(entry.getKey().getColumnQualifier().toString());
-        count++;
+
+    try (Scanner scanner = conn.createScanner(tableName, Authorizations.EMPTY)) {
+      scanner.setRange(new KeyExtent(Table.ID.of("1"), null, null).toMetadataRange());
+      for (Entry<Key,Value> entry : scanner) {
+        if (entry.getKey().getColumnFamily().equals(DataFileColumnFamily.NAME)) {
+          files.add(entry.getKey().getColumnQualifier().toString());
+          count++;
+        }
       }
     }
-
     assertEquals(1, count);
     assertEquals(1, files.size());
     assertTrue(files.contains("../0/default_tablet/0_0.rf"));
@@ -202,20 +199,18 @@ public void testSplit2() throws Exception {
 
     assertEquals(0, rc);
 
-    Scanner scanner = conn.createScanner(tableName, Authorizations.EMPTY);
-    scanner.setRange(new KeyExtent(Table.ID.of("1"), null, null).toMetadataRange());
-
     HashSet<String> files = new HashSet<>();
-
     int count = 0;
 
-    for (Entry<Key,Value> entry : scanner) {
-      if (entry.getKey().getColumnFamily().equals(DataFileColumnFamily.NAME)) {
-        files.add(entry.getKey().getColumnQualifier().toString());
-        count++;
+    try (Scanner scanner = conn.createScanner(tableName, Authorizations.EMPTY)) {
+      scanner.setRange(new KeyExtent(Table.ID.of("1"), null, null).toMetadataRange());
+      for (Entry<Key,Value> entry : scanner) {
+        if (entry.getKey().getColumnFamily().equals(DataFileColumnFamily.NAME)) {
+          files.add(entry.getKey().getColumnQualifier().toString());
+          count++;
+        }
       }
     }
-
     assertEquals(1, files.size());
     assertEquals(2, count);
     assertTrue(files.contains("../0/default_tablet/1_0.rf"));
@@ -272,19 +267,18 @@ public void testSplit3() throws Exception {
 
     assertEquals(0, rc);
 
-    Scanner scanner = conn.createScanner(tableName, Authorizations.EMPTY);
-    scanner.setRange(new KeyExtent(Table.ID.of("1"), null, null).toMetadataRange());
-
     HashSet<String> files = new HashSet<>();
-
     int count = 0;
-    for (Entry<Key,Value> entry : scanner) {
-      if (entry.getKey().getColumnFamily().equals(DataFileColumnFamily.NAME)) {
-        files.add(entry.getKey().getColumnQualifier().toString());
-        count++;
+
+    try (Scanner scanner = conn.createScanner(tableName, Authorizations.EMPTY)) {
+      scanner.setRange(new KeyExtent(Table.ID.of("1"), null, null).toMetadataRange());
+      for (Entry<Key,Value> entry : scanner) {
+        if (entry.getKey().getColumnFamily().equals(DataFileColumnFamily.NAME)) {
+          files.add(entry.getKey().getColumnQualifier().toString());
+          count++;
+        }
       }
     }
-
     assertEquals(2, count);
     assertEquals(2, files.size());
     assertTrue(files.contains("../0/d1/file1"));
@@ -337,19 +331,18 @@ public void testClonedMarker() throws Exception {
 
     assertEquals(0, rc);
 
-    Scanner scanner = conn.createScanner(tableName, Authorizations.EMPTY);
-    scanner.setRange(new KeyExtent(Table.ID.of("1"), null, null).toMetadataRange());
-
     HashSet<String> files = new HashSet<>();
-
     int count = 0;
-    for (Entry<Key,Value> entry : scanner) {
-      if (entry.getKey().getColumnFamily().equals(DataFileColumnFamily.NAME)) {
-        files.add(entry.getKey().getColumnQualifier().toString());
-        count++;
+
+    try (Scanner scanner = conn.createScanner(tableName, Authorizations.EMPTY)) {
+      scanner.setRange(new KeyExtent(Table.ID.of("1"), null, null).toMetadataRange());
+      for (Entry<Key,Value> entry : scanner) {
+        if (entry.getKey().getColumnFamily().equals(DataFileColumnFamily.NAME)) {
+          files.add(entry.getKey().getColumnQualifier().toString());
+          count++;
+        }
       }
     }
-
     assertEquals(3, count);
     assertEquals(3, files.size());
     assertTrue(files.contains("../0/d1/file1"));
diff --git a/test/src/main/java/org/apache/accumulo/test/ConditionalWriterIT.java b/test/src/main/java/org/apache/accumulo/test/ConditionalWriterIT.java
index 45ed2f3e13..90982cd9f0 100644
--- a/test/src/main/java/org/apache/accumulo/test/ConditionalWriterIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/ConditionalWriterIT.java
@@ -153,7 +153,8 @@ public void testBasic() throws Exception {
 
     conn.tableOperations().create(tableName);
 
-    try (ConditionalWriter cw = conn.createConditionalWriter(tableName, new ConditionalWriterConfig())) {
+    try (ConditionalWriter cw = conn.createConditionalWriter(tableName, new ConditionalWriterConfig());
+        Scanner scanner = conn.createScanner(tableName, Authorizations.EMPTY)) {
 
       // mutation conditional on column tx:seq not existing
       ConditionalMutation cm0 = new ConditionalMutation("99006", new Condition("tx", "seq"));
@@ -194,7 +195,6 @@ public void testBasic() throws Exception {
       Assert.assertEquals(Status.REJECTED, cw.write(cm5).getStatus());
 
       // ensure rejected mutations did not write
-      Scanner scanner = conn.createScanner(tableName, Authorizations.EMPTY);
       scanner.fetchColumn(new Text("name"), new Text("last"));
       scanner.setRange(new Range("99006"));
       Entry<Key,Value> entry = Iterables.getOnlyElement(scanner);
@@ -255,7 +255,8 @@ public void testFields() throws Exception {
 
     conn.tableOperations().create(tableName);
 
-    try (ConditionalWriter cw = conn.createConditionalWriter(tableName, new ConditionalWriterConfig().setAuthorizations(auths))) {
+    try (ConditionalWriter cw = conn.createConditionalWriter(tableName, new ConditionalWriterConfig().setAuthorizations(auths));
+        Scanner scanner = conn.createScanner(tableName, auths)) {
 
       ColumnVisibility cva = new ColumnVisibility("A");
       ColumnVisibility cvb = new ColumnVisibility("B");
@@ -266,7 +267,6 @@ public void testFields() throws Exception {
       cm0.put("tx", "seq", cva, "1");
       Assert.assertEquals(Status.ACCEPTED, cw.write(cm0).getStatus());
 
-      Scanner scanner = conn.createScanner(tableName, auths);
       scanner.setRange(new Range("99006"));
       // TODO verify all columns
       scanner.fetchColumn(new Text("tx"), new Text("seq"));
@@ -434,9 +434,8 @@ public void testConstraints() throws Exception {
     conn.tableOperations().addConstraint(tableName, AlphaNumKeyConstraint.class.getName());
     conn.tableOperations().clone(tableName, tableName + "_clone", true, new HashMap<String,String>(), new HashSet<String>());
 
-    Scanner scanner = conn.createScanner(tableName + "_clone", new Authorizations());
-
-    try (ConditionalWriter cw = conn.createConditionalWriter(tableName + "_clone", new ConditionalWriterConfig())) {
+    try (ConditionalWriter cw = conn.createConditionalWriter(tableName + "_clone", new ConditionalWriterConfig());
+        Scanner scanner = conn.createScanner(tableName + "_clone", new Authorizations())) {
 
       ConditionalMutation cm0 = new ConditionalMutation("99006+", new Condition("tx", "seq"));
       cm0.put("tx", "seq", "1");
@@ -491,62 +490,63 @@ public void testIterators() throws Exception {
     IteratorSetting iterConfig3 = new IteratorSetting(5, VersioningIterator.class);
     VersioningIterator.setMaxVersions(iterConfig3, 1);
 
-    Scanner scanner = conn.createScanner(tableName, new Authorizations());
-    scanner.addScanIterator(iterConfig);
-    scanner.setRange(new Range("ACCUMULO-1000"));
-    scanner.fetchColumn(new Text("count"), new Text("comments"));
+    try (Scanner scanner = conn.createScanner(tableName, new Authorizations())) {
+      scanner.addScanIterator(iterConfig);
+      scanner.setRange(new Range("ACCUMULO-1000"));
+      scanner.fetchColumn(new Text("count"), new Text("comments"));
 
-    Entry<Key,Value> entry = Iterables.getOnlyElement(scanner);
-    Assert.assertEquals("3", entry.getValue().toString());
+      Entry<Key,Value> entry = Iterables.getOnlyElement(scanner);
+      Assert.assertEquals("3", entry.getValue().toString());
 
-    try (ConditionalWriter cw = conn.createConditionalWriter(tableName, new ConditionalWriterConfig())) {
+      try (ConditionalWriter cw = conn.createConditionalWriter(tableName, new ConditionalWriterConfig())) {
 
-      ConditionalMutation cm0 = new ConditionalMutation("ACCUMULO-1000", new Condition("count", "comments").setValue("3"));
-      cm0.put("count", "comments", "1");
-      Assert.assertEquals(Status.REJECTED, cw.write(cm0).getStatus());
-      entry = Iterables.getOnlyElement(scanner);
-      Assert.assertEquals("3", entry.getValue().toString());
+        ConditionalMutation cm0 = new ConditionalMutation("ACCUMULO-1000", new Condition("count", "comments").setValue("3"));
+        cm0.put("count", "comments", "1");
+        Assert.assertEquals(Status.REJECTED, cw.write(cm0).getStatus());
+        entry = Iterables.getOnlyElement(scanner);
+        Assert.assertEquals("3", entry.getValue().toString());
 
-      ConditionalMutation cm1 = new ConditionalMutation("ACCUMULO-1000", new Condition("count", "comments").setIterators(iterConfig).setValue("3"));
-      cm1.put("count", "comments", "1");
-      Assert.assertEquals(Status.ACCEPTED, cw.write(cm1).getStatus());
-      entry = Iterables.getOnlyElement(scanner);
-      Assert.assertEquals("4", entry.getValue().toString());
+        ConditionalMutation cm1 = new ConditionalMutation("ACCUMULO-1000", new Condition("count", "comments").setIterators(iterConfig).setValue("3"));
+        cm1.put("count", "comments", "1");
+        Assert.assertEquals(Status.ACCEPTED, cw.write(cm1).getStatus());
+        entry = Iterables.getOnlyElement(scanner);
+        Assert.assertEquals("4", entry.getValue().toString());
 
-      ConditionalMutation cm2 = new ConditionalMutation("ACCUMULO-1000", new Condition("count", "comments").setValue("4"));
-      cm2.put("count", "comments", "1");
-      Assert.assertEquals(Status.REJECTED, cw.write(cm1).getStatus());
-      entry = Iterables.getOnlyElement(scanner);
-      Assert.assertEquals("4", entry.getValue().toString());
+        ConditionalMutation cm2 = new ConditionalMutation("ACCUMULO-1000", new Condition("count", "comments").setValue("4"));
+        cm2.put("count", "comments", "1");
+        Assert.assertEquals(Status.REJECTED, cw.write(cm1).getStatus());
+        entry = Iterables.getOnlyElement(scanner);
+        Assert.assertEquals("4", entry.getValue().toString());
 
-      // run test with multiple iterators passed in same batch and condition with two iterators
+        // run test with multiple iterators passed in same batch and condition with two iterators
 
-      ConditionalMutation cm3 = new ConditionalMutation("ACCUMULO-1000", new Condition("count", "comments").setIterators(iterConfig).setValue("4"));
-      cm3.put("count", "comments", "1");
+        ConditionalMutation cm3 = new ConditionalMutation("ACCUMULO-1000", new Condition("count", "comments").setIterators(iterConfig).setValue("4"));
+        cm3.put("count", "comments", "1");
 
-      ConditionalMutation cm4 = new ConditionalMutation("ACCUMULO-1001", new Condition("count2", "comments").setIterators(iterConfig2).setValue("2"));
-      cm4.put("count2", "comments", "1");
+        ConditionalMutation cm4 = new ConditionalMutation("ACCUMULO-1001", new Condition("count2", "comments").setIterators(iterConfig2).setValue("2"));
+        cm4.put("count2", "comments", "1");
 
-      ConditionalMutation cm5 = new ConditionalMutation("ACCUMULO-1002", new Condition("count2", "comments").setIterators(iterConfig2, iterConfig3).setValue(
-          "2"));
-      cm5.put("count2", "comments", "1");
+        ConditionalMutation cm5 = new ConditionalMutation("ACCUMULO-1002", new Condition("count2", "comments").setIterators(iterConfig2, iterConfig3).setValue(
+            "2"));
+        cm5.put("count2", "comments", "1");
 
-      Iterator<Result> results = cw.write(Arrays.asList(cm3, cm4, cm5).iterator());
-      Map<String,Status> actual = new HashMap<>();
+        Iterator<Result> results = cw.write(Arrays.asList(cm3, cm4, cm5).iterator());
+        Map<String,Status> actual = new HashMap<>();
 
-      while (results.hasNext()) {
-        Result result = results.next();
-        String k = new String(result.getMutation().getRow());
-        Assert.assertFalse("Did not expect to see multiple resultus for the row: " + k, actual.containsKey(k));
-        actual.put(k, result.getStatus());
-      }
+        while (results.hasNext()) {
+          Result result = results.next();
+          String k = new String(result.getMutation().getRow());
+          Assert.assertFalse("Did not expect to see multiple resultus for the row: " + k, actual.containsKey(k));
+          actual.put(k, result.getStatus());
+        }
 
-      Map<String,Status> expected = new HashMap<>();
-      expected.put("ACCUMULO-1000", Status.ACCEPTED);
-      expected.put("ACCUMULO-1001", Status.ACCEPTED);
-      expected.put("ACCUMULO-1002", Status.REJECTED);
+        Map<String,Status> expected = new HashMap<>();
+        expected.put("ACCUMULO-1000", Status.ACCEPTED);
+        expected.put("ACCUMULO-1001", Status.ACCEPTED);
+        expected.put("ACCUMULO-1002", Status.REJECTED);
 
-      Assert.assertEquals(expected, actual);
+        Assert.assertEquals(expected, actual);
+      }
     }
   }
 
@@ -622,13 +622,13 @@ public void testTableAndConditionIterators() throws Exception {
     conn.tableOperations().offline(tableName, true);
     conn.tableOperations().online(tableName, true);
 
-    try (ConditionalWriter cw = conn.createConditionalWriter(tableName, new ConditionalWriterConfig())) {
+    try (ConditionalWriter cw = conn.createConditionalWriter(tableName, new ConditionalWriterConfig());
+        Scanner scanner = conn.createScanner(tableName, new Authorizations())) {
 
       ConditionalMutation cm6 = new ConditionalMutation("ACCUMULO-1000", new Condition("count", "comments").setValue("8"));
       cm6.put("count", "comments", "7");
       Assert.assertEquals(Status.ACCEPTED, cw.write(cm6).getStatus());
 
-      Scanner scanner = conn.createScanner(tableName, new Authorizations());
       scanner.setRange(new Range("ACCUMULO-1000"));
       scanner.fetchColumn(new Text("count"), new Text("comments"));
 
@@ -672,7 +672,6 @@ public void testTableAndConditionIterators() throws Exception {
       expected.put("ACCUMULO-1000", Status.ACCEPTED);
       expected.put("ACCUMULO-1001", Status.ACCEPTED);
       expected.put("ACCUMULO-1002", Status.REJECTED);
-
       Assert.assertEquals(expected, actual);
     }
   }
@@ -709,7 +708,8 @@ public void testBatch() throws Exception {
     cm2.put("tx", "seq", cvab, "1");
     mutations.add(cm2);
 
-    try (ConditionalWriter cw = conn.createConditionalWriter(tableName, new ConditionalWriterConfig().setAuthorizations(new Authorizations("A")))) {
+    try (ConditionalWriter cw = conn.createConditionalWriter(tableName, new ConditionalWriterConfig().setAuthorizations(new Authorizations("A")));
+        Scanner scanner = conn.createScanner(tableName, new Authorizations("A"))) {
       Iterator<Result> results = cw.write(mutations.iterator());
       int count = 0;
       while (results.hasNext()) {
@@ -720,7 +720,6 @@ public void testBatch() throws Exception {
 
       Assert.assertEquals(3, count);
 
-      Scanner scanner = conn.createScanner(tableName, new Authorizations("A"));
       scanner.fetchColumn(new Text("tx"), new Text("seq"));
 
       for (String row : new String[] {"99006", "59056", "19059"}) {
@@ -907,7 +906,8 @@ public void testBatchErrors() throws Exception {
     cm3.put("tx", "seq", cvaob, "2");
     mutations.add(cm3);
 
-    try (ConditionalWriter cw = conn.createConditionalWriter(tableName, new ConditionalWriterConfig().setAuthorizations(new Authorizations("A")))) {
+    try (ConditionalWriter cw = conn.createConditionalWriter(tableName, new ConditionalWriterConfig().setAuthorizations(new Authorizations("A")));
+        Scanner scanner = conn.createScanner(tableName, new Authorizations("A"))) {
       Iterator<Result> results = cw.write(mutations.iterator());
       HashSet<String> rows = new HashSet<>();
       while (results.hasNext()) {
@@ -927,9 +927,7 @@ public void testBatchErrors() throws Exception {
 
       Assert.assertEquals(4, rows.size());
 
-      Scanner scanner = conn.createScanner(tableName, new Authorizations("A"));
       scanner.fetchColumn(new Text("tx"), new Text("seq"));
-
       Entry<Key,Value> entry = Iterables.getOnlyElement(scanner);
       Assert.assertEquals("1", entry.getValue().toString());
     }
@@ -1178,7 +1176,6 @@ public void testThreads() throws Exception {
     }
 
     try (Scanner scanner = conn.createScanner(tableName, Authorizations.EMPTY)) {
-
       RowIterator rowIter = new RowIterator(scanner);
 
       while (rowIter.hasNext()) {
@@ -1267,7 +1264,8 @@ public void testTimeout() throws Exception {
 
     conn.tableOperations().create(table);
 
-    try (ConditionalWriter cw = conn.createConditionalWriter(table, new ConditionalWriterConfig().setTimeout(3, TimeUnit.SECONDS))) {
+    try (ConditionalWriter cw = conn.createConditionalWriter(table, new ConditionalWriterConfig().setTimeout(3, TimeUnit.SECONDS));
+        Scanner scanner = conn.createScanner(table, Authorizations.EMPTY)) {
 
       ConditionalMutation cm1 = new ConditionalMutation("r1", new Condition("tx", "seq"));
       cm1.put("tx", "seq", "1");
@@ -1284,8 +1282,6 @@ public void testTimeout() throws Exception {
 
       Assert.assertEquals(cw.write(cm2).getStatus(), Status.UNKNOWN);
 
-      Scanner scanner = conn.createScanner(table, Authorizations.EMPTY);
-
       for (Entry<Key,Value> entry : scanner) {
         String cf = entry.getKey().getColumnFamilyData().toString();
         String cq = entry.getKey().getColumnQualifierData().toString();
@@ -1445,44 +1441,45 @@ public void testTrace() throws Exception {
       root.stop();
     }
 
-    final Scanner scanner = conn.createScanner("trace", Authorizations.EMPTY);
-    scanner.setRange(new Range(new Text(Long.toHexString(root.traceId()))));
-    loop: while (true) {
-      final StringBuilder finalBuffer = new StringBuilder();
-      int traceCount = TraceDump.printTrace(scanner, new Printer() {
-        @Override
-        public void print(final String line) {
-          try {
-            finalBuffer.append(line).append("\n");
-          } catch (Exception ex) {
-            throw new RuntimeException(ex);
+    try (Scanner scanner = conn.createScanner("trace", Authorizations.EMPTY)) {
+      scanner.setRange(new Range(new Text(Long.toHexString(root.traceId()))));
+      loop: while (true) {
+        final StringBuilder finalBuffer = new StringBuilder();
+        int traceCount = TraceDump.printTrace(scanner, new Printer() {
+          @Override
+          public void print(final String line) {
+            try {
+              finalBuffer.append(line).append("\n");
+            } catch (Exception ex) {
+              throw new RuntimeException(ex);
+            }
           }
-        }
-      });
-      String traceOutput = finalBuffer.toString();
-      log.info("Trace output:" + traceOutput);
-      if (traceCount > 0) {
-        int lastPos = 0;
-        for (String part : "traceTest, startScan,startConditionalUpdate,conditionalUpdate,Check conditions,apply conditional mutations".split(",")) {
-          log.info("Looking in trace output for '" + part + "'");
-          int pos = traceOutput.indexOf(part);
-          if (-1 == pos) {
-            log.info("Trace output doesn't contain '" + part + "'");
-            Thread.sleep(1000);
-            break loop;
+        });
+        String traceOutput = finalBuffer.toString();
+        log.info("Trace output:" + traceOutput);
+        if (traceCount > 0) {
+          int lastPos = 0;
+          for (String part : "traceTest, startScan,startConditionalUpdate,conditionalUpdate,Check conditions,apply conditional mutations".split(",")) {
+            log.info("Looking in trace output for '" + part + "'");
+            int pos = traceOutput.indexOf(part);
+            if (-1 == pos) {
+              log.info("Trace output doesn't contain '" + part + "'");
+              Thread.sleep(1000);
+              break loop;
+            }
+            assertTrue("Did not find '" + part + "' in output", pos > 0);
+            assertTrue("'" + part + "' occurred earlier than the previous element unexpectedly", pos > lastPos);
+            lastPos = pos;
           }
-          assertTrue("Did not find '" + part + "' in output", pos > 0);
-          assertTrue("'" + part + "' occurred earlier than the previous element unexpectedly", pos > lastPos);
-          lastPos = pos;
+          break;
+        } else {
+          log.info("Ignoring trace output as traceCount not greater than zero: " + traceCount);
+          Thread.sleep(1000);
         }
-        break;
-      } else {
-        log.info("Ignoring trace output as traceCount not greater than zero: " + traceCount);
-        Thread.sleep(1000);
       }
-    }
-    if (tracer != null) {
-      tracer.destroy();
+      if (tracer != null) {
+        tracer.destroy();
+      }
     }
   }
 }
diff --git a/test/src/main/java/org/apache/accumulo/test/ConfigurableMajorCompactionIT.java b/test/src/main/java/org/apache/accumulo/test/ConfigurableMajorCompactionIT.java
index 20979af8e5..8268090cb3 100644
--- a/test/src/main/java/org/apache/accumulo/test/ConfigurableMajorCompactionIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/ConfigurableMajorCompactionIT.java
@@ -101,10 +101,11 @@ public void test() throws Exception {
   }
 
   private int countFiles(Connector conn) throws Exception {
-    Scanner s = conn.createScanner(MetadataTable.NAME, Authorizations.EMPTY);
-    s.setRange(MetadataSchema.TabletsSection.getRange());
-    s.fetchColumnFamily(MetadataSchema.TabletsSection.DataFileColumnFamily.NAME);
-    return Iterators.size(s.iterator());
+    try (Scanner s = conn.createScanner(MetadataTable.NAME, Authorizations.EMPTY)) {
+      s.setRange(MetadataSchema.TabletsSection.getRange());
+      s.fetchColumnFamily(MetadataSchema.TabletsSection.DataFileColumnFamily.NAME);
+      return Iterators.size(s.iterator());
+    }
   }
 
   private void writeFile(Connector conn, String tableName) throws Exception {
diff --git a/test/src/main/java/org/apache/accumulo/test/CreateTableWithNewTableConfigIT.java b/test/src/main/java/org/apache/accumulo/test/CreateTableWithNewTableConfigIT.java
deleted file mode 100644
index 7fd2dd1fa5..0000000000
--- a/test/src/main/java/org/apache/accumulo/test/CreateTableWithNewTableConfigIT.java
+++ /dev/null
@@ -1,205 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.accumulo.test;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Map.Entry;
-
-import org.apache.accumulo.core.client.AccumuloException;
-import org.apache.accumulo.core.client.Connector;
-import org.apache.accumulo.core.client.Scanner;
-import org.apache.accumulo.core.client.TableNotFoundException;
-import org.apache.accumulo.core.client.admin.NewTableConfiguration;
-import org.apache.accumulo.core.client.admin.TimeType;
-import org.apache.accumulo.core.conf.Property;
-import org.apache.accumulo.core.data.Key;
-import org.apache.accumulo.core.data.Value;
-import org.apache.accumulo.core.metadata.MetadataTable;
-import org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection.ServerColumnFamily;
-import org.apache.accumulo.core.security.Authorizations;
-import org.apache.accumulo.harness.SharedMiniClusterBase;
-import org.junit.AfterClass;
-import org.junit.Assert;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.collect.Iterators;
-
-/**
- *
- */
-public class CreateTableWithNewTableConfigIT extends SharedMiniClusterBase {
-  static private final Logger log = LoggerFactory.getLogger(CreateTableWithNewTableConfigIT.class);
-
-  @Override
-  protected int defaultTimeoutSeconds() {
-    return 30;
-  }
-
-  @BeforeClass
-  public static void setup() throws Exception {
-    SharedMiniClusterBase.startMiniCluster();
-  }
-
-  @AfterClass
-  public static void teardown() throws Exception {
-    SharedMiniClusterBase.stopMiniCluster();
-  }
-
-  public int numProperties(Connector connector, String tableName) throws AccumuloException, TableNotFoundException {
-    return Iterators.size(connector.tableOperations().getProperties(tableName).iterator());
-  }
-
-  public int compareProperties(Connector connector, String tableNameOrig, String tableName, String changedProp) throws AccumuloException,
-      TableNotFoundException {
-    boolean inNew = false;
-    int countOrig = 0;
-    for (Entry<String,String> orig : connector.tableOperations().getProperties(tableNameOrig)) {
-      countOrig++;
-      for (Entry<String,String> entry : connector.tableOperations().getProperties(tableName)) {
-        if (entry.equals(orig)) {
-          inNew = true;
-          break;
-        } else if (entry.getKey().equals(orig.getKey()) && !entry.getKey().equals(changedProp))
-          Assert.fail("Property " + orig.getKey() + " has different value than deprecated method");
-      }
-      if (!inNew)
-        Assert.fail("Original property missing after using the new create method");
-    }
-    return countOrig;
-  }
-
-  public boolean checkTimeType(Connector connector, String tableName, TimeType expectedTimeType) throws TableNotFoundException {
-    final Scanner scanner = connector.createScanner(MetadataTable.NAME, Authorizations.EMPTY);
-    String tableID = connector.tableOperations().tableIdMap().get(tableName) + "<";
-    for (Entry<Key,Value> entry : scanner) {
-      Key k = entry.getKey();
-
-      if (k.getRow().toString().equals(tableID) && k.getColumnQualifier().toString().equals(ServerColumnFamily.TIME_COLUMN.getColumnQualifier().toString())) {
-        if (expectedTimeType == TimeType.MILLIS && entry.getValue().toString().charAt(0) == 'M')
-          return true;
-        if (expectedTimeType == TimeType.LOGICAL && entry.getValue().toString().charAt(0) == 'L')
-          return true;
-      }
-    }
-    return false;
-  }
-
-  @SuppressWarnings("deprecation")
-  @Test
-  public void tableNameOnly() throws Exception {
-    log.info("Starting tableNameOnly");
-
-    // Create a table with the initial properties
-    Connector connector = getConnector();
-    String tableName = getUniqueNames(2)[0];
-    connector.tableOperations().create(tableName, new NewTableConfiguration());
-
-    String tableNameOrig = "original";
-    connector.tableOperations().create(tableNameOrig, true);
-
-    int countNew = numProperties(connector, tableName);
-    int countOrig = compareProperties(connector, tableNameOrig, tableName, null);
-
-    Assert.assertEquals("Extra properties using the new create method", countOrig, countNew);
-    Assert.assertTrue("Wrong TimeType", checkTimeType(connector, tableName, TimeType.MILLIS));
-  }
-
-  @SuppressWarnings("deprecation")
-  @Test
-  public void tableNameAndLimitVersion() throws Exception {
-    log.info("Starting tableNameAndLimitVersion");
-
-    // Create a table with the initial properties
-    Connector connector = getConnector();
-    String tableName = getUniqueNames(2)[0];
-    boolean limitVersion = false;
-    connector.tableOperations().create(tableName, new NewTableConfiguration().withoutDefaultIterators());
-
-    String tableNameOrig = "originalWithLimitVersion";
-    connector.tableOperations().create(tableNameOrig, limitVersion);
-
-    int countNew = numProperties(connector, tableName);
-    int countOrig = compareProperties(connector, tableNameOrig, tableName, null);
-
-    Assert.assertEquals("Extra properties using the new create method", countOrig, countNew);
-    Assert.assertTrue("Wrong TimeType", checkTimeType(connector, tableName, TimeType.MILLIS));
-  }
-
-  @SuppressWarnings("deprecation")
-  @Test
-  public void tableNameLimitVersionAndTimeType() throws Exception {
-    log.info("Starting tableNameLimitVersionAndTimeType");
-
-    // Create a table with the initial properties
-    Connector connector = getConnector();
-    String tableName = getUniqueNames(2)[0];
-    boolean limitVersion = false;
-    TimeType tt = TimeType.LOGICAL;
-    connector.tableOperations().create(tableName, new NewTableConfiguration().withoutDefaultIterators().setTimeType(tt));
-
-    String tableNameOrig = "originalWithLimitVersionAndTimeType";
-    connector.tableOperations().create(tableNameOrig, limitVersion, tt);
-
-    int countNew = numProperties(connector, tableName);
-    int countOrig = compareProperties(connector, tableNameOrig, tableName, null);
-
-    Assert.assertEquals("Extra properties using the new create method", countOrig, countNew);
-    Assert.assertTrue("Wrong TimeType", checkTimeType(connector, tableName, tt));
-  }
-
-  @SuppressWarnings("deprecation")
-  @Test
-  public void addCustomPropAndChangeExisting() throws Exception {
-    log.info("Starting addCustomPropAndChangeExisting");
-
-    // Create and populate initial properties map for creating table 1
-    Map<String,String> properties = new HashMap<>();
-    String propertyName = Property.TABLE_SPLIT_THRESHOLD.getKey();
-    String volume = "10K";
-    properties.put(propertyName, volume);
-
-    String propertyName2 = "table.custom.testProp";
-    String volume2 = "Test property";
-    properties.put(propertyName2, volume2);
-
-    // Create a table with the initial properties
-    Connector connector = getConnector();
-    String tableName = getUniqueNames(2)[0];
-    connector.tableOperations().create(tableName, new NewTableConfiguration().setProperties(properties));
-
-    String tableNameOrig = "originalWithTableName";
-    connector.tableOperations().create(tableNameOrig, true);
-
-    int countNew = numProperties(connector, tableName);
-    int countOrig = compareProperties(connector, tableNameOrig, tableName, propertyName);
-
-    for (Entry<String,String> entry : connector.tableOperations().getProperties(tableName)) {
-      if (entry.getKey().equals(Property.TABLE_SPLIT_THRESHOLD.getKey()))
-        Assert.assertTrue("TABLE_SPLIT_THRESHOLD has been changed", entry.getValue().equals("10K"));
-      if (entry.getKey().equals("table.custom.testProp"))
-        Assert.assertTrue("table.custom.testProp has been changed", entry.getValue().equals("Test property"));
-    }
-
-    Assert.assertEquals("Extra properties using the new create method", countOrig + 1, countNew);
-    Assert.assertTrue("Wrong TimeType", checkTimeType(connector, tableName, TimeType.MILLIS));
-
-  }
-}
diff --git a/test/src/main/java/org/apache/accumulo/test/ExistingMacIT.java b/test/src/main/java/org/apache/accumulo/test/ExistingMacIT.java
index 90fb828b8a..7c409b4f0c 100644
--- a/test/src/main/java/org/apache/accumulo/test/ExistingMacIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/ExistingMacIT.java
@@ -136,15 +136,14 @@ public void testExistingInstance() throws Exception {
 
     conn = accumulo2.getConnector("root", new PasswordToken(ROOT_PASSWORD));
 
-    Scanner scanner = conn.createScanner("table1", Authorizations.EMPTY);
-
-    int sum = 0;
-    for (Entry<Key,Value> entry : scanner) {
-      sum += Integer.parseInt(entry.getValue().toString());
+    try (Scanner scanner = conn.createScanner("table1", Authorizations.EMPTY)) {
+      int sum = 0;
+      for (Entry<Key,Value> entry : scanner) {
+        sum += Integer.parseInt(entry.getValue().toString());
+      }
+      Assert.assertEquals(6569, sum);
     }
 
-    Assert.assertEquals(6569, sum);
-
     accumulo2.stop();
   }
 
diff --git a/test/src/main/java/org/apache/accumulo/test/FileArchiveIT.java b/test/src/main/java/org/apache/accumulo/test/FileArchiveIT.java
index 11464b4ee5..983baf93c7 100644
--- a/test/src/main/java/org/apache/accumulo/test/FileArchiveIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/FileArchiveIT.java
@@ -77,43 +77,44 @@ public void testUnusuedFilesAreArchived() throws Exception {
     // Compact memory to disk
     conn.tableOperations().compact(tableName, null, null, true, true);
 
-    Scanner s = conn.createScanner(MetadataTable.NAME, Authorizations.EMPTY);
-    s.setRange(MetadataSchema.TabletsSection.getRange(tableId));
-    s.fetchColumnFamily(MetadataSchema.TabletsSection.DataFileColumnFamily.NAME);
-
-    Entry<Key,Value> entry = Iterables.getOnlyElement(s);
-    final String file = entry.getKey().getColumnQualifier().toString();
-    final Path p = new Path(file);
-
-    // Then force another to make an unreferenced file
-    conn.tableOperations().compact(tableName, null, null, true, true);
-
-    log.info("File for table: {}", file);
-
-    FileSystem fs = getCluster().getFileSystem();
-    int i = 0;
-    while (fs.exists(p)) {
-      i++;
-      Thread.sleep(1000);
-      if (0 == i % 10) {
-        log.info("Waited {} iterations, file still exists", i);
+    try (Scanner s = conn.createScanner(MetadataTable.NAME, Authorizations.EMPTY)) {
+      s.setRange(MetadataSchema.TabletsSection.getRange(tableId));
+      s.fetchColumnFamily(MetadataSchema.TabletsSection.DataFileColumnFamily.NAME);
+
+      Entry<Key,Value> entry = Iterables.getOnlyElement(s);
+      final String file = entry.getKey().getColumnQualifier().toString();
+      final Path p = new Path(file);
+
+      // Then force another to make an unreferenced file
+      conn.tableOperations().compact(tableName, null, null, true, true);
+
+      log.info("File for table: {}", file);
+
+      FileSystem fs = getCluster().getFileSystem();
+      int i = 0;
+      while (fs.exists(p)) {
+        i++;
+        Thread.sleep(1000);
+        if (0 == i % 10) {
+          log.info("Waited {} iterations, file still exists", i);
+        }
       }
-    }
 
-    log.info("File was removed");
+      log.info("File was removed");
 
-    String filePath = p.toUri().getPath().substring(getCluster().getConfig().getAccumuloDir().toString().length());
+      String filePath = p.toUri().getPath().substring(getCluster().getConfig().getAccumuloDir().toString().length());
 
-    log.info("File relative to accumulo dir: {}", filePath);
+      log.info("File relative to accumulo dir: {}", filePath);
 
-    Path fileArchiveDir = new Path(getCluster().getConfig().getAccumuloDir().toString(), ServerConstants.FILE_ARCHIVE_DIR);
+      Path fileArchiveDir = new Path(getCluster().getConfig().getAccumuloDir().toString(), ServerConstants.FILE_ARCHIVE_DIR);
 
-    Assert.assertTrue("File archive directory didn't exist", fs.exists(fileArchiveDir));
+      Assert.assertTrue("File archive directory didn't exist", fs.exists(fileArchiveDir));
 
-    // Remove the leading '/' to make sure Path treats the 2nd arg as a child.
-    Path archivedFile = new Path(fileArchiveDir, filePath.substring(1));
+      // Remove the leading '/' to make sure Path treats the 2nd arg as a child.
+      Path archivedFile = new Path(fileArchiveDir, filePath.substring(1));
 
-    Assert.assertTrue("File doesn't exists in archive directory: " + archivedFile, fs.exists(archivedFile));
+      Assert.assertTrue("File doesn't exists in archive directory: " + archivedFile, fs.exists(archivedFile));
+    }
   }
 
   @Test
@@ -135,42 +136,43 @@ public void testDeletedTableIsArchived() throws Exception {
     // Compact memory to disk
     conn.tableOperations().compact(tableName, null, null, true, true);
 
-    Scanner s = conn.createScanner(MetadataTable.NAME, Authorizations.EMPTY);
-    s.setRange(MetadataSchema.TabletsSection.getRange(tableId));
-    s.fetchColumnFamily(MetadataSchema.TabletsSection.DataFileColumnFamily.NAME);
+    try (Scanner s = conn.createScanner(MetadataTable.NAME, Authorizations.EMPTY)) {
+      s.setRange(MetadataSchema.TabletsSection.getRange(tableId));
+      s.fetchColumnFamily(MetadataSchema.TabletsSection.DataFileColumnFamily.NAME);
 
-    Entry<Key,Value> entry = Iterables.getOnlyElement(s);
-    final String file = entry.getKey().getColumnQualifier().toString();
-    final Path p = new Path(file);
+      Entry<Key,Value> entry = Iterables.getOnlyElement(s);
+      final String file = entry.getKey().getColumnQualifier().toString();
+      final Path p = new Path(file);
 
-    conn.tableOperations().delete(tableName);
+      conn.tableOperations().delete(tableName);
 
-    log.info("File for table: {}", file);
+      log.info("File for table: {}", file);
 
-    FileSystem fs = getCluster().getFileSystem();
-    int i = 0;
-    while (fs.exists(p)) {
-      i++;
-      Thread.sleep(1000);
-      if (0 == i % 10) {
-        log.info("Waited {} iterations, file still exists", i);
+      FileSystem fs = getCluster().getFileSystem();
+      int i = 0;
+      while (fs.exists(p)) {
+        i++;
+        Thread.sleep(1000);
+        if (0 == i % 10) {
+          log.info("Waited {} iterations, file still exists", i);
+        }
       }
-    }
 
-    log.info("File was removed");
+      log.info("File was removed");
 
-    String filePath = p.toUri().getPath().substring(getCluster().getConfig().getAccumuloDir().toString().length());
+      String filePath = p.toUri().getPath().substring(getCluster().getConfig().getAccumuloDir().toString().length());
 
-    log.info("File relative to accumulo dir: {}", filePath);
+      log.info("File relative to accumulo dir: {}", filePath);
 
-    Path fileArchiveDir = new Path(getCluster().getConfig().getAccumuloDir().toString(), ServerConstants.FILE_ARCHIVE_DIR);
+      Path fileArchiveDir = new Path(getCluster().getConfig().getAccumuloDir().toString(), ServerConstants.FILE_ARCHIVE_DIR);
 
-    Assert.assertTrue("File archive directory didn't exist", fs.exists(fileArchiveDir));
+      Assert.assertTrue("File archive directory didn't exist", fs.exists(fileArchiveDir));
 
-    // Remove the leading '/' to make sure Path treats the 2nd arg as a child.
-    Path archivedFile = new Path(fileArchiveDir, filePath.substring(1));
+      // Remove the leading '/' to make sure Path treats the 2nd arg as a child.
+      Path archivedFile = new Path(fileArchiveDir, filePath.substring(1));
 
-    Assert.assertTrue("File doesn't exists in archive directory: " + archivedFile, fs.exists(archivedFile));
+      Assert.assertTrue("File doesn't exists in archive directory: " + archivedFile, fs.exists(archivedFile));
+    }
   }
 
   @Test
@@ -192,81 +194,85 @@ public void testUnusuedFilesAndDeletedTable() throws Exception {
     // Compact memory to disk
     conn.tableOperations().compact(tableName, null, null, true, true);
 
-    Scanner s = conn.createScanner(MetadataTable.NAME, Authorizations.EMPTY);
-    s.setRange(MetadataSchema.TabletsSection.getRange(tableId));
-    s.fetchColumnFamily(MetadataSchema.TabletsSection.DataFileColumnFamily.NAME);
-
-    Entry<Key,Value> entry = Iterables.getOnlyElement(s);
-    final String file = entry.getKey().getColumnQualifier().toString();
-    final Path p = new Path(file);
-
-    // Then force another to make an unreferenced file
-    conn.tableOperations().compact(tableName, null, null, true, true);
-
-    log.info("File for table: {}", file);
-
-    FileSystem fs = getCluster().getFileSystem();
+    Entry<Key,Value> entry;
+    Path fileArchiveDir;
+    FileSystem fs;
     int i = 0;
-    while (fs.exists(p)) {
-      i++;
-      Thread.sleep(1000);
-      if (0 == i % 10) {
-        log.info("Waited {} iterations, file still exists", i);
+    try (Scanner s = conn.createScanner(MetadataTable.NAME, Authorizations.EMPTY)) {
+      s.setRange(MetadataSchema.TabletsSection.getRange(tableId));
+      s.fetchColumnFamily(MetadataSchema.TabletsSection.DataFileColumnFamily.NAME);
+
+      entry = Iterables.getOnlyElement(s);
+      final String file = entry.getKey().getColumnQualifier().toString();
+      final Path p = new Path(file);
+
+      // Then force another to make an unreferenced file
+      conn.tableOperations().compact(tableName, null, null, true, true);
+
+      log.info("File for table: {}", file);
+
+      fs = getCluster().getFileSystem();
+      while (fs.exists(p)) {
+        i++;
+        Thread.sleep(1000);
+        if (0 == i % 10) {
+          log.info("Waited {} iterations, file still exists", i);
+        }
       }
-    }
 
-    log.info("File was removed");
+      log.info("File was removed");
 
-    String filePath = p.toUri().getPath().substring(getCluster().getConfig().getAccumuloDir().toString().length());
+      String filePath = p.toUri().getPath().substring(getCluster().getConfig().getAccumuloDir().toString().length());
 
-    log.info("File relative to accumulo dir: {}", filePath);
+      log.info("File relative to accumulo dir: {}", filePath);
 
-    Path fileArchiveDir = new Path(getCluster().getConfig().getAccumuloDir().toString(), ServerConstants.FILE_ARCHIVE_DIR);
+      fileArchiveDir = new Path(getCluster().getConfig().getAccumuloDir().toString(), ServerConstants.FILE_ARCHIVE_DIR);
 
-    Assert.assertTrue("File archive directory didn't exist", fs.exists(fileArchiveDir));
+      Assert.assertTrue("File archive directory didn't exist", fs.exists(fileArchiveDir));
 
-    // Remove the leading '/' to make sure Path treats the 2nd arg as a child.
-    Path archivedFile = new Path(fileArchiveDir, filePath.substring(1));
+      // Remove the leading '/' to make sure Path treats the 2nd arg as a child.
+      Path archivedFile = new Path(fileArchiveDir, filePath.substring(1));
 
-    Assert.assertTrue("File doesn't exists in archive directory: " + archivedFile, fs.exists(archivedFile));
+      Assert.assertTrue("File doesn't exists in archive directory: " + archivedFile, fs.exists(archivedFile));
 
-    // Offline the table so we can be sure there is a single file
-    conn.tableOperations().offline(tableName, true);
+      // Offline the table so we can be sure there is a single file
+      conn.tableOperations().offline(tableName, true);
+    }
 
     // See that the file in metadata currently is
-    s = conn.createScanner(MetadataTable.NAME, Authorizations.EMPTY);
-    s.setRange(MetadataSchema.TabletsSection.getRange(tableId));
-    s.fetchColumnFamily(MetadataSchema.TabletsSection.DataFileColumnFamily.NAME);
+    try (Scanner s = conn.createScanner(MetadataTable.NAME, Authorizations.EMPTY)) {
+      s.setRange(MetadataSchema.TabletsSection.getRange(tableId));
+      s.fetchColumnFamily(MetadataSchema.TabletsSection.DataFileColumnFamily.NAME);
 
-    entry = Iterables.getOnlyElement(s);
-    final String finalFile = entry.getKey().getColumnQualifier().toString();
-    final Path finalPath = new Path(finalFile);
+      entry = Iterables.getOnlyElement(s);
+      final String finalFile = entry.getKey().getColumnQualifier().toString();
+      final Path finalPath = new Path(finalFile);
 
-    conn.tableOperations().delete(tableName);
+      conn.tableOperations().delete(tableName);
 
-    log.info("File for table: {}", finalPath);
+      log.info("File for table: {}", finalPath);
 
-    i = 0;
-    while (fs.exists(finalPath)) {
-      i++;
-      Thread.sleep(1000);
-      if (0 == i % 10) {
-        log.info("Waited {} iterations, file still exists", i);
+      i = 0;
+      while (fs.exists(finalPath)) {
+        i++;
+        Thread.sleep(1000);
+        if (0 == i % 10) {
+          log.info("Waited {} iterations, file still exists", i);
+        }
       }
-    }
 
-    log.info("File was removed");
+      log.info("File was removed");
 
-    String finalFilePath = finalPath.toUri().getPath().substring(getCluster().getConfig().getAccumuloDir().toString().length());
+      String finalFilePath = finalPath.toUri().getPath().substring(getCluster().getConfig().getAccumuloDir().toString().length());
 
-    log.info("File relative to accumulo dir: {}", finalFilePath);
+      log.info("File relative to accumulo dir: {}", finalFilePath);
 
-    Assert.assertTrue("File archive directory didn't exist", fs.exists(fileArchiveDir));
+      Assert.assertTrue("File archive directory didn't exist", fs.exists(fileArchiveDir));
 
-    // Remove the leading '/' to make sure Path treats the 2nd arg as a child.
-    Path finalArchivedFile = new Path(fileArchiveDir, finalFilePath.substring(1));
+      // Remove the leading '/' to make sure Path treats the 2nd arg as a child.
+      Path finalArchivedFile = new Path(fileArchiveDir, finalFilePath.substring(1));
 
-    Assert.assertTrue("File doesn't exists in archive directory: " + finalArchivedFile, fs.exists(finalArchivedFile));
+      Assert.assertTrue("File doesn't exists in archive directory: " + finalArchivedFile, fs.exists(finalArchivedFile));
+    }
   }
-
 }
diff --git a/test/src/main/java/org/apache/accumulo/test/FindMaxIT.java b/test/src/main/java/org/apache/accumulo/test/FindMaxIT.java
index 96ab317dde..500c7f958f 100644
--- a/test/src/main/java/org/apache/accumulo/test/FindMaxIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/FindMaxIT.java
@@ -72,42 +72,43 @@ public void test1() throws Exception {
 
     bw.close();
 
-    Scanner scanner = conn.createScanner(tableName, Authorizations.EMPTY);
+    try (Scanner scanner = conn.createScanner(tableName, Authorizations.EMPTY)) {
 
-    ArrayList<Text> rows = new ArrayList<>();
+      ArrayList<Text> rows = new ArrayList<>();
 
-    for (Entry<Key,Value> entry : scanner) {
-      rows.add(entry.getKey().getRow());
-    }
+      for (Entry<Key,Value> entry : scanner) {
+        rows.add(entry.getKey().getRow());
+      }
 
-    for (int i = rows.size() - 1; i > 0; i--) {
-      Text max = conn.tableOperations().getMaxRow(tableName, Authorizations.EMPTY, null, true, rows.get(i), false);
-      assertEquals(rows.get(i - 1), max);
+      for (int i = rows.size() - 1; i > 0; i--) {
+        Text max = conn.tableOperations().getMaxRow(tableName, Authorizations.EMPTY, null, true, rows.get(i), false);
+        assertEquals(rows.get(i - 1), max);
 
-      max = conn.tableOperations().getMaxRow(tableName, Authorizations.EMPTY, rows.get(i - 1), true, rows.get(i), false);
-      assertEquals(rows.get(i - 1), max);
+        max = conn.tableOperations().getMaxRow(tableName, Authorizations.EMPTY, rows.get(i - 1), true, rows.get(i), false);
+        assertEquals(rows.get(i - 1), max);
 
-      max = conn.tableOperations().getMaxRow(tableName, Authorizations.EMPTY, rows.get(i - 1), false, rows.get(i), false);
-      assertNull(max);
+        max = conn.tableOperations().getMaxRow(tableName, Authorizations.EMPTY, rows.get(i - 1), false, rows.get(i), false);
+        assertNull(max);
 
-      max = conn.tableOperations().getMaxRow(tableName, Authorizations.EMPTY, null, true, rows.get(i), true);
-      assertEquals(rows.get(i), max);
+        max = conn.tableOperations().getMaxRow(tableName, Authorizations.EMPTY, null, true, rows.get(i), true);
+        assertEquals(rows.get(i), max);
 
-      max = conn.tableOperations().getMaxRow(tableName, Authorizations.EMPTY, rows.get(i), true, rows.get(i), true);
-      assertEquals(rows.get(i), max);
+        max = conn.tableOperations().getMaxRow(tableName, Authorizations.EMPTY, rows.get(i), true, rows.get(i), true);
+        assertEquals(rows.get(i), max);
 
-      max = conn.tableOperations().getMaxRow(tableName, Authorizations.EMPTY, rows.get(i - 1), false, rows.get(i), true);
-      assertEquals(rows.get(i), max);
+        max = conn.tableOperations().getMaxRow(tableName, Authorizations.EMPTY, rows.get(i - 1), false, rows.get(i), true);
+        assertEquals(rows.get(i), max);
 
-    }
+      }
 
-    Text max = conn.tableOperations().getMaxRow(tableName, Authorizations.EMPTY, null, true, null, true);
-    assertEquals(rows.get(rows.size() - 1), max);
+      Text max = conn.tableOperations().getMaxRow(tableName, Authorizations.EMPTY, null, true, null, true);
+      assertEquals(rows.get(rows.size() - 1), max);
 
-    max = conn.tableOperations().getMaxRow(tableName, Authorizations.EMPTY, null, true, new Text(new byte[] {0}), false);
-    assertNull(max);
+      max = conn.tableOperations().getMaxRow(tableName, Authorizations.EMPTY, null, true, new Text(new byte[] {0}), false);
+      assertNull(max);
 
-    max = conn.tableOperations().getMaxRow(tableName, Authorizations.EMPTY, null, true, new Text(new byte[] {0}), true);
-    assertEquals(rows.get(0), max);
+      max = conn.tableOperations().getMaxRow(tableName, Authorizations.EMPTY, null, true, new Text(new byte[] {0}), true);
+      assertEquals(rows.get(0), max);
+    }
   }
 }
diff --git a/test/src/main/java/org/apache/accumulo/test/IMMLGBenchmark.java b/test/src/main/java/org/apache/accumulo/test/IMMLGBenchmark.java
index 140410bf4e..a21c0d25b5 100644
--- a/test/src/main/java/org/apache/accumulo/test/IMMLGBenchmark.java
+++ b/test/src/main/java/org/apache/accumulo/test/IMMLGBenchmark.java
@@ -117,21 +117,21 @@ private static void addStat(Map<String,Stat> stats, String s, long wt) {
   }
 
   private static long scan(Connector conn, ArrayList<byte[]> cfset, String table, boolean cq) throws TableNotFoundException {
-    Scanner scanner = conn.createScanner(table, Authorizations.EMPTY);
+    try (Scanner scanner = conn.createScanner(table, Authorizations.EMPTY)) {
 
-    if (!cq)
-      scanner.fetchColumnFamily(new Text(cfset.get(15)));
-    else
-      scanner.fetchColumn(new Text(cfset.get(15)), new Text(cfset.get(15)));
+      if (!cq)
+        scanner.fetchColumnFamily(new Text(cfset.get(15)));
+      else
+        scanner.fetchColumn(new Text(cfset.get(15)), new Text(cfset.get(15)));
 
-    long t1 = System.currentTimeMillis();
+      long t1 = System.currentTimeMillis();
 
-    Iterators.size(scanner.iterator());
+      Iterators.size(scanner.iterator());
 
-    long t2 = System.currentTimeMillis();
-
-    return t2 - t1;
+      long t2 = System.currentTimeMillis();
 
+      return t2 - t1;
+    }
   }
 
   private static long write(Connector conn, ArrayList<byte[]> cfset, String table) throws TableNotFoundException, MutationsRejectedException {
diff --git a/test/src/main/java/org/apache/accumulo/test/ImportExportIT.java b/test/src/main/java/org/apache/accumulo/test/ImportExportIT.java
index 6815d180b6..5ed57e7990 100644
--- a/test/src/main/java/org/apache/accumulo/test/ImportExportIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/ImportExportIT.java
@@ -139,26 +139,28 @@ public void testExportImportThenScan() throws Exception {
 
     // Get all `file` colfams from the metadata table for the new table
     log.info("Imported into table with ID: {}", tableId);
-    Scanner s = conn.createScanner(MetadataTable.NAME, Authorizations.EMPTY);
-    s.setRange(MetadataSchema.TabletsSection.getRange(org.apache.accumulo.core.client.impl.Table.ID.of(tableId)));
-    s.fetchColumnFamily(MetadataSchema.TabletsSection.DataFileColumnFamily.NAME);
-    MetadataSchema.TabletsSection.ServerColumnFamily.DIRECTORY_COLUMN.fetch(s);
-
-    // Should find a single entry
-    for (Entry<Key,Value> fileEntry : s) {
-      Key k = fileEntry.getKey();
-      String value = fileEntry.getValue().toString();
-      if (k.getColumnFamily().equals(MetadataSchema.TabletsSection.DataFileColumnFamily.NAME)) {
-        // The file should be an absolute URI (file:///...), not a relative path (/b-000.../I000001.rf)
-        String fileUri = k.getColumnQualifier().toString();
-        Assert.assertFalse("Imported files should have absolute URIs, not relative: " + fileUri, looksLikeRelativePath(fileUri));
-      } else if (k.getColumnFamily().equals(MetadataSchema.TabletsSection.ServerColumnFamily.NAME)) {
-        Assert.assertFalse("Server directory should have absolute URI, not relative: " + value, looksLikeRelativePath(value));
-      } else {
-        Assert.fail("Got expected pair: " + k + "=" + fileEntry.getValue());
+
+    try (Scanner s = conn.createScanner(MetadataTable.NAME, Authorizations.EMPTY)) {
+      s.setRange(MetadataSchema.TabletsSection.getRange(org.apache.accumulo.core.client.impl.Table.ID.of(tableId)));
+      s.fetchColumnFamily(MetadataSchema.TabletsSection.DataFileColumnFamily.NAME);
+      MetadataSchema.TabletsSection.ServerColumnFamily.DIRECTORY_COLUMN.fetch(s);
+
+      // Should find a single entry
+      for (Entry<Key,Value> fileEntry : s) {
+        Key k = fileEntry.getKey();
+        String value = fileEntry.getValue().toString();
+        if (k.getColumnFamily().equals(MetadataSchema.TabletsSection.DataFileColumnFamily.NAME)) {
+          // The file should be an absolute URI (file:///...), not a relative path (/b-000.../I000001.rf)
+          String fileUri = k.getColumnQualifier().toString();
+          Assert.assertFalse("Imported files should have absolute URIs, not relative: " + fileUri, looksLikeRelativePath(fileUri));
+        } else if (k.getColumnFamily().equals(MetadataSchema.TabletsSection.ServerColumnFamily.NAME)) {
+          Assert.assertFalse("Server directory should have absolute URI, not relative: " + value, looksLikeRelativePath(value));
+        } else {
+          Assert.fail("Got expected pair: " + k + "=" + fileEntry.getValue());
+        }
       }
-    }
 
+    }
     // Online the original table before we verify equivalence
     conn.tableOperations().online(srcTable, true);
 
diff --git a/test/src/main/java/org/apache/accumulo/test/InterruptibleScannersIT.java b/test/src/main/java/org/apache/accumulo/test/InterruptibleScannersIT.java
index bdf62a14df..899efcc581 100644
--- a/test/src/main/java/org/apache/accumulo/test/InterruptibleScannersIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/InterruptibleScannersIT.java
@@ -52,51 +52,52 @@ public void test() throws Exception {
     final String tableName = getUniqueNames(1)[0];
     final Connector conn = getConnector();
     conn.tableOperations().create(tableName);
+
     // make the world's slowest scanner
-    final Scanner scanner = conn.createScanner(tableName, Authorizations.EMPTY);
-    final IteratorSetting cfg = new IteratorSetting(100, SlowIterator.class);
-    // Wait long enough to be sure we can catch it, but not indefinitely.
-    SlowIterator.setSeekSleepTime(cfg, 60 * 1000);
-    scanner.addScanIterator(cfg);
-    // create a thread to interrupt the slow scan
-    final Thread scanThread = Thread.currentThread();
-    Thread thread = new Thread() {
-      @Override
-      public void run() {
-        try {
-          // ensure the scan is running: not perfect, the metadata tables could be scanned, too.
-          String tserver = conn.instanceOperations().getTabletServers().iterator().next();
-          do {
-            ArrayList<ActiveScan> scans = new ArrayList<>(conn.instanceOperations().getActiveScans(tserver));
-            Iterator<ActiveScan> iter = scans.iterator();
-            while (iter.hasNext()) {
-              ActiveScan scan = iter.next();
-              // Remove scans not against our table and not owned by us
-              if (!getAdminPrincipal().equals(scan.getUser()) || !tableName.equals(scan.getTable())) {
-                iter.remove();
+    try (Scanner scanner = conn.createScanner(tableName, Authorizations.EMPTY)) {
+      final IteratorSetting cfg = new IteratorSetting(100, SlowIterator.class);
+      // Wait long enough to be sure we can catch it, but not indefinitely.
+      SlowIterator.setSeekSleepTime(cfg, 60 * 1000);
+      scanner.addScanIterator(cfg);
+      // create a thread to interrupt the slow scan
+      final Thread scanThread = Thread.currentThread();
+      Thread thread = new Thread() {
+        @Override
+        public void run() {
+          try {
+            // ensure the scan is running: not perfect, the metadata tables could be scanned, too.
+            String tserver = conn.instanceOperations().getTabletServers().iterator().next();
+            do {
+              ArrayList<ActiveScan> scans = new ArrayList<>(conn.instanceOperations().getActiveScans(tserver));
+              Iterator<ActiveScan> iter = scans.iterator();
+              while (iter.hasNext()) {
+                ActiveScan scan = iter.next();
+                // Remove scans not against our table and not owned by us
+                if (!getAdminPrincipal().equals(scan.getUser()) || !tableName.equals(scan.getTable())) {
+                  iter.remove();
+                }
               }
-            }
 
-            if (!scans.isEmpty()) {
-              // We found our scan
-              break;
-            }
-          } while (true);
-        } catch (Exception e) {
-          e.printStackTrace();
+              if (!scans.isEmpty()) {
+                // We found our scan
+                break;
+              }
+            } while (true);
+          } catch (Exception e) {
+            e.printStackTrace();
+          }
+          // BAM!
+          scanThread.interrupt();
         }
-        // BAM!
-        scanThread.interrupt();
+      };
+      thread.start();
+      try {
+        // Use the scanner, expect problems
+        Iterators.size(scanner.iterator());
+        Assert.fail("Scan should not succeed");
+      } catch (Exception ex) {} finally {
+        thread.join();
       }
-    };
-    thread.start();
-    try {
-      // Use the scanner, expect problems
-      Iterators.size(scanner.iterator());
-      Assert.fail("Scan should not succeed");
-    } catch (Exception ex) {} finally {
-      thread.join();
     }
   }
-
 }
diff --git a/test/src/main/java/org/apache/accumulo/test/IsolationAndDeepCopyIT.java b/test/src/main/java/org/apache/accumulo/test/IsolationAndDeepCopyIT.java
index 5309525f70..49c3257038 100644
--- a/test/src/main/java/org/apache/accumulo/test/IsolationAndDeepCopyIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/IsolationAndDeepCopyIT.java
@@ -62,15 +62,16 @@ public void testBugFix() throws Exception {
     IteratorSetting iterCfg = new IteratorSetting(30, "ayeaye", IntersectingIterator.class.getName());
     IntersectingIterator.setColumnFamilies(iterCfg, new Text[] {new Text("the"), new Text("hamster")});
 
-    Scanner scanner = conn.createScanner(table, Authorizations.EMPTY);
-    scanner.enableIsolation();
-    scanner.addScanIterator(iterCfg);
-
-    for (int i = 0; i < 100; i++) {
-      Iterator<Entry<Key,Value>> iter = scanner.iterator();
-      Assert.assertTrue(iter.hasNext());
-      Assert.assertEquals("000A", iter.next().getKey().getColumnQualifierData().toString());
-      Assert.assertFalse(iter.hasNext());
+    try (Scanner scanner = conn.createScanner(table, Authorizations.EMPTY)) {
+      scanner.enableIsolation();
+      scanner.addScanIterator(iterCfg);
+
+      for (int i = 0; i < 100; i++) {
+        Iterator<Entry<Key,Value>> iter = scanner.iterator();
+        Assert.assertTrue(iter.hasNext());
+        Assert.assertEquals("000A", iter.next().getKey().getColumnQualifierData().toString());
+        Assert.assertFalse(iter.hasNext());
+      }
     }
   }
 
diff --git a/test/src/main/java/org/apache/accumulo/test/LargeSplitRowIT.java b/test/src/main/java/org/apache/accumulo/test/LargeSplitRowIT.java
index 897ae6ef3e..395c26cddb 100644
--- a/test/src/main/java/org/apache/accumulo/test/LargeSplitRowIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/LargeSplitRowIT.java
@@ -92,15 +92,16 @@ public void userAddedSplit() throws Exception {
 
     // Make sure that the information that was written to the table before we tried to add the split point is still correct
     int counter = 0;
-    final Scanner scanner = conn.createScanner(tableName, Authorizations.EMPTY);
-    for (Entry<Key,Value> entry : scanner) {
-      counter++;
-      Key k = entry.getKey();
-      Assert.assertEquals("Row", k.getRow().toString());
-      Assert.assertEquals("cf", k.getColumnFamily().toString());
-      Assert.assertEquals("cq", k.getColumnQualifier().toString());
-      Assert.assertEquals("value", entry.getValue().toString());
+    try (Scanner scanner = conn.createScanner(tableName, Authorizations.EMPTY)) {
+      for (Entry<Key,Value> entry : scanner) {
+        counter++;
+        Key k = entry.getKey();
+        Assert.assertEquals("Row", k.getRow().toString());
+        Assert.assertEquals("cf", k.getColumnFamily().toString());
+        Assert.assertEquals("cq", k.getColumnQualifier().toString());
+        Assert.assertEquals("value", entry.getValue().toString());
 
+      }
     }
     // Make sure there is only one line in the table
     Assert.assertEquals(1, counter);
@@ -142,16 +143,17 @@ public void automaticSplitWith250Same() throws Exception {
 
     // Make sure all the data that was put in the table is still correct
     int count = 0;
-    final Scanner scanner = conn.createScanner(tableName, Authorizations.EMPTY);
-    for (Entry<Key,Value> entry : scanner) {
-      Key k = entry.getKey();
-      data[data.length - 1] = (byte) count;
-      String expected = new String(data, UTF_8);
-      Assert.assertEquals(expected, k.getRow().toString());
-      Assert.assertEquals("cf", k.getColumnFamily().toString());
-      Assert.assertEquals("cq", k.getColumnQualifier().toString());
-      Assert.assertEquals("value", entry.getValue().toString());
-      count++;
+    try (Scanner scanner = conn.createScanner(tableName, Authorizations.EMPTY)) {
+      for (Entry<Key,Value> entry : scanner) {
+        Key k = entry.getKey();
+        data[data.length - 1] = (byte) count;
+        String expected = new String(data, UTF_8);
+        Assert.assertEquals(expected, k.getRow().toString());
+        Assert.assertEquals("cf", k.getColumnFamily().toString());
+        Assert.assertEquals("cq", k.getColumnQualifier().toString());
+        Assert.assertEquals("value", entry.getValue().toString());
+        count++;
+      }
     }
     Assert.assertEquals(250, count);
 
@@ -256,31 +258,31 @@ private void automaticSplit(int max, int spacing) throws Exception {
     // Make sure all the data that was put in the table is still correct
     int count = 0;
     int extra = 10;
-    final Scanner scanner = conn.createScanner(tableName, Authorizations.EMPTY);
-    for (Entry<Key,Value> entry : scanner) {
-      if (extra == 10) {
-        extra = 0;
-        for (int i = 0; i < data.length - 1; i++) {
-          data[i] = (byte) count;
-        }
-        count += spacing;
+    try (Scanner scanner = conn.createScanner(tableName, Authorizations.EMPTY)) {
+      for (Entry<Key,Value> entry : scanner) {
+        if (extra == 10) {
+          extra = 0;
+          for (int i = 0; i < data.length - 1; i++) {
+            data[i] = (byte) count;
+          }
+          count += spacing;
 
+        }
+        Key k = entry.getKey();
+        data[data.length - 1] = (byte) extra;
+        String expected = new String(data, UTF_8);
+        Assert.assertEquals(expected, k.getRow().toString());
+        Assert.assertEquals("cf", k.getColumnFamily().toString());
+        Assert.assertEquals("cq", k.getColumnQualifier().toString());
+        Assert.assertEquals("value", entry.getValue().toString());
+        extra++;
       }
-      Key k = entry.getKey();
-      data[data.length - 1] = (byte) extra;
-      String expected = new String(data, UTF_8);
-      Assert.assertEquals(expected, k.getRow().toString());
-      Assert.assertEquals("cf", k.getColumnFamily().toString());
-      Assert.assertEquals("cq", k.getColumnQualifier().toString());
-      Assert.assertEquals("value", entry.getValue().toString());
-      extra++;
     }
     Assert.assertEquals(10, extra);
     Assert.assertEquals(max, count);
 
     // Make sure no splits occured in the table
     Assert.assertEquals(0, conn.tableOperations().listSplits(tableName).size());
-
   }
 
 }
diff --git a/test/src/main/java/org/apache/accumulo/test/MetaGetsReadersIT.java b/test/src/main/java/org/apache/accumulo/test/MetaGetsReadersIT.java
index 1476900f6a..ba59d8001b 100644
--- a/test/src/main/java/org/apache/accumulo/test/MetaGetsReadersIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/MetaGetsReadersIT.java
@@ -60,13 +60,14 @@ private static Thread slowScan(final Connector c, final String tableName, final
       public void run() {
         try {
           while (stop.get() == false) {
-            Scanner s = c.createScanner(tableName, Authorizations.EMPTY);
-            IteratorSetting is = new IteratorSetting(50, SlowIterator.class);
-            SlowIterator.setSleepTime(is, 10);
-            s.addScanIterator(is);
-            Iterator<Entry<Key,Value>> iterator = s.iterator();
-            while (iterator.hasNext() && stop.get() == false) {
-              iterator.next();
+            try (Scanner s = c.createScanner(tableName, Authorizations.EMPTY)) {
+              IteratorSetting is = new IteratorSetting(50, SlowIterator.class);
+              SlowIterator.setSleepTime(is, 10);
+              s.addScanIterator(is);
+              Iterator<Entry<Key,Value>> iterator = s.iterator();
+              while (iterator.hasNext() && stop.get() == false) {
+                iterator.next();
+              }
             }
           }
         } catch (Exception ex) {
@@ -101,8 +102,11 @@ public void test() throws Exception {
     t2.start();
     sleepUninterruptibly(500, TimeUnit.MILLISECONDS);
     long now = System.currentTimeMillis();
-    Scanner m = c.createScanner(MetadataTable.NAME, Authorizations.EMPTY);
-    Iterators.size(m.iterator());
+
+    try (Scanner s = c.createScanner(MetadataTable.NAME, Authorizations.EMPTY)) {
+      Iterators.size(s.iterator());
+    }
+
     long delay = System.currentTimeMillis() - now;
     System.out.println("Delay = " + delay);
     assertTrue("metadata table scan was slow", delay < 1000);
diff --git a/test/src/main/java/org/apache/accumulo/test/MetaRecoveryIT.java b/test/src/main/java/org/apache/accumulo/test/MetaRecoveryIT.java
index 0c16a5fa74..338c1436a3 100644
--- a/test/src/main/java/org/apache/accumulo/test/MetaRecoveryIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/MetaRecoveryIT.java
@@ -86,10 +86,10 @@ public void test() throws Exception {
     getCluster().start();
     log.info("Verifying");
     for (String table : tables) {
-      BatchScanner scanner = c.createBatchScanner(table, Authorizations.EMPTY, 5);
-      scanner.setRanges(Collections.singletonList(new Range()));
-      assertEquals(1000, Iterators.size(scanner.iterator()));
-      scanner.close();
+      try (BatchScanner scanner = c.createBatchScanner(table, Authorizations.EMPTY, 5)) {
+        scanner.setRanges(Collections.singletonList(new Range()));
+        assertEquals(1000, Iterators.size(scanner.iterator()));
+      }
     }
   }
 
diff --git a/test/src/main/java/org/apache/accumulo/test/MissingWalHeaderCompletesRecoveryIT.java b/test/src/main/java/org/apache/accumulo/test/MissingWalHeaderCompletesRecoveryIT.java
index 49d2b6d94d..8b13da187f 100644
--- a/test/src/main/java/org/apache/accumulo/test/MissingWalHeaderCompletesRecoveryIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/MissingWalHeaderCompletesRecoveryIT.java
@@ -150,8 +150,9 @@ public void testEmptyWalRecoveryCompletes() throws Exception {
 
     // Reading the table implies that recovery completed successfully (the empty file was ignored)
     // otherwise the tablet will never come online and we won't be able to read it.
-    Scanner s = conn.createScanner(tableName, Authorizations.EMPTY);
-    Assert.assertEquals(0, Iterables.size(s));
+    try (Scanner s = conn.createScanner(tableName, Authorizations.EMPTY)) {
+      Assert.assertEquals(0, Iterables.size(s));
+    }
   }
 
   @Test
@@ -205,8 +206,9 @@ public void testPartialHeaderWalRecoveryCompletes() throws Exception {
 
     // Reading the table implies that recovery completed successfully (the empty file was ignored)
     // otherwise the tablet will never come online and we won't be able to read it.
-    Scanner s = conn.createScanner(tableName, Authorizations.EMPTY);
-    Assert.assertEquals(0, Iterables.size(s));
+    try (Scanner s = conn.createScanner(tableName, Authorizations.EMPTY)) {
+      Assert.assertEquals(0, Iterables.size(s));
+    }
   }
 
 }
diff --git a/test/src/main/java/org/apache/accumulo/test/MultiTableBatchWriterIT.java b/test/src/main/java/org/apache/accumulo/test/MultiTableBatchWriterIT.java
index d33b12cd7f..27bcec052d 100644
--- a/test/src/main/java/org/apache/accumulo/test/MultiTableBatchWriterIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/MultiTableBatchWriterIT.java
@@ -106,23 +106,24 @@ public void testTableRenameDataValidation() throws Exception {
       table2Expectations.put(Maps.immutableEntry("foo", "col1"), "val1");
       table2Expectations.put(Maps.immutableEntry("bar", "col1"), "val1");
 
-      Scanner s = connector.createScanner(table1, new Authorizations());
-      s.setRange(new Range());
       Map<Entry<String,String>,String> actual = new HashMap<>();
-      for (Entry<Key,Value> entry : s) {
-        actual.put(Maps.immutableEntry(entry.getKey().getRow().toString(), entry.getKey().getColumnFamily().toString()), entry.getValue().toString());
-      }
-
-      Assert.assertEquals("Differing results for " + table1, table1Expectations, actual);
 
-      s = connector.createScanner(table2, new Authorizations());
-      s.setRange(new Range());
-      actual = new HashMap<>();
-      for (Entry<Key,Value> entry : s) {
-        actual.put(Maps.immutableEntry(entry.getKey().getRow().toString(), entry.getKey().getColumnFamily().toString()), entry.getValue().toString());
+      try (Scanner s = connector.createScanner(table1, new Authorizations())) {
+        s.setRange(new Range());
+        for (Entry<Key,Value> entry : s) {
+          actual.put(Maps.immutableEntry(entry.getKey().getRow().toString(), entry.getKey().getColumnFamily().toString()), entry.getValue().toString());
+        }
+        Assert.assertEquals("Differing results for " + table1, table1Expectations, actual);
       }
 
-      Assert.assertEquals("Differing results for " + table2, table2Expectations, actual);
+      try (Scanner s = connector.createScanner(table2, new Authorizations())) {
+        s.setRange(new Range());
+        actual = new HashMap<>();
+        for (Entry<Key,Value> entry : s) {
+          actual.put(Maps.immutableEntry(entry.getKey().getRow().toString(), entry.getKey().getColumnFamily().toString()), entry.getValue().toString());
+        }
+        Assert.assertEquals("Differing results for " + table2, table2Expectations, actual);
+      }
 
     } finally {
       if (null != mtbw) {
@@ -171,14 +172,14 @@ public void testTableRenameSameWriters() throws Exception {
       expectations.put(Maps.immutableEntry("bar", "col2"), "val2");
 
       for (String table : Arrays.asList(newTable1, newTable2)) {
-        Scanner s = connector.createScanner(table, new Authorizations());
-        s.setRange(new Range());
-        Map<Entry<String,String>,String> actual = new HashMap<>();
-        for (Entry<Key,Value> entry : s) {
-          actual.put(Maps.immutableEntry(entry.getKey().getRow().toString(), entry.getKey().getColumnFamily().toString()), entry.getValue().toString());
+        try (Scanner s = connector.createScanner(table, new Authorizations())) {
+          s.setRange(new Range());
+          Map<Entry<String,String>,String> actual = new HashMap<>();
+          for (Entry<Key,Value> entry : s) {
+            actual.put(Maps.immutableEntry(entry.getKey().getRow().toString(), entry.getKey().getColumnFamily().toString()), entry.getValue().toString());
+          }
+          Assert.assertEquals("Differing results for " + table, expectations, actual);
         }
-
-        Assert.assertEquals("Differing results for " + table, expectations, actual);
       }
     } finally {
       if (null != mtbw) {
@@ -247,14 +248,14 @@ public void testTableRenameNewWriters() throws Exception {
       expectations.put(Maps.immutableEntry("bar", "col2"), "val2");
 
       for (String table : Arrays.asList(newTable1, newTable2)) {
-        Scanner s = connector.createScanner(table, new Authorizations());
-        s.setRange(new Range());
-        Map<Entry<String,String>,String> actual = new HashMap<>();
-        for (Entry<Key,Value> entry : s) {
-          actual.put(Maps.immutableEntry(entry.getKey().getRow().toString(), entry.getKey().getColumnFamily().toString()), entry.getValue().toString());
+        try (Scanner s = connector.createScanner(table, new Authorizations())) {
+          s.setRange(new Range());
+          Map<Entry<String,String>,String> actual = new HashMap<>();
+          for (Entry<Key,Value> entry : s) {
+            actual.put(Maps.immutableEntry(entry.getKey().getRow().toString(), entry.getKey().getColumnFamily().toString()), entry.getValue().toString());
+          }
+          Assert.assertEquals("Differing results for " + table, expectations, actual);
         }
-
-        Assert.assertEquals("Differing results for " + table, expectations, actual);
       }
     } finally {
       if (null != mtbw) {
diff --git a/test/src/main/java/org/apache/accumulo/test/MultiTableRecoveryIT.java b/test/src/main/java/org/apache/accumulo/test/MultiTableRecoveryIT.java
index 94db212f2c..890f6285c1 100644
--- a/test/src/main/java/org/apache/accumulo/test/MultiTableRecoveryIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/MultiTableRecoveryIT.java
@@ -99,13 +99,13 @@ public void testRecoveryOverMultipleTables() throws Exception {
     System.out.println("checking the data");
     long count = 0;
     for (int w = 0; w < N; w++) {
-      Scanner scanner = c.createScanner(tables[w], Authorizations.EMPTY);
-      for (Entry<Key,Value> entry : scanner) {
-        int value = Integer.parseInt(entry.getValue().toString());
-        assertEquals(w, value);
-        count++;
+      try (Scanner scanner = c.createScanner(tables[w], Authorizations.EMPTY)) {
+        for (Entry<Key,Value> entry : scanner) {
+          int value = Integer.parseInt(entry.getValue().toString());
+          assertEquals(w, value);
+          count++;
+        }
       }
-      scanner.close();
     }
     assertEquals(1_000_000, count);
   }
diff --git a/test/src/main/java/org/apache/accumulo/test/NamespacesIT.java b/test/src/main/java/org/apache/accumulo/test/NamespacesIT.java
index 31b701681b..85b55b5d4d 100644
--- a/test/src/main/java/org/apache/accumulo/test/NamespacesIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/NamespacesIT.java
@@ -325,35 +325,40 @@ public void verifyIteratorInheritance() throws Exception {
     IteratorSetting setting = new IteratorSetting(250, iterName, SimpleFilter.class.getName());
 
     // verify can see inserted entry
-    Scanner s = c.createScanner(t1, Authorizations.EMPTY);
-    assertTrue(s.iterator().hasNext());
-    assertFalse(c.namespaceOperations().listIterators(namespace).containsKey(iterName));
-    assertFalse(c.tableOperations().listIterators(t1).containsKey(iterName));
-
-    // verify entry is filtered out (also, verify conflict checking API)
-    c.namespaceOperations().checkIteratorConflicts(namespace, setting, EnumSet.allOf(IteratorScope.class));
-    c.namespaceOperations().attachIterator(namespace, setting);
-    sleepUninterruptibly(2, TimeUnit.SECONDS);
-    try {
+    try (Scanner s = c.createScanner(t1, Authorizations.EMPTY)) {
+      assertTrue(s.iterator().hasNext());
+      assertFalse(c.namespaceOperations().listIterators(namespace).containsKey(iterName));
+      assertFalse(c.tableOperations().listIterators(t1).containsKey(iterName));
+
+      // verify entry is filtered out (also, verify conflict checking API)
       c.namespaceOperations().checkIteratorConflicts(namespace, setting, EnumSet.allOf(IteratorScope.class));
-      fail();
-    } catch (AccumuloException e) {
-      assertEquals(IllegalArgumentException.class.getName(), e.getCause().getClass().getName());
+      c.namespaceOperations().attachIterator(namespace, setting);
+      sleepUninterruptibly(2, TimeUnit.SECONDS);
+      try {
+        c.namespaceOperations().checkIteratorConflicts(namespace, setting, EnumSet.allOf(IteratorScope.class));
+        fail();
+      } catch (AccumuloException e) {
+        assertEquals(IllegalArgumentException.class.getName(), e.getCause().getClass().getName());
+      }
+      IteratorSetting setting2 = c.namespaceOperations().getIteratorSetting(namespace, setting.getName(), IteratorScope.scan);
+      assertEquals(setting, setting2);
+      assertTrue(c.namespaceOperations().listIterators(namespace).containsKey(iterName));
+      assertTrue(c.tableOperations().listIterators(t1).containsKey(iterName));
+    }
+
+    try (Scanner s = c.createScanner(t1, Authorizations.EMPTY)) {
+      assertFalse(s.iterator().hasNext());
+
+      // verify can see inserted entry again
+      c.namespaceOperations().removeIterator(namespace, setting.getName(), EnumSet.allOf(IteratorScope.class));
+      sleepUninterruptibly(2, TimeUnit.SECONDS);
+      assertFalse(c.namespaceOperations().listIterators(namespace).containsKey(iterName));
+      assertFalse(c.tableOperations().listIterators(t1).containsKey(iterName));
+    }
+
+    try (Scanner s = c.createScanner(t1, Authorizations.EMPTY)) {
+      assertTrue(s.iterator().hasNext());
     }
-    IteratorSetting setting2 = c.namespaceOperations().getIteratorSetting(namespace, setting.getName(), IteratorScope.scan);
-    assertEquals(setting, setting2);
-    assertTrue(c.namespaceOperations().listIterators(namespace).containsKey(iterName));
-    assertTrue(c.tableOperations().listIterators(t1).containsKey(iterName));
-    s = c.createScanner(t1, Authorizations.EMPTY);
-    assertFalse(s.iterator().hasNext());
-
-    // verify can see inserted entry again
-    c.namespaceOperations().removeIterator(namespace, setting.getName(), EnumSet.allOf(IteratorScope.class));
-    sleepUninterruptibly(2, TimeUnit.SECONDS);
-    assertFalse(c.namespaceOperations().listIterators(namespace).containsKey(iterName));
-    assertFalse(c.tableOperations().listIterators(t1).containsKey(iterName));
-    s = c.createScanner(t1, Authorizations.EMPTY);
-    assertTrue(s.iterator().hasNext());
   }
 
   @Test
diff --git a/test/src/main/java/org/apache/accumulo/test/QueryMetadataTable.java b/test/src/main/java/org/apache/accumulo/test/QueryMetadataTable.java
index b268fb46ae..4d4fe43c5b 100644
--- a/test/src/main/java/org/apache/accumulo/test/QueryMetadataTable.java
+++ b/test/src/main/java/org/apache/accumulo/test/QueryMetadataTable.java
@@ -63,11 +63,12 @@
 
     @Override
     public void run() {
+      Scanner mdScanner = null;
       try {
         KeyExtent extent = new KeyExtent(row, (Text) null);
 
         Connector connector = HdfsZooInstance.getInstance().getConnector(principal, token);
-        Scanner mdScanner = connector.createScanner(MetadataTable.NAME, Authorizations.EMPTY);
+        mdScanner = connector.createScanner(MetadataTable.NAME, Authorizations.EMPTY);
         Text row = extent.getMetadataEntry();
 
         mdScanner.setRange(new Range(row));
@@ -86,6 +87,10 @@ public void run() {
       } catch (AccumuloSecurityException e) {
         log.error("AccumuloSecurityException encountered.", e);
         throw new RuntimeException(e);
+      } finally {
+        if (mdScanner != null) {
+          mdScanner.close();
+        }
       }
     }
   }
@@ -103,27 +108,28 @@ public static void main(String[] args) throws AccumuloException, AccumuloSecurit
     opts.parseArgs(QueryMetadataTable.class.getName(), args, scanOpts);
 
     Connector connector = opts.getConnector();
-    Scanner scanner = connector.createScanner(MetadataTable.NAME, opts.auths);
-    scanner.setBatchSize(scanOpts.scanBatchSize);
-    Text mdrow = new Text(KeyExtent.getMetadataEntry(MetadataTable.ID, null));
-
     HashSet<Text> rowSet = new HashSet<>();
 
     int count = 0;
 
-    for (Entry<Key,Value> entry : scanner) {
-      System.out.print(".");
-      if (count % 72 == 0) {
-        System.out.printf(" %,d%n", count);
-      }
-      if (entry.getKey().compareRow(mdrow) == 0 && entry.getKey().getColumnFamily().compareTo(TabletsSection.CurrentLocationColumnFamily.NAME) == 0) {
-        System.out.println(entry.getKey() + " " + entry.getValue());
-        location = entry.getValue().toString();
-      }
+    try (Scanner scanner = connector.createScanner(MetadataTable.NAME, opts.auths)) {
+      scanner.setBatchSize(scanOpts.scanBatchSize);
+      Text mdrow = new Text(KeyExtent.getMetadataEntry(MetadataTable.ID, null));
 
-      if (!entry.getKey().getRow().toString().startsWith(MetadataTable.ID.canonicalID()))
-        rowSet.add(entry.getKey().getRow());
-      count++;
+      for (Entry<Key,Value> entry : scanner) {
+        System.out.print(".");
+        if (count % 72 == 0) {
+          System.out.printf(" %,d%n", count);
+        }
+        if (entry.getKey().compareRow(mdrow) == 0 && entry.getKey().getColumnFamily().compareTo(TabletsSection.CurrentLocationColumnFamily.NAME) == 0) {
+          System.out.println(entry.getKey() + " " + entry.getValue());
+          location = entry.getValue().toString();
+        }
+
+        if (!entry.getKey().getRow().toString().startsWith(MetadataTable.ID.canonicalID()))
+          rowSet.add(entry.getKey().getRow());
+        count++;
+      }
     }
 
     System.out.printf(" %,d%n", count);
diff --git a/test/src/main/java/org/apache/accumulo/test/RecoveryCompactionsAreFlushesIT.java b/test/src/main/java/org/apache/accumulo/test/RecoveryCompactionsAreFlushesIT.java
index f79e1748d9..1b7bb90fe7 100644
--- a/test/src/main/java/org/apache/accumulo/test/RecoveryCompactionsAreFlushesIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/RecoveryCompactionsAreFlushesIT.java
@@ -89,12 +89,13 @@ public void test() throws Exception {
     Iterators.size(c.createScanner(tableName, Authorizations.EMPTY).iterator());
 
     // ensure that the recovery was not a merging minor compaction
-    Scanner s = c.createScanner(MetadataTable.NAME, Authorizations.EMPTY);
-    s.fetchColumnFamily(MetadataSchema.TabletsSection.DataFileColumnFamily.NAME);
-    for (Entry<Key,Value> entry : s) {
-      String filename = entry.getKey().getColumnQualifier().toString();
-      String parts[] = filename.split("/");
-      Assert.assertFalse(parts[parts.length - 1].startsWith("M"));
+    try (Scanner s = c.createScanner(MetadataTable.NAME, Authorizations.EMPTY)) {
+      s.fetchColumnFamily(MetadataSchema.TabletsSection.DataFileColumnFamily.NAME);
+      for (Entry<Key,Value> entry : s) {
+        String filename = entry.getKey().getColumnQualifier().toString();
+        String parts[] = filename.split("/");
+        Assert.assertFalse(parts[parts.length - 1].startsWith("M"));
+      }
     }
   }
 
diff --git a/test/src/main/java/org/apache/accumulo/test/RewriteTabletDirectoriesIT.java b/test/src/main/java/org/apache/accumulo/test/RewriteTabletDirectoriesIT.java
index 2189fff0e8..96e000e794 100644
--- a/test/src/main/java/org/apache/accumulo/test/RewriteTabletDirectoriesIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/RewriteTabletDirectoriesIT.java
@@ -98,72 +98,73 @@ public void test() throws Exception {
     bw.close();
     c.tableOperations().addSplits(tableName, splits);
 
-    BatchScanner scanner = c.createBatchScanner(MetadataTable.NAME, Authorizations.EMPTY, 1);
-    DIRECTORY_COLUMN.fetch(scanner);
-    Table.ID tableId = Table.ID.of(c.tableOperations().tableIdMap().get(tableName));
-    assertNotNull("TableID for " + tableName + " was null", tableId);
-    scanner.setRanges(Collections.singletonList(TabletsSection.getRange(tableId)));
-    // verify the directory entries are all on v1, make a few entries relative
-    bw = c.createBatchWriter(MetadataTable.NAME, null);
-    int count = 0;
-    for (Entry<Key,Value> entry : scanner) {
-      assertTrue("Expected " + entry.getValue() + " to contain " + v1, entry.getValue().toString().contains(v1.toString()));
-      count++;
-      if (count % 2 == 0) {
-        String parts[] = entry.getValue().toString().split("/");
-        Key key = entry.getKey();
-        Mutation m = new Mutation(key.getRow());
-        m.put(key.getColumnFamily(), key.getColumnQualifier(), new Value((Path.SEPARATOR + parts[parts.length - 1]).getBytes()));
-        bw.addMutation(m);
+    try (BatchScanner scanner = c.createBatchScanner(MetadataTable.NAME, Authorizations.EMPTY, 1)) {
+      DIRECTORY_COLUMN.fetch(scanner);
+      Table.ID tableId = Table.ID.of(c.tableOperations().tableIdMap().get(tableName));
+      assertNotNull("TableID for " + tableName + " was null", tableId);
+      scanner.setRanges(Collections.singletonList(TabletsSection.getRange(tableId)));
+      // verify the directory entries are all on v1, make a few entries relative
+      bw = c.createBatchWriter(MetadataTable.NAME, null);
+      int count = 0;
+      for (Entry<Key,Value> entry : scanner) {
+        assertTrue("Expected " + entry.getValue() + " to contain " + v1, entry.getValue().toString().contains(v1.toString()));
+        count++;
+        if (count % 2 == 0) {
+          String parts[] = entry.getValue().toString().split("/");
+          Key key = entry.getKey();
+          Mutation m = new Mutation(key.getRow());
+          m.put(key.getColumnFamily(), key.getColumnQualifier(), new Value((Path.SEPARATOR + parts[parts.length - 1]).getBytes()));
+          bw.addMutation(m);
+        }
       }
-    }
-    bw.close();
-    assertEquals(splits.size() + 1, count);
-
-    // This should fail: only one volume
-    assertEquals(1, cluster.exec(RandomizeVolumes.class, "-z", cluster.getZooKeepers(), "-i", c.getInstance().getInstanceName(), "-t", tableName).waitFor());
-
-    cluster.stop();
-
-    // add the 2nd volume
-    Configuration conf = new Configuration(false);
-    conf.addResource(new Path(cluster.getConfig().getConfDir().toURI().toString(), "accumulo-site.xml"));
-    conf.set(Property.INSTANCE_VOLUMES.getKey(), v1.toString() + "," + v2.toString());
-    BufferedOutputStream fos = new BufferedOutputStream(new FileOutputStream(new File(cluster.getConfig().getConfDir(), "accumulo-site.xml")));
-    conf.writeXml(fos);
-    fos.close();
-
-    // initialize volume
-    assertEquals(0, cluster.exec(Initialize.class, "--add-volumes").waitFor());
-    cluster.start();
-    c = getConnector();
-
-    // change the directory entries
-    assertEquals(0, cluster.exec(Admin.class, "randomizeVolumes", "-t", tableName).waitFor());
-
-    // verify a more equal sharing
-    int v1Count = 0, v2Count = 0;
-    for (Entry<Key,Value> entry : scanner) {
-      if (entry.getValue().toString().contains(v1.toString())) {
-        v1Count++;
-      }
-      if (entry.getValue().toString().contains(v2.toString())) {
-        v2Count++;
+      bw.close();
+      assertEquals(splits.size() + 1, count);
+
+      // This should fail: only one volume
+      assertEquals(1, cluster.exec(RandomizeVolumes.class, "-z", cluster.getZooKeepers(), "-i", c.getInstance().getInstanceName(), "-t", tableName).waitFor());
+
+      cluster.stop();
+
+      // add the 2nd volume
+      Configuration conf = new Configuration(false);
+      conf.addResource(new Path(cluster.getConfig().getConfDir().toURI().toString(), "accumulo-site.xml"));
+      conf.set(Property.INSTANCE_VOLUMES.getKey(), v1.toString() + "," + v2.toString());
+      BufferedOutputStream fos = new BufferedOutputStream(new FileOutputStream(new File(cluster.getConfig().getConfDir(), "accumulo-site.xml")));
+      conf.writeXml(fos);
+      fos.close();
+
+      // initialize volume
+      assertEquals(0, cluster.exec(Initialize.class, "--add-volumes").waitFor());
+      cluster.start();
+      c = getConnector();
+
+      // change the directory entries
+      assertEquals(0, cluster.exec(Admin.class, "randomizeVolumes", "-t", tableName).waitFor());
+
+      // verify a more equal sharing
+      int v1Count = 0, v2Count = 0;
+      for (Entry<Key,Value> entry : scanner) {
+        if (entry.getValue().toString().contains(v1.toString())) {
+          v1Count++;
+        }
+        if (entry.getValue().toString().contains(v2.toString())) {
+          v2Count++;
+        }
       }
-    }
 
-    log.info("Count for volume1: {}", v1Count);
-    log.info("Count for volume2: {}", v2Count);
-
-    assertEquals(splits.size() + 1, v1Count + v2Count);
-    // a fair chooser will differ by less than count(volumes)
-    assertTrue("Expected the number of files to differ between volumes by less than 10. " + v1Count + " " + v2Count, Math.abs(v1Count - v2Count) < 2);
-    // verify we can read the old data
-    count = 0;
-    for (Entry<Key,Value> entry : c.createScanner(tableName, Authorizations.EMPTY)) {
-      assertTrue("Found unexpected entry in table: " + entry, splits.contains(entry.getKey().getRow()));
-      count++;
+      log.info("Count for volume1: {}", v1Count);
+      log.info("Count for volume2: {}", v2Count);
+
+      assertEquals(splits.size() + 1, v1Count + v2Count);
+      // a fair chooser will differ by less than count(volumes)
+      assertTrue("Expected the number of files to differ between volumes by less than 10. " + v1Count + " " + v2Count, Math.abs(v1Count - v2Count) < 2);
+      // verify we can read the old data
+      count = 0;
+      for (Entry<Key,Value> entry : c.createScanner(tableName, Authorizations.EMPTY)) {
+        assertTrue("Found unexpected entry in table: " + entry, splits.contains(entry.getKey().getRow()));
+        count++;
+      }
+      assertEquals(splits.size(), count);
     }
-    assertEquals(splits.size(), count);
   }
 }
diff --git a/test/src/main/java/org/apache/accumulo/test/SampleIT.java b/test/src/main/java/org/apache/accumulo/test/SampleIT.java
index a195d4bb85..9e6b1068ba 100644
--- a/test/src/main/java/org/apache/accumulo/test/SampleIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/SampleIT.java
@@ -193,8 +193,6 @@ public void testBasic() throws Exception {
     expected.put(new Key(someRow, "cf1", "cq3", 8), new Value("suprise".getBytes()));
 
     check(expected, scanner, bScanner, isoScanner, csiScanner, oScanner);
-
-    bScanner.close();
   }
 
   private Scanner newOfflineScanner(Connector conn, String tableName, String clone, SamplerConfiguration sc) throws Exception {
@@ -311,64 +309,87 @@ public void testIterator() throws Exception {
 
     Range range1 = new Range(keys.get(6), true, keys.get(11), true);
 
-    Scanner scanner = conn.createScanner(tableName, Authorizations.EMPTY);
-    Scanner isoScanner = new IsolatedScanner(conn.createScanner(tableName, Authorizations.EMPTY));
-    ClientSideIteratorScanner csiScanner = new ClientSideIteratorScanner(conn.createScanner(tableName, Authorizations.EMPTY));
-    BatchScanner bScanner = conn.createBatchScanner(tableName, Authorizations.EMPTY, 2);
+    Scanner scanner = null;
+    Scanner isoScanner = null;
+    ClientSideIteratorScanner csiScanner = null;
+    BatchScanner bScanner = null;
+    Scanner oScanner = null;
+    try {
+      scanner = conn.createScanner(tableName, Authorizations.EMPTY);
+      isoScanner = new IsolatedScanner(conn.createScanner(tableName, Authorizations.EMPTY));
+      csiScanner = new ClientSideIteratorScanner(conn.createScanner(tableName, Authorizations.EMPTY));
+      bScanner = conn.createBatchScanner(tableName, Authorizations.EMPTY, 2);
 
-    csiScanner.setIteratorSamplerConfiguration(SC1);
+      csiScanner.setIteratorSamplerConfiguration(SC1);
 
-    List<? extends ScannerBase> scanners = Arrays.asList(scanner, isoScanner, bScanner, csiScanner);
+      List<? extends ScannerBase> scanners = Arrays.asList(scanner, isoScanner, bScanner, csiScanner);
 
-    for (ScannerBase s : scanners) {
-      s.addScanIterator(new IteratorSetting(100, IteratorThatUsesSample.class));
-    }
+      for (ScannerBase s : scanners) {
+        s.addScanIterator(new IteratorSetting(100, IteratorThatUsesSample.class));
+      }
 
-    // the iterator should see less than 10 entries in sample data, and return data
-    setRange(range1, scanners);
-    for (ScannerBase s : scanners) {
-      Assert.assertEquals(2954, countEntries(s));
-    }
+      // the iterator should see less than 10 entries in sample data, and return data
+      setRange(range1, scanners);
+      for (ScannerBase s : scanners) {
+        Assert.assertEquals(2954, countEntries(s));
+      }
 
-    Range range2 = new Range(keys.get(5), true, keys.get(18), true);
-    setRange(range2, scanners);
+      Range range2 = new Range(keys.get(5), true, keys.get(18), true);
+      setRange(range2, scanners);
 
-    // the iterator should see more than 10 entries in sample data, and return no data
-    for (ScannerBase s : scanners) {
-      Assert.assertEquals(0, countEntries(s));
-    }
+      // the iterator should see more than 10 entries in sample data, and return no data
+      for (ScannerBase s : scanners) {
+        Assert.assertEquals(0, countEntries(s));
+      }
 
-    // flush an rerun same test against files
-    conn.tableOperations().flush(tableName, null, null, true);
+      // flush an rerun same test against files
+      conn.tableOperations().flush(tableName, null, null, true);
 
-    Scanner oScanner = newOfflineScanner(conn, tableName, clone, null);
-    oScanner.addScanIterator(new IteratorSetting(100, IteratorThatUsesSample.class));
-    scanners = Arrays.asList(scanner, isoScanner, bScanner, csiScanner, oScanner);
+      oScanner = newOfflineScanner(conn, tableName, clone, null);
+      oScanner.addScanIterator(new IteratorSetting(100, IteratorThatUsesSample.class));
+      scanners = Arrays.asList(scanner, isoScanner, bScanner, csiScanner, oScanner);
 
-    setRange(range1, scanners);
-    for (ScannerBase s : scanners) {
-      Assert.assertEquals(2954, countEntries(s));
-    }
+      setRange(range1, scanners);
+      for (ScannerBase s : scanners) {
+        Assert.assertEquals(2954, countEntries(s));
+      }
 
-    setRange(range2, scanners);
-    for (ScannerBase s : scanners) {
-      Assert.assertEquals(0, countEntries(s));
-    }
+      setRange(range2, scanners);
+      for (ScannerBase s : scanners) {
+        Assert.assertEquals(0, countEntries(s));
+      }
 
-    updateSamplingConfig(conn, tableName, SC2);
+      updateSamplingConfig(conn, tableName, SC2);
 
-    csiScanner.setIteratorSamplerConfiguration(SC2);
+      csiScanner.setIteratorSamplerConfiguration(SC2);
 
-    oScanner = newOfflineScanner(conn, tableName, clone, null);
-    oScanner.addScanIterator(new IteratorSetting(100, IteratorThatUsesSample.class));
-    scanners = Arrays.asList(scanner, isoScanner, bScanner, csiScanner, oScanner);
+      oScanner = newOfflineScanner(conn, tableName, clone, null);
+      oScanner.addScanIterator(new IteratorSetting(100, IteratorThatUsesSample.class));
+      scanners = Arrays.asList(scanner, isoScanner, bScanner, csiScanner, oScanner);
 
-    for (ScannerBase s : scanners) {
-      try {
-        countEntries(s);
-        Assert.fail("Expected SampleNotPresentException, but it did not happen : " + s.getClass().getSimpleName());
-      } catch (SampleNotPresentException e) {
+      for (ScannerBase s : scanners) {
+        try {
+          countEntries(s);
+          Assert.fail("Expected SampleNotPresentException, but it did not happen : " + s.getClass().getSimpleName());
+        } catch (SampleNotPresentException e) {
 
+        }
+      }
+    } finally {
+      if (scanner != null) {
+        scanner.close();
+      }
+      if (bScanner != null) {
+        bScanner.close();
+      }
+      if (isoScanner != null) {
+        isoScanner.close();
+      }
+      if (csiScanner != null) {
+        csiScanner.close();
+      }
+      if (oScanner != null) {
+        oScanner.close();
       }
     }
   }
@@ -442,8 +463,6 @@ public void testSampleNotPresent() throws Exception {
     oScanner = newOfflineScanner(conn, tableName, clone, SC2);
     setSamplerConfig(SC2, scanner, csiScanner, isoScanner, bScanner, oScanner);
     check(expected, scanner, isoScanner, bScanner, csiScanner, oScanner);
-
-    bScanner.close();
   }
 
   private void updateSamplingConfig(Connector conn, String tableName, SamplerConfiguration sc) throws TableNotFoundException, AccumuloException,
diff --git a/test/src/main/java/org/apache/accumulo/test/ScanFlushWithTimeIT.java b/test/src/main/java/org/apache/accumulo/test/ScanFlushWithTimeIT.java
index 78ffa60e6c..164993fec4 100644
--- a/test/src/main/java/org/apache/accumulo/test/ScanFlushWithTimeIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/ScanFlushWithTimeIT.java
@@ -72,21 +72,23 @@ public void test() throws Exception {
     log.info("Fetching some entries: should timeout and return something");
 
     log.info("Scanner");
-    Scanner s = c.createScanner(tableName, Authorizations.EMPTY);
-    s.setBatchTimeout(500, TimeUnit.MILLISECONDS);
-    testScanner(s, 1200);
+    try (Scanner s = c.createScanner(tableName, Authorizations.EMPTY)) {
+      s.setBatchTimeout(500, TimeUnit.MILLISECONDS);
+      testScanner(s, 1200);
 
-    log.info("IsolatedScanner");
-    IsolatedScanner is = new IsolatedScanner(s);
-    is.setReadaheadThreshold(1);
-    // buffers an entire row
-    testScanner(is, 2200);
+      log.info("IsolatedScanner");
+      IsolatedScanner is = new IsolatedScanner(s);
+      is.setReadaheadThreshold(1);
+      // buffers an entire row
+      testScanner(is, 2200);
+    }
 
     log.info("BatchScanner");
-    BatchScanner bs = c.createBatchScanner(tableName, Authorizations.EMPTY, 5);
-    bs.setBatchTimeout(500, TimeUnit.MILLISECONDS);
-    bs.setRanges(Collections.singletonList(new Range()));
-    testScanner(bs, 1200);
+    try (BatchScanner bs = c.createBatchScanner(tableName, Authorizations.EMPTY, 5)) {
+      bs.setBatchTimeout(500, TimeUnit.MILLISECONDS);
+      bs.setRanges(Collections.singletonList(new Range()));
+      testScanner(bs, 1200);
+    }
   }
 
   private void testScanner(ScannerBase s, long expected) {
diff --git a/test/src/main/java/org/apache/accumulo/test/ShellServerIT.java b/test/src/main/java/org/apache/accumulo/test/ShellServerIT.java
index 6dd9b4236b..fd09d20f0a 100644
--- a/test/src/main/java/org/apache/accumulo/test/ShellServerIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/ShellServerIT.java
@@ -1508,62 +1508,62 @@ public void listscans() throws Exception {
       ts.exec("insert " + i + " cf cq value", true);
     }
     Connector connector = getConnector();
-    final Scanner s = connector.createScanner(table, Authorizations.EMPTY);
-    IteratorSetting cfg = new IteratorSetting(30, SlowIterator.class);
-    SlowIterator.setSleepTime(cfg, 500);
-    s.addScanIterator(cfg);
-
-    Thread thread = new Thread() {
-      @Override
-      public void run() {
-        try {
-          Iterators.size(s.iterator());
-        } catch (Exception ex) {
-          throw new RuntimeException(ex);
+    try (Scanner s = connector.createScanner(table, Authorizations.EMPTY)) {
+      IteratorSetting cfg = new IteratorSetting(30, SlowIterator.class);
+      SlowIterator.setSleepTime(cfg, 500);
+      s.addScanIterator(cfg);
+
+      Thread thread = new Thread() {
+        @Override
+        public void run() {
+          try {
+            Iterators.size(s.iterator());
+          } catch (Exception ex) {
+            throw new RuntimeException(ex);
+          }
         }
-      }
-    };
-    thread.start();
-
-    List<String> scans = new ArrayList<>();
-    // Try to find the active scan for about 15seconds
-    for (int i = 0; i < 50 && scans.isEmpty(); i++) {
-      String currentScans = ts.exec("listscans", true);
-      log.info("Got output from listscans:\n{}", currentScans);
-      String[] lines = currentScans.split("\n");
-      for (int scanOffset = 2; scanOffset < lines.length; scanOffset++) {
-        String currentScan = lines[scanOffset];
-        if (currentScan.contains(table)) {
-          log.info("Retaining scan: {}", currentScan);
-          scans.add(currentScan);
-        } else {
-          log.info("Ignoring scan because of wrong table: {}", currentScan);
+      };
+      thread.start();
+
+      List<String> scans = new ArrayList<>();
+      // Try to find the active scan for about 15seconds
+      for (int i = 0; i < 50 && scans.isEmpty(); i++) {
+        String currentScans = ts.exec("listscans", true);
+        log.info("Got output from listscans:\n{}", currentScans);
+        String[] lines = currentScans.split("\n");
+        for (int scanOffset = 2; scanOffset < lines.length; scanOffset++) {
+          String currentScan = lines[scanOffset];
+          if (currentScan.contains(table)) {
+            log.info("Retaining scan: {}", currentScan);
+            scans.add(currentScan);
+          } else {
+            log.info("Ignoring scan because of wrong table: {}", currentScan);
+          }
         }
+        sleepUninterruptibly(300, TimeUnit.MILLISECONDS);
       }
-      sleepUninterruptibly(300, TimeUnit.MILLISECONDS);
-    }
-    thread.join();
+      thread.join();
 
-    assertFalse("Could not find any active scans over table " + table, scans.isEmpty());
+      assertFalse("Could not find any active scans over table " + table, scans.isEmpty());
 
-    for (String scan : scans) {
-      if (!scan.contains("RUNNING")) {
-        log.info("Ignoring scan because it doesn't contain 'RUNNING': {}", scan);
-        continue;
+      for (String scan : scans) {
+        if (!scan.contains("RUNNING")) {
+          log.info("Ignoring scan because it doesn't contain 'RUNNING': {}", scan);
+          continue;
+        }
+        String parts[] = scan.split("\\|");
+        assertEquals("Expected 14 colums, but found " + parts.length + " instead for '" + Arrays.toString(parts) + "'", 14, parts.length);
+        String tserver = parts[0].trim();
+        // TODO: any way to tell if the client address is accurate? could be local IP, host, loopback...?
+        String hostPortPattern = ".+:\\d+";
+        assertTrue(tserver.matches(hostPortPattern));
+        assertTrue(getConnector().instanceOperations().getTabletServers().contains(tserver));
+        String client = parts[1].trim();
+        assertTrue(client + " does not match " + hostPortPattern, client.matches(hostPortPattern));
+        // Scan ID should be a long (throwing an exception if it fails to parse)
+        Long.parseLong(parts[11].trim());
       }
-      String parts[] = scan.split("\\|");
-      assertEquals("Expected 14 colums, but found " + parts.length + " instead for '" + Arrays.toString(parts) + "'", 14, parts.length);
-      String tserver = parts[0].trim();
-      // TODO: any way to tell if the client address is accurate? could be local IP, host, loopback...?
-      String hostPortPattern = ".+:\\d+";
-      assertTrue(tserver.matches(hostPortPattern));
-      assertTrue(getConnector().instanceOperations().getTabletServers().contains(tserver));
-      String client = parts[1].trim();
-      assertTrue(client + " does not match " + hostPortPattern, client.matches(hostPortPattern));
-      // Scan ID should be a long (throwing an exception if it fails to parse)
-      Long.parseLong(parts[11].trim());
     }
-
     ts.exec("deletetable -f " + table, true);
   }
 
diff --git a/test/src/main/java/org/apache/accumulo/test/SplitRecoveryIT.java b/test/src/main/java/org/apache/accumulo/test/SplitRecoveryIT.java
index 724c5e8f07..620e8b3a06 100644
--- a/test/src/main/java/org/apache/accumulo/test/SplitRecoveryIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/SplitRecoveryIT.java
@@ -54,10 +54,11 @@ private Mutation m(String row) {
 
   boolean isOffline(String tablename, Connector connector) throws TableNotFoundException {
     String tableId = connector.tableOperations().tableIdMap().get(tablename);
-    Scanner scanner = connector.createScanner(MetadataTable.NAME, Authorizations.EMPTY);
-    scanner.setRange(new Range(new Text(tableId + ";"), new Text(tableId + "<")));
-    scanner.fetchColumnFamily(TabletsSection.CurrentLocationColumnFamily.NAME);
-    return Iterators.size(scanner.iterator()) == 0;
+    try (Scanner scanner = connector.createScanner(MetadataTable.NAME, Authorizations.EMPTY)) {
+      scanner.setRange(new Range(new Text(tableId + ";"), new Text(tableId + "<")));
+      scanner.fetchColumnFamily(TabletsSection.CurrentLocationColumnFamily.NAME);
+      return Iterators.size(scanner.iterator()) == 0;
+    }
   }
 
   @Override
@@ -101,20 +102,21 @@ public void test() throws Exception {
 
         bw.flush();
 
-        Scanner scanner = connector.createScanner(MetadataTable.NAME, Authorizations.EMPTY);
-        scanner.setRange(extent.toMetadataRange());
-        scanner.fetchColumnFamily(DataFileColumnFamily.NAME);
+        try (Scanner scanner = connector.createScanner(MetadataTable.NAME, Authorizations.EMPTY)) {
+          scanner.setRange(extent.toMetadataRange());
+          scanner.fetchColumnFamily(DataFileColumnFamily.NAME);
 
-        KeyExtent extent2 = new KeyExtent(tableId, new Text("b"), null);
-        m = extent2.getPrevRowUpdateMutation();
-        TabletsSection.ServerColumnFamily.DIRECTORY_COLUMN.put(m, new Value("/t2".getBytes()));
-        TabletsSection.ServerColumnFamily.TIME_COLUMN.put(m, new Value("M0".getBytes()));
+          KeyExtent extent2 = new KeyExtent(tableId, new Text("b"), null);
+          m = extent2.getPrevRowUpdateMutation();
+          TabletsSection.ServerColumnFamily.DIRECTORY_COLUMN.put(m, new Value("/t2".getBytes()));
+          TabletsSection.ServerColumnFamily.TIME_COLUMN.put(m, new Value("M0".getBytes()));
 
-        for (Entry<Key,Value> entry : scanner) {
-          m.put(DataFileColumnFamily.NAME, entry.getKey().getColumnQualifier(), entry.getValue());
-        }
+          for (Entry<Key,Value> entry : scanner) {
+            m.put(DataFileColumnFamily.NAME, entry.getKey().getColumnQualifier(), entry.getValue());
+          }
 
-        bw.addMutation(m);
+          bw.addMutation(m);
+        }
       }
 
       bw.close();
@@ -122,17 +124,17 @@ public void test() throws Exception {
       connector.tableOperations().online(tableName);
 
       // verify the tablets went online
-      Scanner scanner = connector.createScanner(tableName, Authorizations.EMPTY);
-      int i = 0;
-      String expected[] = {"a", "b", "c"};
-      for (Entry<Key,Value> entry : scanner) {
-        assertEquals(expected[i], entry.getKey().getRow().toString());
-        i++;
-      }
-      assertEquals(3, i);
-
-      connector.tableOperations().delete(tableName);
+      try (Scanner scanner = connector.createScanner(tableName, Authorizations.EMPTY)) {
+        int i = 0;
+        String expected[] = {"a", "b", "c"};
+        for (Entry<Key,Value> entry : scanner) {
+          assertEquals(expected[i], entry.getKey().getRow().toString());
+          i++;
+        }
+        assertEquals(3, i);
 
+        connector.tableOperations().delete(tableName);
+      }
     }
   }
 
diff --git a/test/src/main/java/org/apache/accumulo/test/TableOperationsIT.java b/test/src/main/java/org/apache/accumulo/test/TableOperationsIT.java
index 807e425805..0fb2813474 100644
--- a/test/src/main/java/org/apache/accumulo/test/TableOperationsIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/TableOperationsIT.java
@@ -211,20 +211,21 @@ public void createMergeClonedTable() throws Exception {
     tops.merge(clonedTable, null, new Text("b"));
 
     Map<String,Integer> rowCounts = new HashMap<>();
-    Scanner s = connector.createScanner(clonedTable, new Authorizations());
-    for (Entry<Key,Value> entry : s) {
-      final Key key = entry.getKey();
-      String row = key.getRow().toString();
-      String cf = key.getColumnFamily().toString(), cq = key.getColumnQualifier().toString();
-      String value = entry.getValue().toString();
-
-      if (rowCounts.containsKey(row)) {
-        rowCounts.put(row, rowCounts.get(row) + 1);
-      } else {
-        rowCounts.put(row, 1);
-      }
+    try (Scanner s = connector.createScanner(clonedTable, new Authorizations())) {
+      for (Entry<Key,Value> entry : s) {
+        final Key key = entry.getKey();
+        String row = key.getRow().toString();
+        String cf = key.getColumnFamily().toString(), cq = key.getColumnQualifier().toString();
+        String value = entry.getValue().toString();
+
+        if (rowCounts.containsKey(row)) {
+          rowCounts.put(row, rowCounts.get(row) + 1);
+        } else {
+          rowCounts.put(row, 1);
+        }
 
-      Assert.assertEquals(Integer.parseInt(cf) + Integer.parseInt(cq), Integer.parseInt(value));
+        Assert.assertEquals(Integer.parseInt(cf) + Integer.parseInt(cq), Integer.parseInt(value));
+      }
     }
 
     Collection<Text> clonedSplits = tops.listSplits(clonedTable);
@@ -232,7 +233,6 @@ public void createMergeClonedTable() throws Exception {
     for (Text clonedSplit : clonedSplits) {
       Assert.assertTrue("Encountered unexpected split on the cloned table: " + clonedSplit, expectedSplits.remove(clonedSplit));
     }
-
     Assert.assertTrue("Did not find all expected splits on the cloned table: " + expectedSplits, expectedSplits.isEmpty());
   }
 
@@ -253,12 +253,13 @@ public void testCompactEmptyTableWithGeneratorIterator() throws TableExistsExcep
     list.add(new IteratorSetting(15, HardListIterator.class));
     connector.tableOperations().compact(tableName, null, null, list, true, true);
 
-    Scanner scanner = connector.createScanner(tableName, Authorizations.EMPTY);
-    Map<Key,Value> actual = new TreeMap<>(COMPARE_KEY_TO_COLQ); // only compare row, colF, colQ
-    for (Map.Entry<Key,Value> entry : scanner)
-      actual.put(entry.getKey(), entry.getValue());
-    assertEquals(HardListIterator.allEntriesToInject, actual);
-    connector.tableOperations().delete(tableName);
+    try (Scanner scanner = connector.createScanner(tableName, Authorizations.EMPTY)) {
+      Map<Key,Value> actual = new TreeMap<>(COMPARE_KEY_TO_COLQ); // only compare row, colF, colQ
+      for (Map.Entry<Key,Value> entry : scanner)
+        actual.put(entry.getKey(), entry.getValue());
+      assertEquals(HardListIterator.allEntriesToInject, actual);
+      connector.tableOperations().delete(tableName);
+    }
   }
 
   /** Compare only the row, column family and column qualifier. */
@@ -284,12 +285,13 @@ public void testCompactEmptyTableWithGeneratorIterator_Splits() throws TableExis
     list.add(new IteratorSetting(15, HardListIterator.class));
     connector.tableOperations().compact(tableName, null, null, list, true, true);
 
-    Scanner scanner = connector.createScanner(tableName, Authorizations.EMPTY);
-    Map<Key,Value> actual = new TreeMap<>(COMPARE_KEY_TO_COLQ); // only compare row, colF, colQ
-    for (Map.Entry<Key,Value> entry : scanner)
-      actual.put(entry.getKey(), entry.getValue());
-    assertEquals(HardListIterator.allEntriesToInject, actual);
-    connector.tableOperations().delete(tableName);
+    try (Scanner scanner = connector.createScanner(tableName, Authorizations.EMPTY)) {
+      Map<Key,Value> actual = new TreeMap<>(COMPARE_KEY_TO_COLQ); // only compare row, colF, colQ
+      for (Map.Entry<Key,Value> entry : scanner)
+        actual.put(entry.getKey(), entry.getValue());
+      assertEquals(HardListIterator.allEntriesToInject, actual);
+      connector.tableOperations().delete(tableName);
+    }
   }
 
   @Test
@@ -307,31 +309,32 @@ public void testCompactEmptyTableWithGeneratorIterator_Splits_Cancel() throws Ta
     connector.tableOperations().cancelCompaction(tableName);
     // depending on timing, compaction will finish or be canceled
 
-    Scanner scanner = connector.createScanner(tableName, Authorizations.EMPTY);
-    Map<Key,Value> actual = new TreeMap<>(COMPARE_KEY_TO_COLQ); // only compare row, colF, colQ
-    for (Map.Entry<Key,Value> entry : scanner)
-      actual.put(entry.getKey(), entry.getValue());
-    switch (actual.size()) {
-      case 3:
-        // Compaction cancel didn't happen in time
-        assertTrue(HardListIterator.allEntriesToInject.equals(actual));
-        break;
-      case 2:
-        // Compacted the first tablet (-inf, f)
-        assertEquals(HardListIterator.allEntriesToInject.headMap(new Key("f")), actual);
-        break;
-      case 1:
-        // Compacted the second tablet [f, +inf)
-        assertEquals(HardListIterator.allEntriesToInject.tailMap(new Key("f")), actual);
-        break;
-      case 0:
-        // Cancelled the compaction before it ran. No generated entries.
-        break;
-      default:
-        Assert.fail("Unexpected number of entries");
-        break;
+    try (Scanner scanner = connector.createScanner(tableName, Authorizations.EMPTY)) {
+      Map<Key,Value> actual = new TreeMap<>(COMPARE_KEY_TO_COLQ); // only compare row, colF, colQ
+      for (Map.Entry<Key,Value> entry : scanner)
+        actual.put(entry.getKey(), entry.getValue());
+      switch (actual.size()) {
+        case 3:
+          // Compaction cancel didn't happen in time
+          assertTrue(HardListIterator.allEntriesToInject.equals(actual));
+          break;
+        case 2:
+          // Compacted the first tablet (-inf, f)
+          assertEquals(HardListIterator.allEntriesToInject.headMap(new Key("f")), actual);
+          break;
+        case 1:
+          // Compacted the second tablet [f, +inf)
+          assertEquals(HardListIterator.allEntriesToInject.tailMap(new Key("f")), actual);
+          break;
+        case 0:
+          // Cancelled the compaction before it ran. No generated entries.
+          break;
+        default:
+          Assert.fail("Unexpected number of entries");
+          break;
+      }
+      connector.tableOperations().delete(tableName);
     }
-    connector.tableOperations().delete(tableName);
   }
 
   @Test
@@ -349,13 +352,14 @@ public void testCompactEmptyTableWithGeneratorIterator_Splits_Partial() throws T
     // compact the second tablet, not the first
     connector.tableOperations().compact(tableName, splitRow, null, list, true, true);
 
-    Scanner scanner = connector.createScanner(tableName, Authorizations.EMPTY);
-    Map<Key,Value> actual = new TreeMap<>(COMPARE_KEY_TO_COLQ); // only compare row, colF, colQ
-    for (Map.Entry<Key,Value> entry : scanner)
-      actual.put(entry.getKey(), entry.getValue());
-    // only expect the entries in the second tablet
-    assertEquals(HardListIterator.allEntriesToInject.tailMap(new Key(splitRow)), actual);
-    connector.tableOperations().delete(tableName);
+    try (Scanner scanner = connector.createScanner(tableName, Authorizations.EMPTY)) {
+      Map<Key,Value> actual = new TreeMap<>(COMPARE_KEY_TO_COLQ); // only compare row, colF, colQ
+      for (Map.Entry<Key,Value> entry : scanner)
+        actual.put(entry.getKey(), entry.getValue());
+      // only expect the entries in the second tablet
+      assertEquals(HardListIterator.allEntriesToInject.tailMap(new Key(splitRow)), actual);
+      connector.tableOperations().delete(tableName);
+    }
   }
 
   /** Test recovery from bad majc iterator via compaction cancel. */
@@ -371,12 +375,13 @@ public void testCompactEmptyTablesWithBadIterator_FailsAndCancel() throws TableE
     sleepUninterruptibly(2, TimeUnit.SECONDS); // start compaction
     connector.tableOperations().cancelCompaction(tableName);
 
-    Scanner scanner = connector.createScanner(tableName, Authorizations.EMPTY);
-    Map<Key,Value> actual = new TreeMap<>();
-    for (Map.Entry<Key,Value> entry : scanner)
-      actual.put(entry.getKey(), entry.getValue());
-    assertTrue("Should be empty. Actual is " + actual, actual.isEmpty());
-    connector.tableOperations().delete(tableName);
+    try (Scanner scanner = connector.createScanner(tableName, Authorizations.EMPTY)) {
+      Map<Key,Value> actual = new TreeMap<>();
+      for (Map.Entry<Key,Value> entry : scanner)
+        actual.put(entry.getKey(), entry.getValue());
+      assertTrue("Should be empty. Actual is " + actual, actual.isEmpty());
+      connector.tableOperations().delete(tableName);
+    }
   }
 
 }
diff --git a/test/src/main/java/org/apache/accumulo/test/TestBinaryRows.java b/test/src/main/java/org/apache/accumulo/test/TestBinaryRows.java
index a7f151dea7..e53b78c2fa 100644
--- a/test/src/main/java/org/apache/accumulo/test/TestBinaryRows.java
+++ b/test/src/main/java/org/apache/accumulo/test/TestBinaryRows.java
@@ -104,46 +104,46 @@ public static void runTest(Connector connector, Opts opts, BatchWriterOpts bwOpt
 
       bw.close();
     } else if (opts.mode.equals("verifyDeleted")) {
-      Scanner s = connector.createScanner(opts.getTableName(), opts.auths);
-      s.setBatchSize(scanOpts.scanBatchSize);
-      Key startKey = new Key(encodeLong(opts.start), CF_BYTES, CQ_BYTES, new byte[0], Long.MAX_VALUE);
-      Key stopKey = new Key(encodeLong(opts.start + opts.num - 1), CF_BYTES, CQ_BYTES, new byte[0], 0);
-      s.setBatchSize(50000);
-      s.setRange(new Range(startKey, stopKey));
-
-      for (Entry<Key,Value> entry : s) {
-        throw new Exception("ERROR : saw entries in range that should be deleted ( first value : " + entry.getValue().toString() + ")");
-      }
+      try (Scanner s = connector.createScanner(opts.getTableName(), opts.auths)) {
+        s.setBatchSize(scanOpts.scanBatchSize);
+        Key startKey = new Key(encodeLong(opts.start), CF_BYTES, CQ_BYTES, new byte[0], Long.MAX_VALUE);
+        Key stopKey = new Key(encodeLong(opts.start + opts.num - 1), CF_BYTES, CQ_BYTES, new byte[0], 0);
+        s.setBatchSize(50000);
+        s.setRange(new Range(startKey, stopKey));
 
+        for (Entry<Key,Value> entry : s) {
+          throw new Exception("ERROR : saw entries in range that should be deleted ( first value : " + entry.getValue().toString() + ")");
+        }
+      }
     } else if (opts.mode.equals("verify")) {
       long t1 = System.currentTimeMillis();
 
-      Scanner s = connector.createScanner(opts.getTableName(), opts.auths);
-      Key startKey = new Key(encodeLong(opts.start), CF_BYTES, CQ_BYTES, new byte[0], Long.MAX_VALUE);
-      Key stopKey = new Key(encodeLong(opts.start + opts.num - 1), CF_BYTES, CQ_BYTES, new byte[0], 0);
-      s.setBatchSize(scanOpts.scanBatchSize);
-      s.setRange(new Range(startKey, stopKey));
-
-      long i = opts.start;
+      try (Scanner s = connector.createScanner(opts.getTableName(), opts.auths)) {
+        Key startKey = new Key(encodeLong(opts.start), CF_BYTES, CQ_BYTES, new byte[0], Long.MAX_VALUE);
+        Key stopKey = new Key(encodeLong(opts.start + opts.num - 1), CF_BYTES, CQ_BYTES, new byte[0], 0);
+        s.setBatchSize(scanOpts.scanBatchSize);
+        s.setRange(new Range(startKey, stopKey));
 
-      for (Entry<Key,Value> e : s) {
-        Key k = e.getKey();
-        Value v = e.getValue();
+        long i = opts.start;
 
-        checkKeyValue(i, k, v);
+        for (Entry<Key,Value> e : s) {
+          Key k = e.getKey();
+          Value v = e.getValue();
 
-        i++;
-      }
+          checkKeyValue(i, k, v);
 
-      if (i != opts.start + opts.num) {
-        throw new Exception("ERROR : did not see expected number of rows, saw " + (i - opts.start) + " expected " + opts.num);
-      }
+          i++;
+        }
 
-      long t2 = System.currentTimeMillis();
+        if (i != opts.start + opts.num) {
+          throw new Exception("ERROR : did not see expected number of rows, saw " + (i - opts.start) + " expected " + opts.num);
+        }
 
-      System.out.printf("time : %9.2f secs%n", ((t2 - t1) / 1000.0));
-      System.out.printf("rate : %9.2f entries/sec%n", opts.num / ((t2 - t1) / 1000.0));
+        long t2 = System.currentTimeMillis();
 
+        System.out.printf("time : %9.2f secs%n", ((t2 - t1) / 1000.0));
+        System.out.printf("rate : %9.2f entries/sec%n", opts.num / ((t2 - t1) / 1000.0));
+      }
     } else if (opts.mode.equals("randomLookups")) {
       int numLookups = 1000;
 
@@ -154,27 +154,28 @@ public static void runTest(Connector connector, Opts opts, BatchWriterOpts bwOpt
       for (int i = 0; i < numLookups; i++) {
         long row = ((r.nextLong() & 0x7fffffffffffffffl) % opts.num) + opts.start;
 
-        Scanner s = connector.createScanner(opts.getTableName(), opts.auths);
-        s.setBatchSize(scanOpts.scanBatchSize);
-        Key startKey = new Key(encodeLong(row), CF_BYTES, CQ_BYTES, new byte[0], Long.MAX_VALUE);
-        Key stopKey = new Key(encodeLong(row), CF_BYTES, CQ_BYTES, new byte[0], 0);
-        s.setRange(new Range(startKey, stopKey));
+        try (Scanner s = connector.createScanner(opts.getTableName(), opts.auths)) {
+          s.setBatchSize(scanOpts.scanBatchSize);
+          Key startKey = new Key(encodeLong(row), CF_BYTES, CQ_BYTES, new byte[0], Long.MAX_VALUE);
+          Key stopKey = new Key(encodeLong(row), CF_BYTES, CQ_BYTES, new byte[0], 0);
+          s.setRange(new Range(startKey, stopKey));
 
-        Iterator<Entry<Key,Value>> si = s.iterator();
+          Iterator<Entry<Key,Value>> si = s.iterator();
 
-        if (si.hasNext()) {
-          Entry<Key,Value> e = si.next();
-          Key k = e.getKey();
-          Value v = e.getValue();
+          if (si.hasNext()) {
+            Entry<Key,Value> e = si.next();
+            Key k = e.getKey();
+            Value v = e.getValue();
 
-          checkKeyValue(row, k, v);
+            checkKeyValue(row, k, v);
 
-          if (si.hasNext()) {
-            throw new Exception("ERROR : lookup on " + row + " returned more than one result ");
-          }
+            if (si.hasNext()) {
+              throw new Exception("ERROR : lookup on " + row + " returned more than one result ");
+            }
 
-        } else {
-          throw new Exception("ERROR : lookup on " + row + " failed ");
+          } else {
+            throw new Exception("ERROR : lookup on " + row + " failed ");
+          }
         }
       }
 
diff --git a/test/src/main/java/org/apache/accumulo/test/TestMultiTableIngest.java b/test/src/main/java/org/apache/accumulo/test/TestMultiTableIngest.java
index ae37430b07..e62299722a 100644
--- a/test/src/main/java/org/apache/accumulo/test/TestMultiTableIngest.java
+++ b/test/src/main/java/org/apache/accumulo/test/TestMultiTableIngest.java
@@ -58,16 +58,17 @@ private static void readBack(Opts opts, ScannerOpts scanOpts, Connector conn, Li
       // wait for table to exist
       while (!conn.tableOperations().exists(table))
         UtilWaitThread.sleep(100);
-      Scanner scanner = conn.createScanner(table, opts.auths);
-      scanner.setBatchSize(scanOpts.scanBatchSize);
-      int count = i;
-      for (Entry<Key,Value> elt : scanner) {
-        String expected = String.format("%06d", count);
-        if (!elt.getKey().getRow().toString().equals(expected))
-          throw new RuntimeException("entry " + elt + " does not match expected " + expected + " in table " + table);
-        count += tableNames.size();
+      try (Scanner scanner = conn.createScanner(table, opts.auths)) {
+        scanner.setBatchSize(scanOpts.scanBatchSize);
+        int count = i;
+        for (Entry<Key,Value> elt : scanner) {
+          String expected = String.format("%06d", count);
+          if (!elt.getKey().getRow().toString().equals(expected))
+            throw new RuntimeException("entry " + elt + " does not match expected " + expected + " in table " + table);
+          count += tableNames.size();
+        }
+        i++;
       }
-      i++;
     }
   }
 
diff --git a/test/src/main/java/org/apache/accumulo/test/TestRandomDeletes.java b/test/src/main/java/org/apache/accumulo/test/TestRandomDeletes.java
index 05202267fa..ccdcae7d06 100644
--- a/test/src/main/java/org/apache/accumulo/test/TestRandomDeletes.java
+++ b/test/src/main/java/org/apache/accumulo/test/TestRandomDeletes.java
@@ -81,13 +81,14 @@ public String toString() {
   private static TreeSet<RowColumn> scanAll(ClientOnDefaultTable opts, ScannerOpts scanOpts, String tableName) throws Exception {
     TreeSet<RowColumn> result = new TreeSet<>();
     Connector conn = opts.getConnector();
-    Scanner scanner = conn.createScanner(tableName, auths);
-    scanner.setBatchSize(scanOpts.scanBatchSize);
-    for (Entry<Key,Value> entry : scanner) {
-      Key key = entry.getKey();
-      Column column = new Column(TextUtil.getBytes(key.getColumnFamily()), TextUtil.getBytes(key.getColumnQualifier()), TextUtil.getBytes(key
-          .getColumnVisibility()));
-      result.add(new RowColumn(key.getRow(), column, key.getTimestamp()));
+    try (Scanner scanner = conn.createScanner(tableName, auths)) {
+      scanner.setBatchSize(scanOpts.scanBatchSize);
+      for (Entry<Key,Value> entry : scanner) {
+        Key key = entry.getKey();
+        Column column = new Column(TextUtil.getBytes(key.getColumnFamily()), TextUtil.getBytes(key.getColumnQualifier()), TextUtil.getBytes(key
+            .getColumnVisibility()));
+        result.add(new RowColumn(key.getRow(), column, key.getTimestamp()));
+      }
     }
     return result;
   }
diff --git a/test/src/main/java/org/apache/accumulo/test/TracerRecoversAfterOfflineTableIT.java b/test/src/main/java/org/apache/accumulo/test/TracerRecoversAfterOfflineTableIT.java
index ebc7686f56..e3734b13e3 100644
--- a/test/src/main/java/org/apache/accumulo/test/TracerRecoversAfterOfflineTableIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/TracerRecoversAfterOfflineTableIT.java
@@ -90,39 +90,40 @@ public void test() throws Exception {
 
     log.info("Trace table is online, should be able to find trace");
 
-    final Scanner scanner = conn.createScanner("trace", Authorizations.EMPTY);
-    scanner.setRange(new Range(new Text(Long.toHexString(root.traceId()))));
-    while (true) {
-      final StringBuilder finalBuffer = new StringBuilder();
-      int traceCount = TraceDump.printTrace(scanner, new Printer() {
-        @Override
-        public void print(final String line) {
-          try {
-            finalBuffer.append(line).append("\n");
-          } catch (Exception ex) {
-            throw new RuntimeException(ex);
+    try (Scanner scanner = conn.createScanner("trace", Authorizations.EMPTY)) {
+      scanner.setRange(new Range(new Text(Long.toHexString(root.traceId()))));
+      while (true) {
+        final StringBuilder finalBuffer = new StringBuilder();
+        int traceCount = TraceDump.printTrace(scanner, new Printer() {
+          @Override
+          public void print(final String line) {
+            try {
+              finalBuffer.append(line).append("\n");
+            } catch (Exception ex) {
+              throw new RuntimeException(ex);
+            }
           }
+        });
+        String traceOutput = finalBuffer.toString();
+        log.info("Trace output:{}", traceOutput);
+        if (traceCount > 0) {
+          int lastPos = 0;
+          for (String part : "traceTest,close,binMutations".split(",")) {
+            log.info("Looking in trace output for '{}'", part);
+            int pos = traceOutput.indexOf(part);
+            assertTrue("Did not find '" + part + "' in output", pos > 0);
+            assertTrue("'" + part + "' occurred earlier than the previous element unexpectedly", pos > lastPos);
+            lastPos = pos;
+          }
+          break;
+        } else {
+          log.info("Ignoring trace output as traceCount not greater than zero: {}", traceCount);
+          Thread.sleep(1000);
         }
-      });
-      String traceOutput = finalBuffer.toString();
-      log.info("Trace output:{}", traceOutput);
-      if (traceCount > 0) {
-        int lastPos = 0;
-        for (String part : "traceTest,close,binMutations".split(",")) {
-          log.info("Looking in trace output for '{}'", part);
-          int pos = traceOutput.indexOf(part);
-          assertTrue("Did not find '" + part + "' in output", pos > 0);
-          assertTrue("'" + part + "' occurred earlier than the previous element unexpectedly", pos > lastPos);
-          lastPos = pos;
-        }
-        break;
-      } else {
-        log.info("Ignoring trace output as traceCount not greater than zero: {}", traceCount);
-        Thread.sleep(1000);
       }
-    }
-    if (tracer != null) {
-      tracer.destroy();
+      if (tracer != null) {
+        tracer.destroy();
+      }
     }
   }
 
diff --git a/test/src/main/java/org/apache/accumulo/test/UnusedWALIT.java b/test/src/main/java/org/apache/accumulo/test/UnusedWALIT.java
index 281c3587bf..26975bb8e5 100644
--- a/test/src/main/java/org/apache/accumulo/test/UnusedWALIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/UnusedWALIT.java
@@ -109,22 +109,23 @@ public void test() throws Exception {
   }
 
   private void scanSomeData(Connector c, String table, int startRow, int rowCount, int startCol, int colCount) throws Exception {
-    Scanner s = c.createScanner(table, Authorizations.EMPTY);
-    s.setRange(new Range(Integer.toHexString(startRow), Integer.toHexString(startRow + rowCount)));
-    int row = startRow;
-    int col = startCol;
-    for (Entry<Key,Value> entry : s) {
-      assertEquals(row, Integer.parseInt(entry.getKey().getRow().toString(), 16));
-      assertEquals(col++, Integer.parseInt(entry.getKey().getColumnQualifier().toString(), 16));
-      if (col == startCol + colCount) {
-        col = startCol;
-        row++;
-        if (row == startRow + rowCount) {
-          break;
+    try (Scanner s = c.createScanner(table, Authorizations.EMPTY)) {
+      s.setRange(new Range(Integer.toHexString(startRow), Integer.toHexString(startRow + rowCount)));
+      int row = startRow;
+      int col = startCol;
+      for (Entry<Key,Value> entry : s) {
+        assertEquals(row, Integer.parseInt(entry.getKey().getRow().toString(), 16));
+        assertEquals(col++, Integer.parseInt(entry.getKey().getColumnQualifier().toString(), 16));
+        if (col == startCol + colCount) {
+          col = startCol;
+          row++;
+          if (row == startRow + rowCount) {
+            break;
+          }
         }
       }
+      assertEquals(row, startRow + rowCount);
     }
-    assertEquals(row, startRow + rowCount);
   }
 
   private int getWALCount(Instance i, ZooReaderWriter zk) throws Exception {
diff --git a/test/src/main/java/org/apache/accumulo/test/UserCompactionStrategyIT.java b/test/src/main/java/org/apache/accumulo/test/UserCompactionStrategyIT.java
index ddf8ad760e..2b158f4dff 100644
--- a/test/src/main/java/org/apache/accumulo/test/UserCompactionStrategyIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/UserCompactionStrategyIT.java
@@ -295,12 +295,11 @@ void writeRandomValue(Connector c, String tableName, int size) throws Exception
 
   private Set<String> getRows(Connector c, String tableName) throws TableNotFoundException {
     Set<String> rows = new HashSet<>();
-    Scanner scanner = c.createScanner(tableName, Authorizations.EMPTY);
-
-    for (Entry<Key,Value> entry : scanner)
-      rows.add(entry.getKey().getRowData().toString());
+    try (Scanner scanner = c.createScanner(tableName, Authorizations.EMPTY)) {
+      for (Entry<Key,Value> entry : scanner)
+        rows.add(entry.getKey().getRowData().toString());
+    }
     return rows;
-
   }
 
   private void writeFlush(Connector conn, String tablename, String row) throws Exception {
diff --git a/test/src/main/java/org/apache/accumulo/test/VerifyIngest.java b/test/src/main/java/org/apache/accumulo/test/VerifyIngest.java
index 254801f397..e3b71575ce 100644
--- a/test/src/main/java/org/apache/accumulo/test/VerifyIngest.java
+++ b/test/src/main/java/org/apache/accumulo/test/VerifyIngest.java
@@ -105,118 +105,118 @@ public static void verifyIngest(Connector connector, Opts opts, ScannerOpts scan
         Text colf = new Text(opts.columnFamily);
         Text colq = new Text("col_" + String.format("%07d", expectedCol));
 
-        Scanner scanner = connector.createScanner("test_ingest", labelAuths);
-        scanner.setBatchSize(1);
-        Key startKey = new Key(rowKey, colf, colq);
-        Range range = new Range(startKey, startKey.followingKey(PartialKey.ROW_COLFAM_COLQUAL));
-        scanner.setRange(range);
+        try (Scanner scanner = connector.createScanner("test_ingest", labelAuths)) {
+          scanner.setBatchSize(1);
+          Key startKey = new Key(rowKey, colf, colq);
+          Range range = new Range(startKey, startKey.followingKey(PartialKey.ROW_COLFAM_COLQUAL));
+          scanner.setRange(range);
 
-        byte[] val = null; // t.get(rowKey, column);
+          byte[] val = null; // t.get(rowKey, column);
 
-        Iterator<Entry<Key,Value>> iter = scanner.iterator();
+          Iterator<Entry<Key,Value>> iter = scanner.iterator();
 
-        if (iter.hasNext()) {
-          val = iter.next().getValue().get();
-        }
+          if (iter.hasNext()) {
+            val = iter.next().getValue().get();
+          }
 
-        byte ev[];
-        if (opts.random != null) {
-          ev = TestIngest.genRandomValue(random, randomValue, opts.random.intValue(), expectedRow, expectedCol);
-        } else {
-          ev = bytevals[expectedCol % bytevals.length];
-        }
+          byte ev[];
+          if (opts.random != null) {
+            ev = TestIngest.genRandomValue(random, randomValue, opts.random.intValue(), expectedRow, expectedCol);
+          } else {
+            ev = bytevals[expectedCol % bytevals.length];
+          }
 
-        if (val == null) {
-          log.error("Did not find {} {} {}", rowKey, colf, colq);
-          errors++;
-        } else {
-          recsRead++;
-          bytesRead += val.length;
-          Value value = new Value(val);
-          if (value.compareTo(ev) != 0) {
-            log.error("unexpected value  ({} {} {} : saw {} expected {}", rowKey, colf, colq, value, new Value(ev));
+          if (val == null) {
+            log.error("Did not find {} {} {}", rowKey, colf, colq);
             errors++;
+          } else {
+            recsRead++;
+            bytesRead += val.length;
+            Value value = new Value(val);
+            if (value.compareTo(ev) != 0) {
+              log.error("unexpected value  ({} {} {} : saw {} expected {}", rowKey, colf, colq, value, new Value(ev));
+              errors++;
+            }
           }
-        }
 
-        expectedCol++;
-        if (expectedCol >= opts.cols) {
-          expectedCol = 0;
-          expectedRow++;
+          expectedCol++;
+          if (expectedCol >= opts.cols) {
+            expectedCol = 0;
+            expectedRow++;
+          }
         }
-
       } else {
 
         Key startKey = new Key(new Text("row_" + String.format("%010d", expectedRow)));
 
-        Scanner scanner = connector.createScanner(opts.getTableName(), labelAuths);
-        scanner.setBatchSize(scanOpts.scanBatchSize);
-        scanner.setRange(new Range(startKey, endKey));
-        for (int j = 0; j < opts.cols; j++) {
-          scanner.fetchColumn(new Text(opts.columnFamily), new Text("col_" + String.format("%07d", j)));
-        }
+        try (Scanner scanner = connector.createScanner(opts.getTableName(), labelAuths)) {
+          scanner.setBatchSize(scanOpts.scanBatchSize);
+          scanner.setRange(new Range(startKey, endKey));
+          for (int j = 0; j < opts.cols; j++) {
+            scanner.fetchColumn(new Text(opts.columnFamily), new Text("col_" + String.format("%07d", j)));
+          }
 
-        int recsReadBefore = recsRead;
+          int recsReadBefore = recsRead;
 
-        for (Entry<Key,Value> entry : scanner) {
+          for (Entry<Key,Value> entry : scanner) {
 
-          recsRead++;
+            recsRead++;
 
-          bytesRead += entry.getKey().getLength();
-          bytesRead += entry.getValue().getSize();
+            bytesRead += entry.getKey().getLength();
+            bytesRead += entry.getValue().getSize();
 
-          int rowNum = getRow(entry.getKey());
-          int colNum = getCol(entry.getKey());
+            int rowNum = getRow(entry.getKey());
+            int colNum = getCol(entry.getKey());
 
-          if (rowNum != expectedRow) {
-            log.error("rowNum != expectedRow   {} != {}", rowNum, expectedRow);
-            errors++;
-            expectedRow = rowNum;
-          }
+            if (rowNum != expectedRow) {
+              log.error("rowNum != expectedRow   {} != {}", rowNum, expectedRow);
+              errors++;
+              expectedRow = rowNum;
+            }
 
-          if (colNum != expectedCol) {
-            log.error("colNum != expectedCol  {} != {}  rowNum : {}", colNum, expectedCol, rowNum);
-            errors++;
-          }
+            if (colNum != expectedCol) {
+              log.error("colNum != expectedCol  {} != {}  rowNum : {}", colNum, expectedCol, rowNum);
+              errors++;
+            }
 
-          if (expectedRow >= (opts.rows + opts.startRow)) {
-            log.error("expectedRow ({}) >= (ingestArgs.rows + ingestArgs.startRow)  ({}), get batch returned data passed end key", expectedRow,
-                (opts.rows + opts.startRow));
-            errors++;
-            break;
-          }
+            if (expectedRow >= (opts.rows + opts.startRow)) {
+              log.error("expectedRow ({}) >= (ingestArgs.rows + ingestArgs.startRow)  ({}), get batch returned data passed end key", expectedRow,
+                  (opts.rows + opts.startRow));
+              errors++;
+              break;
+            }
 
-          byte value[];
-          if (opts.random != null) {
-            value = TestIngest.genRandomValue(random, randomValue, opts.random.intValue(), expectedRow, colNum);
-          } else {
-            value = bytevals[colNum % bytevals.length];
-          }
+            byte value[];
+            if (opts.random != null) {
+              value = TestIngest.genRandomValue(random, randomValue, opts.random.intValue(), expectedRow, colNum);
+            } else {
+              value = bytevals[colNum % bytevals.length];
+            }
 
-          if (entry.getValue().compareTo(value) != 0) {
-            log.error("unexpected value, rowNum : {} colNum : {}", rowNum, colNum);
-            log.error(" saw = {} expected = {}", new String(entry.getValue().get()), new String(value));
-            errors++;
-          }
+            if (entry.getValue().compareTo(value) != 0) {
+              log.error("unexpected value, rowNum : {} colNum : {}", rowNum, colNum);
+              log.error(" saw = {} expected = {}", new String(entry.getValue().get()), new String(value));
+              errors++;
+            }
 
-          if (opts.timestamp >= 0 && entry.getKey().getTimestamp() != opts.timestamp) {
-            log.error("unexpected timestamp {}, rowNum : {} colNum : {}", entry.getKey().getTimestamp(), rowNum, colNum);
-            errors++;
-          }
+            if (opts.timestamp >= 0 && entry.getKey().getTimestamp() != opts.timestamp) {
+              log.error("unexpected timestamp {}, rowNum : {} colNum : {}", entry.getKey().getTimestamp(), rowNum, colNum);
+              errors++;
+            }
 
-          expectedCol++;
-          if (expectedCol >= opts.cols) {
-            expectedCol = 0;
-            expectedRow++;
-          }
+            expectedCol++;
+            if (expectedCol >= opts.cols) {
+              expectedCol = 0;
+              expectedRow++;
+            }
 
-        }
+          }
 
-        if (recsRead == recsReadBefore) {
-          log.warn("Scan returned nothing, breaking...");
-          break;
+          if (recsRead == recsReadBefore) {
+            log.warn("Scan returned nothing, breaking...");
+            break;
+          }
         }
-
       }
     }
 
diff --git a/test/src/main/java/org/apache/accumulo/test/VolumeChooserIT.java b/test/src/main/java/org/apache/accumulo/test/VolumeChooserIT.java
index 2b72ed8e0e..0d472009c0 100644
--- a/test/src/main/java/org/apache/accumulo/test/VolumeChooserIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/VolumeChooserIT.java
@@ -133,10 +133,11 @@ public static void writeAndReadData(Connector connector, String tableName) throw
 
     // Write the data to disk, read it back
     connector.tableOperations().flush(tableName, null, null, true);
-    Scanner scanner = connector.createScanner(tableName, Authorizations.EMPTY);
-    int i = 0;
-    for (Entry<Key,Value> entry : scanner) {
-      assertEquals("Data read is not data written", rows[i++], entry.getKey().getRow().toString());
+    try (Scanner scanner = connector.createScanner(tableName, Authorizations.EMPTY)) {
+      int i = 0;
+      for (Entry<Key,Value> entry : scanner) {
+        assertEquals("Data read is not data written", rows[i++], entry.getKey().getRow().toString());
+      }
     }
   }
 
@@ -158,31 +159,33 @@ public static void verifyVolumes(Connector connector, String tableName, Range ta
       volumes.add(s);
 
     TreeSet<String> volumesSeen = new TreeSet<>();
-    Scanner scanner = connector.createScanner(MetadataTable.NAME, Authorizations.EMPTY);
-    scanner.setRange(tableRange);
-    scanner.fetchColumnFamily(DataFileColumnFamily.NAME);
     int fileCount = 0;
-    for (Entry<Key,Value> entry : scanner) {
-      boolean inVolume = false;
-      for (String volume : volumes) {
-        if (entry.getKey().getColumnQualifier().toString().contains(volume)) {
-          volumesSeen.add(volume);
-          inVolume = true;
+    try (Scanner scanner = connector.createScanner(MetadataTable.NAME, Authorizations.EMPTY)) {
+      scanner.setRange(tableRange);
+      scanner.fetchColumnFamily(DataFileColumnFamily.NAME);
+      for (Entry<Key,Value> entry : scanner) {
+        boolean inVolume = false;
+        for (String volume : volumes) {
+          if (entry.getKey().getColumnQualifier().toString().contains(volume)) {
+            volumesSeen.add(volume);
+            inVolume = true;
+          }
         }
+        assertTrue("Data not written to the correct volumes.  " + entry.getKey().getColumnQualifier().toString(), inVolume);
+        fileCount++;
       }
-      assertTrue("Data not written to the correct volumes.  " + entry.getKey().getColumnQualifier().toString(), inVolume);
-      fileCount++;
     }
     assertEquals("Did not see all the volumes. volumes: " + volumes.toString() + " volumes seen: " + volumesSeen.toString(), volumes.size(), volumesSeen.size());
     assertEquals("Wrong number of files", 26, fileCount);
   }
 
   public static void verifyNoVolumes(Connector connector, String tableName, Range tableRange) throws Exception {
-    Scanner scanner = connector.createScanner(MetadataTable.NAME, Authorizations.EMPTY);
-    scanner.setRange(tableRange);
-    scanner.fetchColumnFamily(DataFileColumnFamily.NAME);
-    for (Entry<Key,Value> entry : scanner) {
-      fail("Data incorrectly written to " + entry.getKey().getColumnQualifier().toString());
+    try (Scanner scanner = connector.createScanner(MetadataTable.NAME, Authorizations.EMPTY)) {
+      scanner.setRange(tableRange);
+      scanner.fetchColumnFamily(DataFileColumnFamily.NAME);
+      for (Entry<Key,Value> entry : scanner) {
+        fail("Data incorrectly written to " + entry.getKey().getColumnQualifier().toString());
+      }
     }
   }
 
@@ -214,17 +217,18 @@ public static void verifyWaLogVolumes(Connector connector, Range tableRange, Str
       volumes.add(s);
 
     TreeSet<String> volumesSeen = new TreeSet<>();
-    Scanner scanner = connector.createScanner(MetadataTable.NAME, Authorizations.EMPTY);
-    scanner.setRange(tableRange);
-    scanner.fetchColumnFamily(TabletsSection.LogColumnFamily.NAME);
-    for (Entry<Key,Value> entry : scanner) {
-      boolean inVolume = false;
-      for (String volume : volumes) {
-        if (entry.getKey().getColumnQualifier().toString().contains(volume))
-          volumesSeen.add(volume);
-        inVolume = true;
+    try (Scanner scanner = connector.createScanner(MetadataTable.NAME, Authorizations.EMPTY)) {
+      scanner.setRange(tableRange);
+      scanner.fetchColumnFamily(TabletsSection.LogColumnFamily.NAME);
+      for (Entry<Key,Value> entry : scanner) {
+        boolean inVolume = false;
+        for (String volume : volumes) {
+          if (entry.getKey().getColumnQualifier().toString().contains(volume))
+            volumesSeen.add(volume);
+          inVolume = true;
+        }
+        assertTrue("Data not written to the correct volumes.  " + entry.getKey().getColumnQualifier().toString(), inVolume);
       }
-      assertTrue("Data not written to the correct volumes.  " + entry.getKey().getColumnQualifier().toString(), inVolume);
     }
   }
 
diff --git a/test/src/main/java/org/apache/accumulo/test/VolumeIT.java b/test/src/main/java/org/apache/accumulo/test/VolumeIT.java
index d8073e17f5..69fd79470a 100644
--- a/test/src/main/java/org/apache/accumulo/test/VolumeIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/VolumeIT.java
@@ -140,29 +140,31 @@ public void test() throws Exception {
     bw.close();
     // write the data to disk, read it back
     connector.tableOperations().flush(tableName, null, null, true);
-    Scanner scanner = connector.createScanner(tableName, Authorizations.EMPTY);
-    int i = 0;
-    for (Entry<Key,Value> entry : scanner) {
-      assertEquals(rows[i++], entry.getKey().getRow().toString());
+    try (Scanner scanner = connector.createScanner(tableName, Authorizations.EMPTY)) {
+      int i = 0;
+      for (Entry<Key,Value> entry : scanner) {
+        assertEquals(rows[i++], entry.getKey().getRow().toString());
+      }
     }
     // verify the new files are written to the different volumes
-    scanner = connector.createScanner(MetadataTable.NAME, Authorizations.EMPTY);
-    scanner.setRange(new Range("1", "1<"));
-    scanner.fetchColumnFamily(DataFileColumnFamily.NAME);
-    int fileCount = 0;
-
-    for (Entry<Key,Value> entry : scanner) {
-      boolean inV1 = entry.getKey().getColumnQualifier().toString().contains(v1.toString());
-      boolean inV2 = entry.getKey().getColumnQualifier().toString().contains(v2.toString());
-      assertTrue(inV1 || inV2);
-      fileCount++;
+    try (Scanner scanner = connector.createScanner(MetadataTable.NAME, Authorizations.EMPTY)) {
+      scanner.setRange(new Range("1", "1<"));
+      scanner.fetchColumnFamily(DataFileColumnFamily.NAME);
+      int fileCount = 0;
+
+      for (Entry<Key,Value> entry : scanner) {
+        boolean inV1 = entry.getKey().getColumnQualifier().toString().contains(v1.toString());
+        boolean inV2 = entry.getKey().getColumnQualifier().toString().contains(v2.toString());
+        assertTrue(inV1 || inV2);
+        fileCount++;
+      }
+      assertEquals(4, fileCount);
+      List<DiskUsage> diskUsage = connector.tableOperations().getDiskUsage(Collections.singleton(tableName));
+      assertEquals(1, diskUsage.size());
+      long usage = diskUsage.get(0).getUsage().longValue();
+      log.debug("usage {}", usage);
+      assertTrue(usage > 700 && usage < 800);
     }
-    assertEquals(4, fileCount);
-    List<DiskUsage> diskUsage = connector.tableOperations().getDiskUsage(Collections.singleton(tableName));
-    assertEquals(1, diskUsage.size());
-    long usage = diskUsage.get(0).getUsage().longValue();
-    log.debug("usage {}", usage);
-    assertTrue(usage > 700 && usage < 800);
   }
 
   private void verifyData(List<String> expected, Scanner createScanner) {
@@ -177,6 +179,7 @@ private void verifyData(List<String> expected, Scanner createScanner) {
     Collections.sort(expected);
     Collections.sort(actual);
 
+    createScanner.close();
     Assert.assertEquals(expected, actual);
   }
 
@@ -229,40 +232,40 @@ public void testRelativePaths() throws Exception {
 
     connector.securityOperations().grantTablePermission("root", MetadataTable.NAME, TablePermission.WRITE);
 
-    Scanner metaScanner = connector.createScanner(MetadataTable.NAME, Authorizations.EMPTY);
-    metaScanner.fetchColumnFamily(MetadataSchema.TabletsSection.DataFileColumnFamily.NAME);
-    metaScanner.setRange(new KeyExtent(tableId, null, null).toMetadataRange());
-
-    BatchWriter mbw = connector.createBatchWriter(MetadataTable.NAME, new BatchWriterConfig());
-
-    for (Entry<Key,Value> entry : metaScanner) {
-      String cq = entry.getKey().getColumnQualifier().toString();
-      if (cq.startsWith(v1.toString())) {
-        Path path = new Path(cq);
-        String relPath = "/" + path.getParent().getName() + "/" + path.getName();
-        Mutation fileMut = new Mutation(entry.getKey().getRow());
-        fileMut.putDelete(entry.getKey().getColumnFamily(), entry.getKey().getColumnQualifier());
-        fileMut.put(entry.getKey().getColumnFamily().toString(), relPath, entry.getValue().toString());
-        mbw.addMutation(fileMut);
+    try (Scanner metaScanner = connector.createScanner(MetadataTable.NAME, Authorizations.EMPTY)) {
+      metaScanner.fetchColumnFamily(MetadataSchema.TabletsSection.DataFileColumnFamily.NAME);
+      metaScanner.setRange(new KeyExtent(tableId, null, null).toMetadataRange());
+
+      BatchWriter mbw = connector.createBatchWriter(MetadataTable.NAME, new BatchWriterConfig());
+
+      for (Entry<Key,Value> entry : metaScanner) {
+        String cq = entry.getKey().getColumnQualifier().toString();
+        if (cq.startsWith(v1.toString())) {
+          Path path = new Path(cq);
+          String relPath = "/" + path.getParent().getName() + "/" + path.getName();
+          Mutation fileMut = new Mutation(entry.getKey().getRow());
+          fileMut.putDelete(entry.getKey().getColumnFamily(), entry.getKey().getColumnQualifier());
+          fileMut.put(entry.getKey().getColumnFamily().toString(), relPath, entry.getValue().toString());
+          mbw.addMutation(fileMut);
+        }
       }
-    }
 
-    mbw.close();
+      mbw.close();
 
-    connector.tableOperations().online(tableName, true);
+      connector.tableOperations().online(tableName, true);
 
-    verifyData(expected, connector.createScanner(tableName, Authorizations.EMPTY));
+      verifyData(expected, connector.createScanner(tableName, Authorizations.EMPTY));
 
-    connector.tableOperations().compact(tableName, null, null, true, true);
+      connector.tableOperations().compact(tableName, null, null, true, true);
 
-    verifyData(expected, connector.createScanner(tableName, Authorizations.EMPTY));
+      verifyData(expected, connector.createScanner(tableName, Authorizations.EMPTY));
 
-    for (Entry<Key,Value> entry : metaScanner) {
-      String cq = entry.getKey().getColumnQualifier().toString();
-      Path path = new Path(cq);
-      Assert.assertTrue("relative path not deleted " + path.toString(), path.depth() > 2);
+      for (Entry<Key,Value> entry : metaScanner) {
+        String cq = entry.getKey().getColumnQualifier().toString();
+        Path path = new Path(cq);
+        Assert.assertTrue("relative path not deleted " + path.toString(), path.depth() > 2);
+      }
     }
-
   }
 
   @Test
@@ -405,70 +408,70 @@ private void verifyVolumesUsed(String tableName, boolean shouldExist, Path... pa
     verifyData(expected, conn.createScanner(tableName, Authorizations.EMPTY));
 
     Table.ID tableId = Table.ID.of(conn.tableOperations().tableIdMap().get(tableName));
-    Scanner metaScanner = conn.createScanner(MetadataTable.NAME, Authorizations.EMPTY);
-    MetadataSchema.TabletsSection.ServerColumnFamily.DIRECTORY_COLUMN.fetch(metaScanner);
-    metaScanner.fetchColumnFamily(MetadataSchema.TabletsSection.DataFileColumnFamily.NAME);
-    metaScanner.setRange(new KeyExtent(tableId, null, null).toMetadataRange());
-
-    int counts[] = new int[paths.length];
-
-    outer: for (Entry<Key,Value> entry : metaScanner) {
-      String cf = entry.getKey().getColumnFamily().toString();
-      String cq = entry.getKey().getColumnQualifier().toString();
-
-      String path;
-      if (cf.equals(MetadataSchema.TabletsSection.DataFileColumnFamily.NAME.toString()))
-        path = cq;
-      else
-        path = entry.getValue().toString();
-
-      for (int i = 0; i < paths.length; i++) {
-        if (path.startsWith(paths[i].toString())) {
-          counts[i]++;
-          continue outer;
+    try (Scanner metaScanner = conn.createScanner(MetadataTable.NAME, Authorizations.EMPTY)) {
+      MetadataSchema.TabletsSection.ServerColumnFamily.DIRECTORY_COLUMN.fetch(metaScanner);
+      metaScanner.fetchColumnFamily(MetadataSchema.TabletsSection.DataFileColumnFamily.NAME);
+      metaScanner.setRange(new KeyExtent(tableId, null, null).toMetadataRange());
+
+      int counts[] = new int[paths.length];
+
+      outer: for (Entry<Key,Value> entry : metaScanner) {
+        String cf = entry.getKey().getColumnFamily().toString();
+        String cq = entry.getKey().getColumnQualifier().toString();
+
+        String path;
+        if (cf.equals(MetadataSchema.TabletsSection.DataFileColumnFamily.NAME.toString()))
+          path = cq;
+        else
+          path = entry.getValue().toString();
+
+        for (int i = 0; i < paths.length; i++) {
+          if (path.startsWith(paths[i].toString())) {
+            counts[i]++;
+            continue outer;
+          }
         }
-      }
 
-      Assert.fail("Unexpected volume " + path);
-    }
+        Assert.fail("Unexpected volume " + path);
+      }
 
-    // keep retrying until WAL state information in ZooKeeper stabilizes or until test times out
-    retry: while (true) {
-      Instance i = conn.getInstance();
-      ZooReaderWriter zk = new ZooReaderWriter(i.getZooKeepers(), i.getZooKeepersSessionTimeOut(), "");
-      WalStateManager wals = new WalStateManager(i, zk);
-      try {
-        outer: for (Entry<Path,WalState> entry : wals.getAllState().entrySet()) {
-          for (Path path : paths) {
-            if (entry.getKey().toString().startsWith(path.toString())) {
-              continue outer;
+      // keep retrying until WAL state information in ZooKeeper stabilizes or until test times out
+      retry: while (true) {
+        Instance i = conn.getInstance();
+        ZooReaderWriter zk = new ZooReaderWriter(i.getZooKeepers(), i.getZooKeepersSessionTimeOut(), "");
+        WalStateManager wals = new WalStateManager(i, zk);
+        try {
+          outer: for (Entry<Path,WalState> entry : wals.getAllState().entrySet()) {
+            for (Path path : paths) {
+              if (entry.getKey().toString().startsWith(path.toString())) {
+                continue outer;
+              }
             }
+            log.warn("Unexpected volume " + entry.getKey() + " (" + entry.getValue() + ")");
+            continue retry;
           }
-          log.warn("Unexpected volume " + entry.getKey() + " (" + entry.getValue() + ")");
-          continue retry;
-        }
-      } catch (WalMarkerException e) {
-        Throwable cause = e.getCause();
-        if (cause instanceof NoNodeException) {
-          // ignore WALs being cleaned up
-          continue retry;
+        } catch (WalMarkerException e) {
+          Throwable cause = e.getCause();
+          if (cause instanceof NoNodeException) {
+            // ignore WALs being cleaned up
+            continue retry;
+          }
+          throw e;
         }
-        throw e;
+        break;
       }
-      break;
-    }
-
-    // if a volume is chosen randomly for each tablet, then the probability that a volume will not be chosen for any tablet is ((num_volumes -
-    // 1)/num_volumes)^num_tablets. For 100 tablets and 3 volumes the probability that only 2 volumes would be chosen is 2.46e-18
 
-    int sum = 0;
-    for (int count : counts) {
-      Assert.assertTrue(count > 0);
-      sum += count;
-    }
+      // if a volume is chosen randomly for each tablet, then the probability that a volume will not be chosen for any tablet is ((num_volumes -
+      // 1)/num_volumes)^num_tablets. For 100 tablets and 3 volumes the probability that only 2 volumes would be chosen is 2.46e-18
 
-    Assert.assertEquals(200, sum);
+      int sum = 0;
+      for (int count : counts) {
+        Assert.assertTrue(count > 0);
+        sum += count;
+      }
 
+      Assert.assertEquals(200, sum);
+    }
   }
 
   @Test
diff --git a/test/src/main/java/org/apache/accumulo/test/WaitForBalanceIT.java b/test/src/main/java/org/apache/accumulo/test/WaitForBalanceIT.java
index c6abbce23b..650df2e980 100644
--- a/test/src/main/java/org/apache/accumulo/test/WaitForBalanceIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/WaitForBalanceIT.java
@@ -71,26 +71,27 @@ private boolean isBalanced() throws Exception {
     int offline = 0;
     final Connector c = getConnector();
     for (String tableName : new String[] {MetadataTable.NAME, RootTable.NAME}) {
-      final Scanner s = c.createScanner(tableName, Authorizations.EMPTY);
-      s.setRange(MetadataSchema.TabletsSection.getRange());
-      s.fetchColumnFamily(MetadataSchema.TabletsSection.CurrentLocationColumnFamily.NAME);
-      MetadataSchema.TabletsSection.TabletColumnFamily.PREV_ROW_COLUMN.fetch(s);
-      String location = null;
-      for (Entry<Key,Value> entry : s) {
-        Key key = entry.getKey();
-        if (key.getColumnFamily().equals(MetadataSchema.TabletsSection.CurrentLocationColumnFamily.NAME)) {
-          location = key.getColumnQualifier().toString();
-        } else if (MetadataSchema.TabletsSection.TabletColumnFamily.PREV_ROW_COLUMN.hasColumns(key)) {
-          if (location == null) {
-            offline++;
-          } else {
-            Integer count = counts.get(location);
-            if (count == null)
-              count = Integer.valueOf(0);
-            count = Integer.valueOf(count.intValue() + 1);
-            counts.put(location, count);
+      try (Scanner s = c.createScanner(tableName, Authorizations.EMPTY)) {
+        s.setRange(MetadataSchema.TabletsSection.getRange());
+        s.fetchColumnFamily(MetadataSchema.TabletsSection.CurrentLocationColumnFamily.NAME);
+        MetadataSchema.TabletsSection.TabletColumnFamily.PREV_ROW_COLUMN.fetch(s);
+        String location = null;
+        for (Entry<Key,Value> entry : s) {
+          Key key = entry.getKey();
+          if (key.getColumnFamily().equals(MetadataSchema.TabletsSection.CurrentLocationColumnFamily.NAME)) {
+            location = key.getColumnQualifier().toString();
+          } else if (MetadataSchema.TabletsSection.TabletColumnFamily.PREV_ROW_COLUMN.hasColumns(key)) {
+            if (location == null) {
+              offline++;
+            } else {
+              Integer count = counts.get(location);
+              if (count == null)
+                count = Integer.valueOf(0);
+              count = Integer.valueOf(count.intValue() + 1);
+              counts.put(location, count);
+            }
+            location = null;
           }
-          location = null;
         }
       }
     }
diff --git a/test/src/main/java/org/apache/accumulo/test/YieldScannersIT.java b/test/src/main/java/org/apache/accumulo/test/YieldScannersIT.java
index 07a7c40f2d..f278624c3f 100644
--- a/test/src/main/java/org/apache/accumulo/test/YieldScannersIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/YieldScannersIT.java
@@ -75,36 +75,37 @@ public void testScan() throws Exception {
 
     log.info("Creating scanner");
     // make a scanner for a table with 10 keys
-    final Scanner scanner = conn.createScanner(tableName, Authorizations.EMPTY);
-    final IteratorSetting cfg = new IteratorSetting(100, YieldingIterator.class);
-    scanner.addScanIterator(cfg);
-
-    log.info("iterating");
-    Iterator<Map.Entry<Key,Value>> it = scanner.iterator();
-    int keyCount = 0;
-    int yieldNextCount = 0;
-    int yieldSeekCount = 0;
-    while (it.hasNext()) {
-      Map.Entry<Key,Value> next = it.next();
-      log.info(Integer.toString(keyCount) + ": Got key " + next.getKey() + " with value " + next.getValue());
-
-      // verify we got the expected key
-      char expected = (char) (START_ROW + keyCount);
-      Assert.assertEquals("Unexpected row", Character.toString(expected), next.getKey().getRow().toString());
-
-      // determine whether we yielded on a next and seek
-      if ((keyCount & 1) != 0) {
-        yieldNextCount++;
-        yieldSeekCount++;
+    try (Scanner scanner = conn.createScanner(tableName, Authorizations.EMPTY)) {
+      final IteratorSetting cfg = new IteratorSetting(100, YieldingIterator.class);
+      scanner.addScanIterator(cfg);
+
+      log.info("iterating");
+      Iterator<Map.Entry<Key,Value>> it = scanner.iterator();
+      int keyCount = 0;
+      int yieldNextCount = 0;
+      int yieldSeekCount = 0;
+      while (it.hasNext()) {
+        Map.Entry<Key,Value> next = it.next();
+        log.info(Integer.toString(keyCount) + ": Got key " + next.getKey() + " with value " + next.getValue());
+
+        // verify we got the expected key
+        char expected = (char) (START_ROW + keyCount);
+        Assert.assertEquals("Unexpected row", Character.toString(expected), next.getKey().getRow().toString());
+
+        // determine whether we yielded on a next and seek
+        if ((keyCount & 1) != 0) {
+          yieldNextCount++;
+          yieldSeekCount++;
+        }
+        String[] value = StringUtils.split(next.getValue().toString(), ',');
+        Assert.assertEquals("Unexpected yield next count", Integer.toString(yieldNextCount), value[0]);
+        Assert.assertEquals("Unexpected yield seek count", Integer.toString(yieldSeekCount), value[1]);
+        Assert.assertEquals("Unexpected rebuild count", Integer.toString(yieldNextCount + yieldSeekCount), value[2]);
+
+        keyCount++;
       }
-      String[] value = StringUtils.split(next.getValue().toString(), ',');
-      Assert.assertEquals("Unexpected yield next count", Integer.toString(yieldNextCount), value[0]);
-      Assert.assertEquals("Unexpected yield seek count", Integer.toString(yieldSeekCount), value[1]);
-      Assert.assertEquals("Unexpected rebuild count", Integer.toString(yieldNextCount + yieldSeekCount), value[2]);
-
-      keyCount++;
+      Assert.assertEquals("Did not get the expected number of results", 10, keyCount);
     }
-    Assert.assertEquals("Did not get the expected number of results", 10, keyCount);
   }
 
   @Test
@@ -125,37 +126,38 @@ public void testBatchScan() throws Exception {
 
     log.info("Creating batch scanner");
     // make a scanner for a table with 10 keys
-    final BatchScanner scanner = conn.createBatchScanner(tableName, Authorizations.EMPTY, 1);
-    final IteratorSetting cfg = new IteratorSetting(100, YieldingIterator.class);
-    scanner.addScanIterator(cfg);
-    scanner.setRanges(Collections.singleton(new Range()));
-
-    log.info("iterating");
-    Iterator<Map.Entry<Key,Value>> it = scanner.iterator();
-    int keyCount = 0;
-    int yieldNextCount = 0;
-    int yieldSeekCount = 0;
-    while (it.hasNext()) {
-      Map.Entry<Key,Value> next = it.next();
-      log.info(Integer.toString(keyCount) + ": Got key " + next.getKey() + " with value " + next.getValue());
-
-      // verify we got the expected key
-      char expected = (char) (START_ROW + keyCount);
-      Assert.assertEquals("Unexpected row", Character.toString(expected), next.getKey().getRow().toString());
-
-      // determine whether we yielded on a next and seek
-      if ((keyCount & 1) != 0) {
-        yieldNextCount++;
-        yieldSeekCount++;
+    try (BatchScanner scanner = conn.createBatchScanner(tableName, Authorizations.EMPTY, 1)) {
+      final IteratorSetting cfg = new IteratorSetting(100, YieldingIterator.class);
+      scanner.addScanIterator(cfg);
+      scanner.setRanges(Collections.singleton(new Range()));
+
+      log.info("iterating");
+      Iterator<Map.Entry<Key,Value>> it = scanner.iterator();
+      int keyCount = 0;
+      int yieldNextCount = 0;
+      int yieldSeekCount = 0;
+      while (it.hasNext()) {
+        Map.Entry<Key,Value> next = it.next();
+        log.info(Integer.toString(keyCount) + ": Got key " + next.getKey() + " with value " + next.getValue());
+
+        // verify we got the expected key
+        char expected = (char) (START_ROW + keyCount);
+        Assert.assertEquals("Unexpected row", Character.toString(expected), next.getKey().getRow().toString());
+
+        // determine whether we yielded on a next and seek
+        if ((keyCount & 1) != 0) {
+          yieldNextCount++;
+          yieldSeekCount++;
+        }
+        String[] value = StringUtils.split(next.getValue().toString(), ',');
+        Assert.assertEquals("Unexpected yield next count", Integer.toString(yieldNextCount), value[0]);
+        Assert.assertEquals("Unexpected yield seek count", Integer.toString(yieldSeekCount), value[1]);
+        Assert.assertEquals("Unexpected rebuild count", Integer.toString(yieldNextCount + yieldSeekCount), value[2]);
+
+        keyCount++;
       }
-      String[] value = StringUtils.split(next.getValue().toString(), ',');
-      Assert.assertEquals("Unexpected yield next count", Integer.toString(yieldNextCount), value[0]);
-      Assert.assertEquals("Unexpected yield seek count", Integer.toString(yieldSeekCount), value[1]);
-      Assert.assertEquals("Unexpected rebuild count", Integer.toString(yieldNextCount + yieldSeekCount), value[2]);
-
-      keyCount++;
+      Assert.assertEquals("Did not get the expected number of results", 10, keyCount);
     }
-    Assert.assertEquals("Did not get the expected number of results", 10, keyCount);
   }
 
 }
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/AddSplitIT.java b/test/src/main/java/org/apache/accumulo/test/functional/AddSplitIT.java
index 7c5babe889..c6222767ee 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/AddSplitIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/AddSplitIT.java
@@ -94,36 +94,36 @@ public void addSplitTest() throws Exception {
   }
 
   private void verifyData(String tableName, long ts) throws Exception {
-    Scanner scanner = getConnector().createScanner(tableName, Authorizations.EMPTY);
+    try (Scanner scanner = getConnector().createScanner(tableName, Authorizations.EMPTY)) {
 
-    Iterator<Entry<Key,Value>> iter = scanner.iterator();
+      Iterator<Entry<Key,Value>> iter = scanner.iterator();
 
-    for (int i = 0; i < 10000; i++) {
-      if (!iter.hasNext()) {
-        throw new Exception("row " + i + " not found");
-      }
+      for (int i = 0; i < 10000; i++) {
+        if (!iter.hasNext()) {
+          throw new Exception("row " + i + " not found");
+        }
 
-      Entry<Key,Value> entry = iter.next();
+        Entry<Key,Value> entry = iter.next();
 
-      String row = String.format("%09d", i);
+        String row = String.format("%09d", i);
 
-      if (!entry.getKey().getRow().equals(new Text(row))) {
-        throw new Exception("unexpected row " + entry.getKey() + " " + i);
-      }
+        if (!entry.getKey().getRow().equals(new Text(row))) {
+          throw new Exception("unexpected row " + entry.getKey() + " " + i);
+        }
 
-      if (entry.getKey().getTimestamp() != ts) {
-        throw new Exception("unexpected ts " + entry.getKey() + " " + ts);
-      }
+        if (entry.getKey().getTimestamp() != ts) {
+          throw new Exception("unexpected ts " + entry.getKey() + " " + ts);
+        }
 
-      if (Integer.parseInt(entry.getValue().toString()) != i) {
-        throw new Exception("unexpected value " + entry + " " + i);
+        if (Integer.parseInt(entry.getValue().toString()) != i) {
+          throw new Exception("unexpected value " + entry + " " + i);
+        }
       }
-    }
 
-    if (iter.hasNext()) {
-      throw new Exception("found more than expected " + iter.next());
+      if (iter.hasNext()) {
+        throw new Exception("found more than expected " + iter.next());
+      }
     }
-
   }
 
   private void insertData(String tableName, long ts) throws AccumuloException, AccumuloSecurityException, TableNotFoundException, MutationsRejectedException {
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/BadIteratorMincIT.java b/test/src/main/java/org/apache/accumulo/test/functional/BadIteratorMincIT.java
index 0d60cce2ec..8d0edb5ebc 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/BadIteratorMincIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/BadIteratorMincIT.java
@@ -68,41 +68,42 @@ public void test() throws Exception {
     FunctionalTestUtils.checkRFiles(c, tableName, 1, 1, 0, 0);
 
     // try to scan table
-    Scanner scanner = c.createScanner(tableName, Authorizations.EMPTY);
-    int count = Iterators.size(scanner.iterator());
-    assertEquals("Did not see expected # entries " + count, 1, count);
+    try (Scanner scanner = c.createScanner(tableName, Authorizations.EMPTY)) {
+      int count = Iterators.size(scanner.iterator());
+      assertEquals("Did not see expected # entries " + count, 1, count);
 
-    // remove the bad iterator
-    c.tableOperations().removeIterator(tableName, BadIterator.class.getSimpleName(), EnumSet.of(IteratorScope.minc));
+      // remove the bad iterator
+      c.tableOperations().removeIterator(tableName, BadIterator.class.getSimpleName(), EnumSet.of(IteratorScope.minc));
 
-    sleepUninterruptibly(5, TimeUnit.SECONDS);
+      sleepUninterruptibly(5, TimeUnit.SECONDS);
 
-    // minc should complete
-    FunctionalTestUtils.checkRFiles(c, tableName, 1, 1, 1, 1);
+      // minc should complete
+      FunctionalTestUtils.checkRFiles(c, tableName, 1, 1, 1, 1);
 
-    count = Iterators.size(scanner.iterator());
+      count = Iterators.size(scanner.iterator());
 
-    if (count != 1)
-      throw new Exception("Did not see expected # entries " + count);
+      if (count != 1)
+        throw new Exception("Did not see expected # entries " + count);
 
-    // now try putting bad iterator back and deleting the table
-    c.tableOperations().attachIterator(tableName, is, EnumSet.of(IteratorScope.minc));
-    bw = c.createBatchWriter(tableName, new BatchWriterConfig());
-    m = new Mutation(new Text("r2"));
-    m.put(new Text("acf"), new Text(tableName), new Value("1".getBytes(UTF_8)));
-    bw.addMutation(m);
-    bw.close();
+      // now try putting bad iterator back and deleting the table
+      c.tableOperations().attachIterator(tableName, is, EnumSet.of(IteratorScope.minc));
+      bw = c.createBatchWriter(tableName, new BatchWriterConfig());
+      m = new Mutation(new Text("r2"));
+      m.put(new Text("acf"), new Text(tableName), new Value("1".getBytes(UTF_8)));
+      bw.addMutation(m);
+      bw.close();
 
-    // make sure property is given time to propagate
-    sleepUninterruptibly(500, TimeUnit.MILLISECONDS);
+      // make sure property is given time to propagate
+      sleepUninterruptibly(500, TimeUnit.MILLISECONDS);
 
-    c.tableOperations().flush(tableName, null, null, false);
+      c.tableOperations().flush(tableName, null, null, false);
 
-    // make sure the flush has time to start
-    sleepUninterruptibly(1, TimeUnit.SECONDS);
+      // make sure the flush has time to start
+      sleepUninterruptibly(1, TimeUnit.SECONDS);
 
-    // this should not hang
-    c.tableOperations().delete(tableName);
+      // this should not hang
+      c.tableOperations().delete(tableName);
+    }
   }
 
 }
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/BatchScanSplitIT.java b/test/src/main/java/org/apache/accumulo/test/functional/BatchScanSplitIT.java
index a3add3de86..19a50aa8d8 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/BatchScanSplitIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/BatchScanSplitIT.java
@@ -102,25 +102,25 @@ public void test() throws Exception {
     HashMap<Text,Value> found = new HashMap<>();
 
     for (int i = 0; i < 20; i++) {
-      BatchScanner bs = getConnector().createBatchScanner(tableName, Authorizations.EMPTY, 4);
+      try (BatchScanner bs = getConnector().createBatchScanner(tableName, Authorizations.EMPTY, 4)) {
 
-      found.clear();
+        found.clear();
 
-      long t1 = System.currentTimeMillis();
+        long t1 = System.currentTimeMillis();
 
-      bs.setRanges(ranges);
+        bs.setRanges(ranges);
 
-      for (Entry<Key,Value> entry : bs) {
-        found.put(entry.getKey().getRow(), entry.getValue());
-      }
-      bs.close();
+        for (Entry<Key,Value> entry : bs) {
+          found.put(entry.getKey().getRow(), entry.getValue());
+        }
 
-      long t2 = System.currentTimeMillis();
+        long t2 = System.currentTimeMillis();
 
-      log.info(String.format("rate : %06.2f%n", ranges.size() / ((t2 - t1) / 1000.0)));
+        log.info(String.format("rate : %06.2f%n", ranges.size() / ((t2 - t1) / 1000.0)));
 
-      if (!found.equals(expected))
-        throw new Exception("Found and expected differ " + found + " " + expected);
+        if (!found.equals(expected))
+          throw new Exception("Found and expected differ " + found + " " + expected);
+      }
     }
 
     splits = getConnector().tableOperations().listSplits(tableName);
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/BatchWriterFlushIT.java b/test/src/main/java/org/apache/accumulo/test/functional/BatchWriterFlushIT.java
index ea048672e8..6188ceeed5 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/BatchWriterFlushIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/BatchWriterFlushIT.java
@@ -76,8 +76,8 @@ public void run() throws Exception {
 
   private void runLatencyTest(String tableName) throws Exception {
     // should automatically flush after 2 seconds
-    try (BatchWriter bw = getConnector().createBatchWriter(tableName, new BatchWriterConfig().setMaxLatency(1000, TimeUnit.MILLISECONDS))) {
-      Scanner scanner = getConnector().createScanner(tableName, Authorizations.EMPTY);
+    try (BatchWriter bw = getConnector().createBatchWriter(tableName, new BatchWriterConfig().setMaxLatency(1000, TimeUnit.MILLISECONDS));
+        Scanner scanner = getConnector().createScanner(tableName, Authorizations.EMPTY)) {
 
       Mutation m = new Mutation(new Text(String.format("r_%10d", 1)));
       m.put(new Text("cf"), new Text("cq"), new Value("1".getBytes(UTF_8)));
@@ -104,72 +104,74 @@ private void runLatencyTest(String tableName) throws Exception {
   private void runFlushTest(String tableName) throws AccumuloException, AccumuloSecurityException, TableNotFoundException, MutationsRejectedException,
       Exception {
     BatchWriter bw = getConnector().createBatchWriter(tableName, new BatchWriterConfig());
-    Scanner scanner = getConnector().createScanner(tableName, Authorizations.EMPTY);
-    Random r = new Random();
+    try (Scanner scanner = getConnector().createScanner(tableName, Authorizations.EMPTY)) {
+      Random r = new Random();
 
-    for (int i = 0; i < 4; i++) {
-      for (int j = 0; j < NUM_TO_FLUSH; j++) {
-        int row = i * NUM_TO_FLUSH + j;
+      for (int i = 0; i < 4; i++) {
+        for (int j = 0; j < NUM_TO_FLUSH; j++) {
+          int row = i * NUM_TO_FLUSH + j;
 
-        Mutation m = new Mutation(new Text(String.format("r_%10d", row)));
-        m.put(new Text("cf"), new Text("cq"), new Value(("" + row).getBytes()));
-        bw.addMutation(m);
-      }
+          Mutation m = new Mutation(new Text(String.format("r_%10d", row)));
+          m.put(new Text("cf"), new Text("cq"), new Value(("" + row).getBytes()));
+          bw.addMutation(m);
+        }
 
-      bw.flush();
+        bw.flush();
 
-      // do a few random lookups into the data just flushed
+        // do a few random lookups into the data just flushed
 
-      for (int k = 0; k < 10; k++) {
-        int rowToLookup = r.nextInt(NUM_TO_FLUSH) + i * NUM_TO_FLUSH;
+        for (int k = 0; k < 10; k++) {
+          int rowToLookup = r.nextInt(NUM_TO_FLUSH) + i * NUM_TO_FLUSH;
 
-        scanner.setRange(new Range(new Text(String.format("r_%10d", rowToLookup))));
+          scanner.setRange(new Range(new Text(String.format("r_%10d", rowToLookup))));
 
-        Iterator<Entry<Key,Value>> iter = scanner.iterator();
+          Iterator<Entry<Key,Value>> iter = scanner.iterator();
 
-        if (!iter.hasNext())
-          throw new Exception(" row " + rowToLookup + " not found after flush");
+          if (!iter.hasNext())
+            throw new Exception(" row " + rowToLookup + " not found after flush");
 
-        Entry<Key,Value> entry = iter.next();
+          Entry<Key,Value> entry = iter.next();
 
-        if (iter.hasNext())
-          throw new Exception("Scanner returned too much");
+          if (iter.hasNext())
+            throw new Exception("Scanner returned too much");
 
-        verifyEntry(rowToLookup, entry);
-      }
+          verifyEntry(rowToLookup, entry);
+        }
 
-      // scan all data just flushed
-      scanner.setRange(new Range(new Text(String.format("r_%10d", i * NUM_TO_FLUSH)), true, new Text(String.format("r_%10d", (i + 1) * NUM_TO_FLUSH)), false));
-      Iterator<Entry<Key,Value>> iter = scanner.iterator();
+        // scan all data just flushed
+        scanner
+            .setRange(new Range(new Text(String.format("r_%10d", i * NUM_TO_FLUSH)), true, new Text(String.format("r_%10d", (i + 1) * NUM_TO_FLUSH)), false));
+        Iterator<Entry<Key,Value>> iter = scanner.iterator();
 
-      for (int j = 0; j < NUM_TO_FLUSH; j++) {
-        int row = i * NUM_TO_FLUSH + j;
+        for (int j = 0; j < NUM_TO_FLUSH; j++) {
+          int row = i * NUM_TO_FLUSH + j;
 
-        if (!iter.hasNext())
-          throw new Exception("Scan stopped permaturely at " + row);
+          if (!iter.hasNext())
+            throw new Exception("Scan stopped permaturely at " + row);
 
-        Entry<Key,Value> entry = iter.next();
+          Entry<Key,Value> entry = iter.next();
 
-        verifyEntry(row, entry);
-      }
+          verifyEntry(row, entry);
+        }
 
-      if (iter.hasNext())
-        throw new Exception("Scanner returned too much");
+        if (iter.hasNext())
+          throw new Exception("Scanner returned too much");
 
-    }
+      }
 
-    bw.close();
+      bw.close();
 
-    // test adding a mutation to a closed batch writer
-    boolean caught = false;
-    try {
-      bw.addMutation(new Mutation(new Text("foobar")));
-    } catch (IllegalStateException ise) {
-      caught = true;
-    }
+      // test adding a mutation to a closed batch writer
+      boolean caught = false;
+      try {
+        bw.addMutation(new Mutation(new Text("foobar")));
+      } catch (IllegalStateException ise) {
+        caught = true;
+      }
 
-    if (!caught) {
-      throw new Exception("Adding to closed batch writer did not fail");
+      if (!caught) {
+        throw new Exception("Adding to closed batch writer did not fail");
+      }
     }
   }
 
@@ -230,25 +232,25 @@ public void run() {
     threads.shutdown();
     threads.awaitTermination(3, TimeUnit.MINUTES);
     bw.close();
-    Scanner scanner = getConnector().createScanner(tableName, Authorizations.EMPTY);
-    for (Entry<Key,Value> e : scanner) {
-      Mutation m = new Mutation(e.getKey().getRow());
-      m.put(e.getKey().getColumnFamily(), e.getKey().getColumnQualifier(), e.getValue());
-      boolean found = false;
-      for (int l = 0; l < NUM_THREADS; l++) {
-        if (allMuts.get(l).contains(m)) {
-          found = true;
-          allMuts.get(l).remove(m);
-          break;
+    try (Scanner scanner = getConnector().createScanner(tableName, Authorizations.EMPTY)) {
+      for (Entry<Key,Value> e : scanner) {
+        Mutation m = new Mutation(e.getKey().getRow());
+        m.put(e.getKey().getColumnFamily(), e.getKey().getColumnQualifier(), e.getValue());
+        boolean found = false;
+        for (int l = 0; l < NUM_THREADS; l++) {
+          if (allMuts.get(l).contains(m)) {
+            found = true;
+            allMuts.get(l).remove(m);
+            break;
+          }
         }
+        Assert.assertTrue("Mutation not found: " + m.toString(), found);
       }
-      Assert.assertTrue("Mutation not found: " + m.toString(), found);
-    }
 
-    for (int m = 0; m < NUM_THREADS; m++) {
-      Assert.assertEquals(0, allMuts.get(m).size());
+      for (int m = 0; m < NUM_THREADS; m++) {
+        Assert.assertEquals(0, allMuts.get(m).size());
+      }
     }
-
   }
 
   private void verifyEntry(int row, Entry<Key,Value> entry) throws Exception {
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/BinaryStressIT.java b/test/src/main/java/org/apache/accumulo/test/functional/BinaryStressIT.java
index 9ce221a648..9babde08fc 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/BinaryStressIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/BinaryStressIT.java
@@ -96,10 +96,11 @@ public void binaryStressTest() throws Exception {
     BinaryIT.runTest(c, tableName);
     String id = c.tableOperations().tableIdMap().get(tableName);
     Set<Text> tablets = new HashSet<>();
-    Scanner s = c.createScanner(MetadataTable.NAME, Authorizations.EMPTY);
-    s.setRange(Range.prefix(id));
-    for (Entry<Key,Value> entry : s) {
-      tablets.add(entry.getKey().getRow());
+    try (Scanner s = c.createScanner(MetadataTable.NAME, Authorizations.EMPTY)) {
+      s.setRange(Range.prefix(id));
+      for (Entry<Key,Value> entry : s) {
+        tablets.add(entry.getKey().getRow());
+      }
     }
     assertTrue("Expected at least 8 tablets, saw " + tablets.size(), tablets.size() > 7);
   }
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/BloomFilterIT.java b/test/src/main/java/org/apache/accumulo/test/functional/BloomFilterIT.java
index 1c6fc9fa73..811d25b20e 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/BloomFilterIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/BloomFilterIT.java
@@ -147,11 +147,12 @@ public void test() throws Exception {
       timeCheck(t1 + t2 + t3, tb1 + tb2 + tb3);
 
       // test querying for empty key
-      Scanner scanner = c.createScanner(tables[3], Authorizations.EMPTY);
-      scanner.setRange(new Range(new Text("")));
+      try (Scanner scanner = c.createScanner(tables[3], Authorizations.EMPTY)) {
+        scanner.setRange(new Range(new Text("")));
 
-      if (!scanner.iterator().next().getValue().toString().equals("foo1")) {
-        throw new Exception("Did not see foo1");
+        if (!scanner.iterator().next().getValue().toString().equals("foo1")) {
+          throw new Exception("Did not see foo1");
+        }
       }
     } finally {
       c.instanceOperations().setProperty(Property.TSERV_READ_AHEAD_MAXCONCURRENT.getKey(), readAhead);
@@ -201,25 +202,24 @@ private long query(Connector c, String table, int depth, long start, long end, i
       ranges.add(range);
     }
 
-    BatchScanner bs = c.createBatchScanner(table, Authorizations.EMPTY, 1);
-    bs.setRanges(ranges);
+    try (BatchScanner bs = c.createBatchScanner(table, Authorizations.EMPTY, 1)) {
+      bs.setRanges(ranges);
 
-    long t1 = System.currentTimeMillis();
-    for (Entry<Key,Value> entry : bs) {
-      long v = Long.parseLong(entry.getValue().toString());
-      if (!expected.remove(v)) {
-        throw new Exception("Got unexpected return " + entry.getKey() + " " + entry.getValue());
+      long t1 = System.currentTimeMillis();
+      for (Entry<Key,Value> entry : bs) {
+        long v = Long.parseLong(entry.getValue().toString());
+        if (!expected.remove(v)) {
+          throw new Exception("Got unexpected return " + entry.getKey() + " " + entry.getValue());
+        }
       }
-    }
-    long t2 = System.currentTimeMillis();
-
-    if (expected.size() > 0) {
-      throw new Exception("Did not get all expected values " + expected.size());
-    }
+      long t2 = System.currentTimeMillis();
 
-    bs.close();
+      if (expected.size() > 0) {
+        throw new Exception("Did not get all expected values " + expected.size());
+      }
 
-    return t2 - t1;
+      return t2 - t1;
+    }
   }
 
   private void write(Connector c, String table, int depth, long start, long end, int step) throws Exception {
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/BulkFileIT.java b/test/src/main/java/org/apache/accumulo/test/functional/BulkFileIT.java
index 87b3d5ac67..e909fdc6e0 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/BulkFileIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/BulkFileIT.java
@@ -101,27 +101,28 @@ public void testBulkFile() throws Exception {
   }
 
   private void verifyData(String table, int s, int e) throws Exception {
-    Scanner scanner = getConnector().createScanner(table, Authorizations.EMPTY);
+    try (Scanner scanner = getConnector().createScanner(table, Authorizations.EMPTY)) {
 
-    Iterator<Entry<Key,Value>> iter = scanner.iterator();
+      Iterator<Entry<Key,Value>> iter = scanner.iterator();
 
-    for (int i = s; i <= e; i++) {
-      if (!iter.hasNext())
-        throw new Exception("row " + i + " not found");
+      for (int i = s; i <= e; i++) {
+        if (!iter.hasNext())
+          throw new Exception("row " + i + " not found");
 
-      Entry<Key,Value> entry = iter.next();
+        Entry<Key,Value> entry = iter.next();
 
-      String row = String.format("%04d", i);
+        String row = String.format("%04d", i);
 
-      if (!entry.getKey().getRow().equals(new Text(row)))
-        throw new Exception("unexpected row " + entry.getKey() + " " + i);
+        if (!entry.getKey().getRow().equals(new Text(row)))
+          throw new Exception("unexpected row " + entry.getKey() + " " + i);
 
-      if (Integer.parseInt(entry.getValue().toString()) != i)
-        throw new Exception("unexpected value " + entry + " " + i);
-    }
+        if (Integer.parseInt(entry.getValue().toString()) != i)
+          throw new Exception("unexpected value " + entry + " " + i);
+      }
 
-    if (iter.hasNext())
-      throw new Exception("found more than expected " + iter.next());
+      if (iter.hasNext())
+        throw new Exception("found more than expected " + iter.next());
+    }
   }
 
   private void writeData(FileSKVWriter w, int s, int e) throws Exception {
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/ClassLoaderIT.java b/test/src/main/java/org/apache/accumulo/test/functional/ClassLoaderIT.java
index 22ac6a7304..7c4a6a82ae 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/ClassLoaderIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/ClassLoaderIT.java
@@ -112,12 +112,13 @@ public void test() throws Exception {
   }
 
   private void scanCheck(Connector c, String tableName, String expected) throws Exception {
-    Scanner bs = c.createScanner(tableName, Authorizations.EMPTY);
-    Iterator<Entry<Key,Value>> iterator = bs.iterator();
-    assertTrue(iterator.hasNext());
-    Entry<Key,Value> next = iterator.next();
-    assertFalse(iterator.hasNext());
-    assertEquals(expected, next.getValue().toString());
+    try (Scanner bs = c.createScanner(tableName, Authorizations.EMPTY)) {
+      Iterator<Entry<Key,Value>> iterator = bs.iterator();
+      assertTrue(iterator.hasNext());
+      Entry<Key,Value> next = iterator.next();
+      assertFalse(iterator.hasNext());
+      assertEquals(expected, next.getValue().toString());
+    }
   }
 
 }
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/CleanTmpIT.java b/test/src/main/java/org/apache/accumulo/test/functional/CleanTmpIT.java
index 751e827953..83e5a3561e 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/CleanTmpIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/CleanTmpIT.java
@@ -87,11 +87,13 @@ public void test() throws Exception {
 
     // create a fake _tmp file in its directory
     String id = c.tableOperations().tableIdMap().get(tableName);
-    Scanner s = c.createScanner(MetadataTable.NAME, Authorizations.EMPTY);
-    s.setRange(Range.prefix(id));
-    s.fetchColumnFamily(MetadataSchema.TabletsSection.DataFileColumnFamily.NAME);
-    Entry<Key,Value> entry = Iterables.getOnlyElement(s);
-    Path file = new Path(entry.getKey().getColumnQualifier().toString());
+    Path file;
+    try (Scanner s = c.createScanner(MetadataTable.NAME, Authorizations.EMPTY)) {
+      s.setRange(Range.prefix(id));
+      s.fetchColumnFamily(MetadataSchema.TabletsSection.DataFileColumnFamily.NAME);
+      Entry<Key,Value> entry = Iterables.getOnlyElement(s);
+      file = new Path(entry.getKey().getColumnQualifier().toString());
+    }
 
     FileSystem fs = getCluster().getFileSystem();
     assertTrue("Could not find file: " + file, fs.exists(file));
@@ -104,9 +106,10 @@ public void test() throws Exception {
     getCluster().stop();
     getCluster().start();
 
-    Scanner scanner = c.createScanner(tableName, Authorizations.EMPTY);
-    assertEquals(2, Iterators.size(scanner.iterator()));
-    // If we performed log recovery, we should have cleaned up any stray files
-    assertFalse("File still exists: " + tmp, fs.exists(tmp));
+    try (Scanner scanner = c.createScanner(tableName, Authorizations.EMPTY)) {
+      assertEquals(2, Iterators.size(scanner.iterator()));
+      // If we performed log recovery, we should have cleaned up any stray files
+      assertFalse("File still exists: " + tmp, fs.exists(tmp));
+    }
   }
 }
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/CleanUpIT.java b/test/src/main/java/org/apache/accumulo/test/functional/CleanUpIT.java
index 2ff55e835e..d240b570ec 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/CleanUpIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/CleanUpIT.java
@@ -75,61 +75,62 @@ public void run() throws Exception {
 
     bw.flush();
 
-    Scanner scanner = getConnector().createScanner(tableName, new Authorizations());
+    try (Scanner scanner = getConnector().createScanner(tableName, new Authorizations())) {
 
-    int count = 0;
-    for (Entry<Key,Value> entry : scanner) {
-      count++;
-      if (!entry.getValue().toString().equals("5")) {
-        Assert.fail("Unexpected value " + entry.getValue());
+      int count = 0;
+      for (Entry<Key,Value> entry : scanner) {
+        count++;
+        if (!entry.getValue().toString().equals("5")) {
+          Assert.fail("Unexpected value " + entry.getValue());
+        }
       }
-    }
 
-    Assert.assertEquals("Unexpected count", 1, count);
+      Assert.assertEquals("Unexpected count", 1, count);
 
-    int threadCount = countThreads();
-    if (threadCount < 2) {
-      printThreadNames();
-      Assert.fail("Not seeing expected threads. Saw " + threadCount);
-    }
-
-    CleanUp.shutdownNow();
+      int threadCount = countThreads();
+      if (threadCount < 2) {
+        printThreadNames();
+        Assert.fail("Not seeing expected threads. Saw " + threadCount);
+      }
 
-    Mutation m2 = new Mutation("r2");
-    m2.put("cf1", "cq1", 1, "6");
+      CleanUp.shutdownNow();
 
-    try {
-      bw.addMutation(m1);
-      bw.flush();
-      Assert.fail("batch writer did not fail");
-    } catch (Exception e) {
+      Mutation m2 = new Mutation("r2");
+      m2.put("cf1", "cq1", 1, "6");
 
-    }
+      try {
+        bw.addMutation(m1);
+        bw.flush();
+        Assert.fail("batch writer did not fail");
+      } catch (Exception e) {
 
-    try {
-      // expect this to fail also, want to clean up batch writer threads
-      bw.close();
-      Assert.fail("batch writer close not fail");
-    } catch (Exception e) {
+      }
 
-    }
+      try {
+        // expect this to fail also, want to clean up batch writer threads
+        bw.close();
+        Assert.fail("batch writer close not fail");
+      } catch (Exception e) {
 
-    try {
-      count = 0;
-      Iterator<Entry<Key,Value>> iter = scanner.iterator();
-      while (iter.hasNext()) {
-        iter.next();
-        count++;
       }
-      Assert.fail("scanner did not fail");
-    } catch (Exception e) {
 
-    }
+      try {
+        count = 0;
+        Iterator<Entry<Key,Value>> iter = scanner.iterator();
+        while (iter.hasNext()) {
+          iter.next();
+          count++;
+        }
+        Assert.fail("scanner did not fail");
+      } catch (Exception e) {
 
-    threadCount = countThreads();
-    if (threadCount > 0) {
-      printThreadNames();
-      Assert.fail("Threads did not go away. Saw " + threadCount);
+      }
+
+      threadCount = countThreads();
+      if (threadCount > 0) {
+        printThreadNames();
+        Assert.fail("Threads did not go away. Saw " + threadCount);
+      }
     }
   }
 
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/CloneTestIT.java b/test/src/main/java/org/apache/accumulo/test/functional/CloneTestIT.java
index 64cdc34d17..a088354e75 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/CloneTestIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/CloneTestIT.java
@@ -116,60 +116,61 @@ public void testProps() throws Exception {
   }
 
   private void checkData(String table2, Connector c) throws TableNotFoundException {
-    Scanner scanner = c.createScanner(table2, Authorizations.EMPTY);
+    try (Scanner scanner = c.createScanner(table2, Authorizations.EMPTY)) {
 
-    HashMap<String,String> expected = new HashMap<>();
-    expected.put("001:x", "9");
-    expected.put("001:y", "7");
-    expected.put("008:x", "3");
-    expected.put("008:y", "4");
+      HashMap<String,String> expected = new HashMap<>();
+      expected.put("001:x", "9");
+      expected.put("001:y", "7");
+      expected.put("008:x", "3");
+      expected.put("008:y", "4");
 
-    HashMap<String,String> actual = new HashMap<>();
+      HashMap<String,String> actual = new HashMap<>();
 
-    for (Entry<Key,Value> entry : scanner)
-      actual.put(entry.getKey().getRowData().toString() + ":" + entry.getKey().getColumnQualifierData().toString(), entry.getValue().toString());
+      for (Entry<Key,Value> entry : scanner)
+        actual.put(entry.getKey().getRowData().toString() + ":" + entry.getKey().getColumnQualifierData().toString(), entry.getValue().toString());
 
-    Assert.assertEquals(expected, actual);
+      Assert.assertEquals(expected, actual);
+    }
   }
 
   private void checkMetadata(String table, Connector conn) throws Exception {
-    Scanner s = conn.createScanner(MetadataTable.NAME, Authorizations.EMPTY);
-
-    s.fetchColumnFamily(MetadataSchema.TabletsSection.DataFileColumnFamily.NAME);
-    MetadataSchema.TabletsSection.ServerColumnFamily.DIRECTORY_COLUMN.fetch(s);
-    String tableId = conn.tableOperations().tableIdMap().get(table);
-
-    Assert.assertNotNull("Could not get table id for " + table, tableId);
-
-    s.setRange(Range.prefix(tableId));
-
-    Key k;
-    Text cf = new Text(), cq = new Text();
-    int itemsInspected = 0;
-    for (Entry<Key,Value> entry : s) {
-      itemsInspected++;
-      k = entry.getKey();
-      k.getColumnFamily(cf);
-      k.getColumnQualifier(cq);
-
-      if (cf.equals(MetadataSchema.TabletsSection.DataFileColumnFamily.NAME)) {
-        Path p = new Path(cq.toString());
-        FileSystem fs = cluster.getFileSystem();
-        Assert.assertTrue("File does not exist: " + p, fs.exists(p));
-      } else if (cf.equals(MetadataSchema.TabletsSection.ServerColumnFamily.DIRECTORY_COLUMN.getColumnFamily())) {
-        Assert.assertEquals("Saw unexpected cq", MetadataSchema.TabletsSection.ServerColumnFamily.DIRECTORY_COLUMN.getColumnQualifier(), cq);
-        Path tabletDir = new Path(entry.getValue().toString());
-        Path tableDir = tabletDir.getParent();
-        Path tablesDir = tableDir.getParent();
-
-        Assert.assertEquals(ServerConstants.TABLE_DIR, tablesDir.getName());
-      } else {
-        Assert.fail("Got unexpected key-value: " + entry);
-        throw new RuntimeException();
+    try (Scanner s = conn.createScanner(MetadataTable.NAME, Authorizations.EMPTY)) {
+
+      s.fetchColumnFamily(MetadataSchema.TabletsSection.DataFileColumnFamily.NAME);
+      MetadataSchema.TabletsSection.ServerColumnFamily.DIRECTORY_COLUMN.fetch(s);
+      String tableId = conn.tableOperations().tableIdMap().get(table);
+
+      Assert.assertNotNull("Could not get table id for " + table, tableId);
+
+      s.setRange(Range.prefix(tableId));
+
+      Key k;
+      Text cf = new Text(), cq = new Text();
+      int itemsInspected = 0;
+      for (Entry<Key,Value> entry : s) {
+        itemsInspected++;
+        k = entry.getKey();
+        k.getColumnFamily(cf);
+        k.getColumnQualifier(cq);
+
+        if (cf.equals(MetadataSchema.TabletsSection.DataFileColumnFamily.NAME)) {
+          Path p = new Path(cq.toString());
+          FileSystem fs = cluster.getFileSystem();
+          Assert.assertTrue("File does not exist: " + p, fs.exists(p));
+        } else if (cf.equals(MetadataSchema.TabletsSection.ServerColumnFamily.DIRECTORY_COLUMN.getColumnFamily())) {
+          Assert.assertEquals("Saw unexpected cq", MetadataSchema.TabletsSection.ServerColumnFamily.DIRECTORY_COLUMN.getColumnQualifier(), cq);
+          Path tabletDir = new Path(entry.getValue().toString());
+          Path tableDir = tabletDir.getParent();
+          Path tablesDir = tableDir.getParent();
+
+          Assert.assertEquals(ServerConstants.TABLE_DIR, tablesDir.getName());
+        } else {
+          Assert.fail("Got unexpected key-value: " + entry);
+          throw new RuntimeException();
+        }
       }
+      Assert.assertTrue("Expected to find metadata entries", itemsInspected > 0);
     }
-
-    Assert.assertTrue("Expected to find metadata entries", itemsInspected > 0);
   }
 
   private BatchWriter writeData(String table1, Connector c) throws TableNotFoundException, MutationsRejectedException {
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/CombinerIT.java b/test/src/main/java/org/apache/accumulo/test/functional/CombinerIT.java
index d4ef18ea2f..9ffa9f910e 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/CombinerIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/CombinerIT.java
@@ -46,12 +46,13 @@ protected int defaultTimeoutSeconds() {
   }
 
   private void checkSum(String tableName, Connector c) throws Exception {
-    Scanner s = c.createScanner(tableName, Authorizations.EMPTY);
-    Iterator<Entry<Key,Value>> i = s.iterator();
-    assertTrue(i.hasNext());
-    Entry<Key,Value> entry = i.next();
-    assertEquals("45", entry.getValue().toString());
-    assertFalse(i.hasNext());
+    try (Scanner s = c.createScanner(tableName, Authorizations.EMPTY)) {
+      Iterator<Entry<Key,Value>> i = s.iterator();
+      assertTrue(i.hasNext());
+      Entry<Key,Value> entry = i.next();
+      assertEquals("45", entry.getValue().toString());
+      assertFalse(i.hasNext());
+    }
   }
 
   @Test
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/CompactionIT.java b/test/src/main/java/org/apache/accumulo/test/functional/CompactionIT.java
index e5fecf86e9..afe72b10f0 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/CompactionIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/CompactionIT.java
@@ -177,10 +177,11 @@ public void run() {
   }
 
   private int countFiles(Connector c) throws Exception {
-    Scanner s = c.createScanner(MetadataTable.NAME, Authorizations.EMPTY);
-    s.fetchColumnFamily(new Text(MetadataSchema.TabletsSection.TabletColumnFamily.NAME));
-    s.fetchColumnFamily(new Text(MetadataSchema.TabletsSection.DataFileColumnFamily.NAME));
-    return Iterators.size(s.iterator());
+    try (Scanner s = c.createScanner(MetadataTable.NAME, Authorizations.EMPTY)) {
+      s.fetchColumnFamily(new Text(MetadataSchema.TabletsSection.TabletColumnFamily.NAME));
+      s.fetchColumnFamily(new Text(MetadataSchema.TabletsSection.DataFileColumnFamily.NAME));
+      return Iterators.size(s.iterator());
+    }
   }
 
 }
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/ConcurrencyIT.java b/test/src/main/java/org/apache/accumulo/test/functional/ConcurrencyIT.java
index 087b4125f2..6674ba8be3 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/ConcurrencyIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/ConcurrencyIT.java
@@ -51,13 +51,19 @@
   static class ScanTask extends Thread {
 
     int count = 0;
-    Scanner scanner;
+    Scanner scanner = null;
 
     ScanTask(Connector conn, String tableName, long time) throws Exception {
-      scanner = conn.createScanner(tableName, Authorizations.EMPTY);
-      IteratorSetting slow = new IteratorSetting(30, "slow", SlowIterator.class);
-      SlowIterator.setSleepTime(slow, time);
-      scanner.addScanIterator(slow);
+      try {
+        scanner = conn.createScanner(tableName, Authorizations.EMPTY);
+        IteratorSetting slow = new IteratorSetting(30, "slow", SlowIterator.class);
+        SlowIterator.setSleepTime(slow, time);
+        scanner.addScanIterator(slow);
+      } finally {
+        if (scanner != null) {
+          scanner.close();
+        }
+      }
     }
 
     @Override
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/ConfigurableCompactionIT.java b/test/src/main/java/org/apache/accumulo/test/functional/ConfigurableCompactionIT.java
index d812914410..e3ca3864b9 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/ConfigurableCompactionIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/ConfigurableCompactionIT.java
@@ -164,9 +164,10 @@ private void runTest(final Connector c, final String tableName, final int n) thr
   }
 
   private int countFiles(Connector c, String tableName) throws Exception {
-    Scanner s = c.createScanner(MetadataTable.NAME, Authorizations.EMPTY);
-    s.fetchColumnFamily(MetadataSchema.TabletsSection.DataFileColumnFamily.NAME);
-    return Iterators.size(s.iterator());
+    try (Scanner s = c.createScanner(MetadataTable.NAME, Authorizations.EMPTY)) {
+      s.fetchColumnFamily(MetadataSchema.TabletsSection.DataFileColumnFamily.NAME);
+      return Iterators.size(s.iterator());
+    }
   }
 
 }
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/ConstraintIT.java b/test/src/main/java/org/apache/accumulo/test/functional/ConstraintIT.java
index 7b92951f55..1d424a6645 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/ConstraintIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/ConstraintIT.java
@@ -138,106 +138,107 @@ private void test1(String tableName) throws Exception {
     }
 
     // verify mutation did not go through
-    Scanner scanner = getConnector().createScanner(tableName, Authorizations.EMPTY);
-    scanner.setRange(new Range(new Text("r1")));
+    try (Scanner scanner = getConnector().createScanner(tableName, Authorizations.EMPTY)) {
+      scanner.setRange(new Range(new Text("r1")));
 
-    Iterator<Entry<Key,Value>> iter = scanner.iterator();
-    Entry<Key,Value> entry = iter.next();
+      Iterator<Entry<Key,Value>> iter = scanner.iterator();
+      Entry<Key,Value> entry = iter.next();
 
-    if (!entry.getKey().getRow().equals(new Text("r1")) || !entry.getKey().getColumnFamily().equals(new Text("cf1"))
-        || !entry.getKey().getColumnQualifier().equals(new Text("cq1")) || !entry.getValue().equals(new Value("123".getBytes(UTF_8)))) {
-      throw new Exception("Unexpected key or value " + entry.getKey() + " " + entry.getValue());
-    }
-
-    if (iter.hasNext()) {
-      entry = iter.next();
-      throw new Exception("Unexpected extra key or value " + entry.getKey() + " " + entry.getValue());
-    }
-
-    // remove the numeric value constraint
-    getConnector().tableOperations().removeConstraint(tableName, 2);
-    sleepUninterruptibly(1, TimeUnit.SECONDS);
+      if (!entry.getKey().getRow().equals(new Text("r1")) || !entry.getKey().getColumnFamily().equals(new Text("cf1"))
+          || !entry.getKey().getColumnQualifier().equals(new Text("cq1")) || !entry.getValue().equals(new Value("123".getBytes(UTF_8)))) {
+        throw new Exception("Unexpected key or value " + entry.getKey() + " " + entry.getValue());
+      }
 
-    // now should be able to add a non numeric value
-    bw = getConnector().createBatchWriter(tableName, new BatchWriterConfig());
-    bw.addMutation(mut2);
-    bw.close();
+      if (iter.hasNext()) {
+        entry = iter.next();
+        throw new Exception("Unexpected extra key or value " + entry.getKey() + " " + entry.getValue());
+      }
 
-    // verify mutation went through
-    iter = scanner.iterator();
-    entry = iter.next();
+      // remove the numeric value constraint
+      getConnector().tableOperations().removeConstraint(tableName, 2);
+      sleepUninterruptibly(1, TimeUnit.SECONDS);
 
-    if (!entry.getKey().getRow().equals(new Text("r1")) || !entry.getKey().getColumnFamily().equals(new Text("cf1"))
-        || !entry.getKey().getColumnQualifier().equals(new Text("cq1")) || !entry.getValue().equals(new Value("123a".getBytes(UTF_8)))) {
-      throw new Exception("Unexpected key or value " + entry.getKey() + " " + entry.getValue());
-    }
+      // now should be able to add a non numeric value
+      bw = getConnector().createBatchWriter(tableName, new BatchWriterConfig());
+      bw.addMutation(mut2);
+      bw.close();
 
-    if (iter.hasNext()) {
+      // verify mutation went through
+      iter = scanner.iterator();
       entry = iter.next();
-      throw new Exception("Unexpected extra key or value " + entry.getKey() + " " + entry.getValue());
-    }
 
-    // add a constraint that references a non-existant class
-    getConnector().tableOperations().setProperty(tableName, Property.TABLE_CONSTRAINT_PREFIX + "1", "com.foobar.nonExistantClass");
-    sleepUninterruptibly(1, TimeUnit.SECONDS);
+      if (!entry.getKey().getRow().equals(new Text("r1")) || !entry.getKey().getColumnFamily().equals(new Text("cf1"))
+          || !entry.getKey().getColumnQualifier().equals(new Text("cq1")) || !entry.getValue().equals(new Value("123a".getBytes(UTF_8)))) {
+        throw new Exception("Unexpected key or value " + entry.getKey() + " " + entry.getValue());
+      }
 
-    // add a mutation
-    bw = getConnector().createBatchWriter(tableName, new BatchWriterConfig());
+      if (iter.hasNext()) {
+        entry = iter.next();
+        throw new Exception("Unexpected extra key or value " + entry.getKey() + " " + entry.getValue());
+      }
 
-    Mutation mut3 = new Mutation(new Text("r1"));
-    mut3.put(new Text("cf1"), new Text("cq1"), new Value("foo".getBytes(UTF_8)));
+      // add a constraint that references a non-existant class
+      getConnector().tableOperations().setProperty(tableName, Property.TABLE_CONSTRAINT_PREFIX + "1", "com.foobar.nonExistantClass");
+      sleepUninterruptibly(1, TimeUnit.SECONDS);
 
-    bw.addMutation(mut3);
+      // add a mutation
+      bw = getConnector().createBatchWriter(tableName, new BatchWriterConfig());
 
-    sawMRE = false;
+      Mutation mut3 = new Mutation(new Text("r1"));
+      mut3.put(new Text("cf1"), new Text("cq1"), new Value("foo".getBytes(UTF_8)));
 
-    try {
-      bw.close();
-      // should not get here
-      throw new Exception("Test failed, mutation went through when table had bad constraints");
-    } catch (MutationsRejectedException mre) {
-      sawMRE = true;
-    }
+      bw.addMutation(mut3);
 
-    if (!sawMRE) {
-      throw new Exception("Did not see MutationsRejectedException");
-    }
+      sawMRE = false;
 
-    // verify the mutation did not go through
-    iter = scanner.iterator();
-    entry = iter.next();
+      try {
+        bw.close();
+        // should not get here
+        throw new Exception("Test failed, mutation went through when table had bad constraints");
+      } catch (MutationsRejectedException mre) {
+        sawMRE = true;
+      }
 
-    if (!entry.getKey().getRow().equals(new Text("r1")) || !entry.getKey().getColumnFamily().equals(new Text("cf1"))
-        || !entry.getKey().getColumnQualifier().equals(new Text("cq1")) || !entry.getValue().equals(new Value("123a".getBytes(UTF_8)))) {
-      throw new Exception("Unexpected key or value " + entry.getKey() + " " + entry.getValue());
-    }
+      if (!sawMRE) {
+        throw new Exception("Did not see MutationsRejectedException");
+      }
 
-    if (iter.hasNext()) {
+      // verify the mutation did not go through
+      iter = scanner.iterator();
       entry = iter.next();
-      throw new Exception("Unexpected extra key or value " + entry.getKey() + " " + entry.getValue());
-    }
 
-    // remove the bad constraint
-    getConnector().tableOperations().removeConstraint(tableName, 1);
-    sleepUninterruptibly(1, TimeUnit.SECONDS);
+      if (!entry.getKey().getRow().equals(new Text("r1")) || !entry.getKey().getColumnFamily().equals(new Text("cf1"))
+          || !entry.getKey().getColumnQualifier().equals(new Text("cq1")) || !entry.getValue().equals(new Value("123a".getBytes(UTF_8)))) {
+        throw new Exception("Unexpected key or value " + entry.getKey() + " " + entry.getValue());
+      }
 
-    // try the mutation again
-    bw = getConnector().createBatchWriter(tableName, new BatchWriterConfig());
-    bw.addMutation(mut3);
-    bw.close();
+      if (iter.hasNext()) {
+        entry = iter.next();
+        throw new Exception("Unexpected extra key or value " + entry.getKey() + " " + entry.getValue());
+      }
 
-    // verify it went through
-    iter = scanner.iterator();
-    entry = iter.next();
+      // remove the bad constraint
+      getConnector().tableOperations().removeConstraint(tableName, 1);
+      sleepUninterruptibly(1, TimeUnit.SECONDS);
 
-    if (!entry.getKey().getRow().equals(new Text("r1")) || !entry.getKey().getColumnFamily().equals(new Text("cf1"))
-        || !entry.getKey().getColumnQualifier().equals(new Text("cq1")) || !entry.getValue().equals(new Value("foo".getBytes(UTF_8)))) {
-      throw new Exception("Unexpected key or value " + entry.getKey() + " " + entry.getValue());
-    }
+      // try the mutation again
+      bw = getConnector().createBatchWriter(tableName, new BatchWriterConfig());
+      bw.addMutation(mut3);
+      bw.close();
 
-    if (iter.hasNext()) {
+      // verify it went through
+      iter = scanner.iterator();
       entry = iter.next();
-      throw new Exception("Unexpected extra key or value " + entry.getKey() + " " + entry.getValue());
+
+      if (!entry.getKey().getRow().equals(new Text("r1")) || !entry.getKey().getColumnFamily().equals(new Text("cf1"))
+          || !entry.getKey().getColumnQualifier().equals(new Text("cq1")) || !entry.getValue().equals(new Value("foo".getBytes(UTF_8)))) {
+        throw new Exception("Unexpected key or value " + entry.getKey() + " " + entry.getValue());
+      }
+
+      if (iter.hasNext()) {
+        entry = iter.next();
+        throw new Exception("Unexpected extra key or value " + entry.getKey() + " " + entry.getValue());
+      }
     }
   }
 
@@ -308,29 +309,29 @@ private void test2(String table, boolean doFlush) throws Exception {
       throw new Exception("Did not see MutationsRejectedException");
     }
 
-    Scanner scanner = getConnector().createScanner(table, Authorizations.EMPTY);
+    try (Scanner scanner = getConnector().createScanner(table, Authorizations.EMPTY)) {
 
-    Iterator<Entry<Key,Value>> iter = scanner.iterator();
+      Iterator<Entry<Key,Value>> iter = scanner.iterator();
 
-    Entry<Key,Value> entry = iter.next();
+      Entry<Key,Value> entry = iter.next();
 
-    if (!entry.getKey().getRow().equals(new Text("r1")) || !entry.getKey().getColumnFamily().equals(new Text("cf1"))
-        || !entry.getKey().getColumnQualifier().equals(new Text("cq1")) || !entry.getValue().equals(new Value("123".getBytes(UTF_8)))) {
-      throw new Exception("Unexpected key or value " + entry.getKey() + " " + entry.getValue());
-    }
+      if (!entry.getKey().getRow().equals(new Text("r1")) || !entry.getKey().getColumnFamily().equals(new Text("cf1"))
+          || !entry.getKey().getColumnQualifier().equals(new Text("cq1")) || !entry.getValue().equals(new Value("123".getBytes(UTF_8)))) {
+        throw new Exception("Unexpected key or value " + entry.getKey() + " " + entry.getValue());
+      }
 
-    entry = iter.next();
+      entry = iter.next();
 
-    if (!entry.getKey().getRow().equals(new Text("r1")) || !entry.getKey().getColumnFamily().equals(new Text("cf1"))
-        || !entry.getKey().getColumnQualifier().equals(new Text("cq4")) || !entry.getValue().equals(new Value("789".getBytes(UTF_8)))) {
-      throw new Exception("Unexpected key or value " + entry.getKey() + " " + entry.getValue());
-    }
+      if (!entry.getKey().getRow().equals(new Text("r1")) || !entry.getKey().getColumnFamily().equals(new Text("cf1"))
+          || !entry.getKey().getColumnQualifier().equals(new Text("cq4")) || !entry.getValue().equals(new Value("789".getBytes(UTF_8)))) {
+        throw new Exception("Unexpected key or value " + entry.getKey() + " " + entry.getValue());
+      }
 
-    if (iter.hasNext()) {
-      entry = iter.next();
-      throw new Exception("Unexpected extra key or value " + entry.getKey() + " " + entry.getValue());
+      if (iter.hasNext()) {
+        entry = iter.next();
+        throw new Exception("Unexpected extra key or value " + entry.getKey() + " " + entry.getValue());
+      }
     }
-
   }
 
 }
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/CreateAndUseIT.java b/test/src/main/java/org/apache/accumulo/test/functional/CreateAndUseIT.java
index 919ab30c89..01b3400bc8 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/CreateAndUseIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/CreateAndUseIT.java
@@ -77,18 +77,18 @@ public void verifyDataIsPresent() throws Exception {
     }
 
     bw.close();
-    Scanner scanner1 = getConnector().createScanner(tableName, Authorizations.EMPTY);
+    try (Scanner scanner1 = getConnector().createScanner(tableName, Authorizations.EMPTY)) {
 
-    int ei = 1;
+      int ei = 1;
 
-    for (Entry<Key,Value> entry : scanner1) {
-      Assert.assertEquals(String.format("%08x", (ei << 8) - 16), entry.getKey().getRow().toString());
-      Assert.assertEquals(Integer.toString(ei), entry.getValue().toString());
+      for (Entry<Key,Value> entry : scanner1) {
+        Assert.assertEquals(String.format("%08x", (ei << 8) - 16), entry.getKey().getRow().toString());
+        Assert.assertEquals(Integer.toString(ei), entry.getValue().toString());
 
-      ei++;
+        ei++;
+      }
+      Assert.assertEquals("Did not see expected number of rows", 257, ei);
     }
-
-    Assert.assertEquals("Did not see expected number of rows", 257, ei);
   }
 
   @Test
@@ -96,15 +96,16 @@ public void createTableAndScan() throws Exception {
     String table2 = getUniqueNames(1)[0];
     getConnector().tableOperations().create(table2);
     getConnector().tableOperations().addSplits(table2, splits);
-    Scanner scanner2 = getConnector().createScanner(table2, Authorizations.EMPTY);
-    int count = 0;
-    for (Entry<Key,Value> entry : scanner2) {
-      if (entry != null)
-        count++;
-    }
-
-    if (count != 0) {
-      throw new Exception("Did not see expected number of entries, count = " + count);
+    try (Scanner scanner2 = getConnector().createScanner(table2, Authorizations.EMPTY)) {
+      int count = 0;
+      for (Entry<Key,Value> entry : scanner2) {
+        if (entry != null)
+          count++;
+      }
+
+      if (count != 0) {
+        throw new Exception("Did not see expected number of entries, count = " + count);
+      }
     }
   }
 
@@ -118,13 +119,13 @@ public void createTableAndBatchScan() throws Exception {
     String table3 = getUniqueNames(1)[0];
     getConnector().tableOperations().create(table3);
     getConnector().tableOperations().addSplits(table3, splits);
-    BatchScanner bs = getConnector().createBatchScanner(table3, Authorizations.EMPTY, 3);
-    bs.setRanges(ranges);
-    Iterator<Entry<Key,Value>> iter = bs.iterator();
-    int count = Iterators.size(iter);
-    bs.close();
+    try (BatchScanner bs = getConnector().createBatchScanner(table3, Authorizations.EMPTY, 3)) {
+      bs.setRanges(ranges);
+      Iterator<Entry<Key,Value>> iter = bs.iterator();
+      int count = Iterators.size(iter);
 
-    Assert.assertEquals("Did not expect to find any entries", 0, count);
+      Assert.assertEquals("Did not expect to find any entries", 0, count);
+    }
   }
 
 }
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/CredentialsIT.java b/test/src/main/java/org/apache/accumulo/test/functional/CredentialsIT.java
index b383d0a866..59e78f6421 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/CredentialsIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/CredentialsIT.java
@@ -105,19 +105,20 @@ public void testConnectorWithDestroyedToken() throws Exception {
   public void testDestroyTokenBeforeRPC() throws Exception {
     AuthenticationToken token = getUser(0).getToken();
     Connector userConnector = inst.getConnector(username, token);
-    Scanner scanner = userConnector.createScanner(MetadataTable.NAME, Authorizations.EMPTY);
-    assertFalse(token.isDestroyed());
-    token.destroy();
-    assertTrue(token.isDestroyed());
-    try {
-      Iterator<Entry<Key,Value>> iter = scanner.iterator();
-      while (iter.hasNext())
+    try (Scanner scanner = userConnector.createScanner(MetadataTable.NAME, Authorizations.EMPTY)) {
+      assertFalse(token.isDestroyed());
+      token.destroy();
+      assertTrue(token.isDestroyed());
+      try {
+        Iterator<Entry<Key,Value>> iter = scanner.iterator();
+        while (iter.hasNext())
+          fail();
         fail();
-      fail();
-    } catch (Exception e) {
-      assertTrue(e instanceof RuntimeException);
-      assertTrue(e.getCause() instanceof AccumuloSecurityException);
-      assertTrue(AccumuloSecurityException.class.cast(e.getCause()).getSecurityErrorCode().equals(SecurityErrorCode.TOKEN_EXPIRED));
+      } catch (Exception e) {
+        assertTrue(e instanceof RuntimeException);
+        assertTrue(e.getCause() instanceof AccumuloSecurityException);
+        assertTrue(AccumuloSecurityException.class.cast(e.getCause()).getSecurityErrorCode().equals(SecurityErrorCode.TOKEN_EXPIRED));
+      }
     }
   }
 
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/DeleteEverythingIT.java b/test/src/main/java/org/apache/accumulo/test/functional/DeleteEverythingIT.java
index 7b21ca3c24..5416bf2840 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/DeleteEverythingIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/DeleteEverythingIT.java
@@ -97,22 +97,24 @@ public void run() throws Exception {
     bw.addMutation(m);
     bw.flush();
 
-    Scanner scanner = getConnector().createScanner(tableName, Authorizations.EMPTY);
-    scanner.setRange(new Range());
-    int count = Iterators.size(scanner.iterator());
-    assertEquals("count == " + count, 0, count);
-    getConnector().tableOperations().flush(tableName, null, null, true);
+    try (Scanner scanner = getConnector().createScanner(tableName, Authorizations.EMPTY)) {
+      scanner.setRange(new Range());
+      int count = Iterators.size(scanner.iterator());
+      assertEquals("count == " + count, 0, count);
+      getConnector().tableOperations().flush(tableName, null, null, true);
 
-    getConnector().tableOperations().setProperty(tableName, Property.TABLE_MAJC_RATIO.getKey(), "1.0");
-    sleepUninterruptibly(4, TimeUnit.SECONDS);
+      getConnector().tableOperations().setProperty(tableName, Property.TABLE_MAJC_RATIO.getKey(), "1.0");
+      sleepUninterruptibly(4, TimeUnit.SECONDS);
 
-    FunctionalTestUtils.checkRFiles(c, tableName, 1, 1, 0, 0);
+      FunctionalTestUtils.checkRFiles(c, tableName, 1, 1, 0, 0);
 
-    bw.close();
+      bw.close();
 
-    count = Iterables.size(scanner);
+      count = Iterables.size(scanner);
 
-    if (count != 0)
-      throw new Exception("count == " + count);
+      if (count != 0) {
+        throw new Exception("count == " + count);
+      }
+    }
   }
 }
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/DeleteRowsIT.java b/test/src/main/java/org/apache/accumulo/test/functional/DeleteRowsIT.java
index 0c0b2361a2..c371290a41 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/DeleteRowsIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/DeleteRowsIT.java
@@ -74,8 +74,9 @@ public void testDeleteAllRows() throws Exception {
     for (String tableName : tableNames) {
       c.tableOperations().create(tableName);
       c.tableOperations().deleteRows(tableName, null, null);
-      Scanner scanner = c.createScanner(tableName, Authorizations.EMPTY);
-      assertEquals(0, Iterators.size(scanner.iterator()));
+      try (Scanner scanner = c.createScanner(tableName, Authorizations.EMPTY)) {
+        assertEquals(0, Iterators.size(scanner.iterator()));
+      }
     }
   }
 
@@ -139,16 +140,17 @@ private void testSplit(String table, String start, String end, String result, in
       sb.append(split.toString());
     assertEquals(result, sb.toString());
     // See that the rows are really deleted
-    Scanner scanner = c.createScanner(table, Authorizations.EMPTY);
-    int count = 0;
-    for (Entry<Key,Value> entry : scanner) {
-      Text row = entry.getKey().getRow();
-      assertTrue((startText == null || row.compareTo(startText) <= 0) || (endText == null || row.compareTo(endText) > 0));
-      assertTrue(startText != null || endText != null);
-      count++;
+    try (Scanner scanner = c.createScanner(table, Authorizations.EMPTY)) {
+      int count = 0;
+      for (Entry<Key,Value> entry : scanner) {
+        Text row = entry.getKey().getRow();
+        assertTrue((startText == null || row.compareTo(startText) <= 0) || (endText == null || row.compareTo(endText) > 0));
+        assertTrue(startText != null || endText != null);
+        count++;
+      }
+      log.info("Finished table {}", table);
+      assertEquals(entries, count);
     }
-    log.info("Finished table {}", table);
-    assertEquals(entries, count);
   }
 
 }
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/DeleteRowsSplitIT.java b/test/src/main/java/org/apache/accumulo/test/functional/DeleteRowsSplitIT.java
index 107c4c51cf..6f07cf7224 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/DeleteRowsSplitIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/DeleteRowsSplitIT.java
@@ -112,14 +112,15 @@ public void run() {
       }
 
       // scan the table
-      Scanner scanner = conn.createScanner(tableName, Authorizations.EMPTY);
-      for (Entry<Key,Value> entry : scanner) {
-        Text row = entry.getKey().getRow();
-        assertTrue(row.compareTo(start) <= 0 || row.compareTo(end) > 0);
-      }
+      try (Scanner scanner = conn.createScanner(tableName, Authorizations.EMPTY)) {
+        for (Entry<Key,Value> entry : scanner) {
+          Text row = entry.getKey().getRow();
+          assertTrue(row.compareTo(start) <= 0 || row.compareTo(end) > 0);
+        }
 
-      // delete the table
-      conn.tableOperations().delete(tableName);
+        // delete the table
+        conn.tableOperations().delete(tableName);
+      }
     }
   }
 
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/FunctionalTestUtils.java b/test/src/main/java/org/apache/accumulo/test/functional/FunctionalTestUtils.java
index 07161d47a2..34922423b1 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/FunctionalTestUtils.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/FunctionalTestUtils.java
@@ -67,45 +67,46 @@
 public class FunctionalTestUtils {
 
   public static int countRFiles(Connector c, String tableName) throws Exception {
-    Scanner scanner = c.createScanner(MetadataTable.NAME, Authorizations.EMPTY);
-    Table.ID tableId = Table.ID.of(c.tableOperations().tableIdMap().get(tableName));
-    scanner.setRange(MetadataSchema.TabletsSection.getRange(tableId));
-    scanner.fetchColumnFamily(MetadataSchema.TabletsSection.DataFileColumnFamily.NAME);
-
-    return Iterators.size(scanner.iterator());
+    try (Scanner scanner = c.createScanner(MetadataTable.NAME, Authorizations.EMPTY)) {
+      Table.ID tableId = Table.ID.of(c.tableOperations().tableIdMap().get(tableName));
+      scanner.setRange(MetadataSchema.TabletsSection.getRange(tableId));
+      scanner.fetchColumnFamily(MetadataSchema.TabletsSection.DataFileColumnFamily.NAME);
+      return Iterators.size(scanner.iterator());
+    }
   }
 
   static void checkRFiles(Connector c, String tableName, int minTablets, int maxTablets, int minRFiles, int maxRFiles) throws Exception {
-    Scanner scanner = c.createScanner(MetadataTable.NAME, Authorizations.EMPTY);
-    String tableId = c.tableOperations().tableIdMap().get(tableName);
-    scanner.setRange(new Range(new Text(tableId + ";"), true, new Text(tableId + "<"), true));
-    scanner.fetchColumnFamily(MetadataSchema.TabletsSection.DataFileColumnFamily.NAME);
-    MetadataSchema.TabletsSection.TabletColumnFamily.PREV_ROW_COLUMN.fetch(scanner);
+    try (Scanner scanner = c.createScanner(MetadataTable.NAME, Authorizations.EMPTY)) {
+      String tableId = c.tableOperations().tableIdMap().get(tableName);
+      scanner.setRange(new Range(new Text(tableId + ";"), true, new Text(tableId + "<"), true));
+      scanner.fetchColumnFamily(MetadataSchema.TabletsSection.DataFileColumnFamily.NAME);
+      MetadataSchema.TabletsSection.TabletColumnFamily.PREV_ROW_COLUMN.fetch(scanner);
 
-    HashMap<Text,Integer> tabletFileCounts = new HashMap<>();
+      HashMap<Text,Integer> tabletFileCounts = new HashMap<>();
 
-    for (Entry<Key,Value> entry : scanner) {
+      for (Entry<Key,Value> entry : scanner) {
 
-      Text row = entry.getKey().getRow();
+        Text row = entry.getKey().getRow();
 
-      Integer count = tabletFileCounts.get(row);
-      if (count == null)
-        count = 0;
-      if (entry.getKey().getColumnFamily().equals(MetadataSchema.TabletsSection.DataFileColumnFamily.NAME)) {
-        count = count + 1;
-      }
+        Integer count = tabletFileCounts.get(row);
+        if (count == null)
+          count = 0;
+        if (entry.getKey().getColumnFamily().equals(MetadataSchema.TabletsSection.DataFileColumnFamily.NAME)) {
+          count = count + 1;
+        }
 
-      tabletFileCounts.put(row, count);
-    }
+        tabletFileCounts.put(row, count);
+      }
 
-    if (tabletFileCounts.size() < minTablets || tabletFileCounts.size() > maxTablets) {
-      throw new Exception("Did not find expected number of tablets " + tabletFileCounts.size());
-    }
+      if (tabletFileCounts.size() < minTablets || tabletFileCounts.size() > maxTablets) {
+        throw new Exception("Did not find expected number of tablets " + tabletFileCounts.size());
+      }
 
-    Set<Entry<Text,Integer>> es = tabletFileCounts.entrySet();
-    for (Entry<Text,Integer> entry : es) {
-      if (entry.getValue() > maxRFiles || entry.getValue() < minRFiles) {
-        throw new Exception("tablet " + entry.getKey() + " has " + entry.getValue() + " map files");
+      Set<Entry<Text,Integer>> es = tabletFileCounts.entrySet();
+      for (Entry<Text,Integer> entry : es) {
+        if (entry.getValue() > maxRFiles || entry.getValue() < minRFiles) {
+          throw new Exception("tablet " + entry.getKey() + " has " + entry.getValue() + " map files");
+        }
       }
     }
   }
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/GarbageCollectorIT.java b/test/src/main/java/org/apache/accumulo/test/functional/GarbageCollectorIT.java
index f5316033c2..bd5c8bc33c 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/GarbageCollectorIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/GarbageCollectorIT.java
@@ -180,8 +180,9 @@ public void dontGCRootLog() throws Exception {
     // run recovery
     cluster.start();
     // did it recover?
-    Scanner scanner = c.createScanner(MetadataTable.NAME, Authorizations.EMPTY);
-    Iterators.size(scanner.iterator());
+    try (Scanner scanner = c.createScanner(MetadataTable.NAME, Authorizations.EMPTY)) {
+      Iterators.size(scanner.iterator());
+    }
   }
 
   private Mutation createDelMutation(String path, String cf, String cq, String val) {
@@ -230,15 +231,16 @@ public void testInvalidDelete() throws Exception {
       gc.destroy();
     }
 
-    Scanner scanner = getConnector().createScanner(table, Authorizations.EMPTY);
-    Iterator<Entry<Key,Value>> iter = scanner.iterator();
-    assertTrue(iter.hasNext());
-    Entry<Key,Value> entry = iter.next();
-    Assert.assertEquals("r1", entry.getKey().getRow().toString());
-    Assert.assertEquals("cf1", entry.getKey().getColumnFamily().toString());
-    Assert.assertEquals("cq1", entry.getKey().getColumnQualifier().toString());
-    Assert.assertEquals("v1", entry.getValue().toString());
-    Assert.assertFalse(iter.hasNext());
+    try (Scanner scanner = getConnector().createScanner(table, Authorizations.EMPTY)) {
+      Iterator<Entry<Key,Value>> iter = scanner.iterator();
+      assertTrue(iter.hasNext());
+      Entry<Key,Value> entry = iter.next();
+      Assert.assertEquals("r1", entry.getKey().getRow().toString());
+      Assert.assertEquals("cf1", entry.getKey().getColumnFamily().toString());
+      Assert.assertEquals("cq1", entry.getKey().getColumnQualifier().toString());
+      Assert.assertEquals("v1", entry.getValue().toString());
+      Assert.assertFalse(iter.hasNext());
+    }
   }
 
   @Test
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/KerberosIT.java b/test/src/main/java/org/apache/accumulo/test/functional/KerberosIT.java
index d00e5a0584..4b46f5f8f2 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/KerberosIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/KerberosIT.java
@@ -377,14 +377,15 @@ public Void run() throws Exception {
         conn.tableOperations().setProperty(table, Property.TABLE_BLOOM_ENABLED.getKey(), "true");
 
         // Read (and proper authorizations)
-        Scanner s = conn.createScanner(table, new Authorizations(viz));
-        Iterator<Entry<Key,Value>> iter = s.iterator();
-        assertTrue("No results from iterator", iter.hasNext());
-        Entry<Key,Value> entry = iter.next();
-        assertEquals(new Key("a", "b", "c", viz, ts), entry.getKey());
-        assertEquals(new Value("d".getBytes()), entry.getValue());
-        assertFalse("Had more results from iterator", iter.hasNext());
-        return null;
+        try (Scanner s = conn.createScanner(table, new Authorizations(viz))) {
+          Iterator<Entry<Key,Value>> iter = s.iterator();
+          assertTrue("No results from iterator", iter.hasNext());
+          Entry<Key,Value> entry = iter.next();
+          assertEquals(new Key("a", "b", "c", viz, ts), entry.getKey());
+          assertEquals(new Value("d".getBytes()), entry.getValue());
+          assertFalse("Had more results from iterator", iter.hasNext());
+          return null;
+        }
       }
     });
   }
@@ -430,11 +431,11 @@ public AuthenticationToken run() throws Exception {
       public Integer run() throws Exception {
         Connector conn = mac.getConnector(rootUser.getPrincipal(), delegationToken);
 
-        BatchScanner bs = conn.createBatchScanner(tableName, Authorizations.EMPTY, 2);
-        bs.setRanges(Collections.singleton(new Range()));
-        int recordsSeen = Iterables.size(bs);
-        bs.close();
-        return recordsSeen;
+        try (BatchScanner bs = conn.createBatchScanner(tableName, Authorizations.EMPTY, 2)) {
+          bs.setRanges(Collections.singleton(new Range()));
+          int recordsSeen = Iterables.size(bs);
+          return recordsSeen;
+        }
       }
     });
 
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/KerberosProxyIT.java b/test/src/main/java/org/apache/accumulo/test/functional/KerberosProxyIT.java
index dced6dc193..3becc773b5 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/KerberosProxyIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/KerberosProxyIT.java
@@ -506,8 +506,7 @@ public Void run() throws Exception {
       public Void run() throws Exception {
         ZooKeeperInstance inst = new ZooKeeperInstance(mac.getClientConfig());
         Connector conn = inst.getConnector(proxyPrincipal, new KerberosToken());
-        try {
-          Scanner s = conn.createScanner(tableName, Authorizations.EMPTY);
+        try (Scanner s = conn.createScanner(tableName, Authorizations.EMPTY)) {
           s.iterator().hasNext();
           Assert.fail("Expected to see an exception");
         } catch (RuntimeException e) {
@@ -535,8 +534,7 @@ public Void run() throws Exception {
       public Void run() throws Exception {
         ZooKeeperInstance inst = new ZooKeeperInstance(mac.getClientConfig());
         Connector conn = inst.getConnector(userWithoutCredentials2, new KerberosToken(userWithoutCredentials3));
-        try {
-          Scanner s = conn.createScanner(tableName, Authorizations.EMPTY);
+        try (Scanner s = conn.createScanner(tableName, Authorizations.EMPTY)) {
           s.iterator().hasNext();
           Assert.fail("Expected to see an exception");
         } catch (RuntimeException e) {
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/KerberosRenewalIT.java b/test/src/main/java/org/apache/accumulo/test/functional/KerberosRenewalIT.java
index 4774f69b23..db9ef9d03a 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/KerberosRenewalIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/KerberosRenewalIT.java
@@ -182,10 +182,11 @@ private void createReadWriteDrop(Connector conn) throws TableNotFoundException,
     bw.addMutation(m);
     bw.close();
     conn.tableOperations().compact(table, new CompactionConfig().setFlush(true).setWait(true));
-    Scanner s = conn.createScanner(table, Authorizations.EMPTY);
-    Entry<Key,Value> entry = Iterables.getOnlyElement(s);
-    assertEquals("Did not find the expected key", 0, new Key("a", "b", "c").compareTo(entry.getKey(), PartialKey.ROW_COLFAM_COLQUAL));
-    assertEquals("d", entry.getValue().toString());
-    conn.tableOperations().delete(table);
+    try (Scanner s = conn.createScanner(table, Authorizations.EMPTY)) {
+      Entry<Key,Value> entry = Iterables.getOnlyElement(s);
+      assertEquals("Did not find the expected key", 0, new Key("a", "b", "c").compareTo(entry.getKey(), PartialKey.ROW_COLFAM_COLQUAL));
+      assertEquals("d", entry.getValue().toString());
+      conn.tableOperations().delete(table);
+    }
   }
 }
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/LargeRowIT.java b/test/src/main/java/org/apache/accumulo/test/functional/LargeRowIT.java
index 5630f81112..dae9355016 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/LargeRowIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/LargeRowIT.java
@@ -188,33 +188,33 @@ private void verify(Connector c, String table) throws Exception {
 
     r.setSeed(SEED);
 
-    Scanner scanner = c.createScanner(table, Authorizations.EMPTY);
+    try (Scanner scanner = c.createScanner(table, Authorizations.EMPTY)) {
 
-    for (int i = 0; i < NUM_ROWS; i++) {
+      for (int i = 0; i < NUM_ROWS; i++) {
 
-      r.nextBytes(rowData);
-      TestIngest.toPrintableChars(rowData);
+        r.nextBytes(rowData);
+        TestIngest.toPrintableChars(rowData);
 
-      scanner.setRange(new Range(new Text(rowData)));
+        scanner.setRange(new Range(new Text(rowData)));
 
-      int count = 0;
+        int count = 0;
 
-      for (Entry<Key,Value> entry : scanner) {
-        if (!entry.getKey().getRow().equals(new Text(rowData))) {
-          throw new Exception("verification failed, unexpected row i =" + i);
+        for (Entry<Key,Value> entry : scanner) {
+          if (!entry.getKey().getRow().equals(new Text(rowData))) {
+            throw new Exception("verification failed, unexpected row i =" + i);
+          }
+          if (!entry.getValue().equals(new Value(Integer.toString(i).getBytes(UTF_8)))) {
+            throw new Exception("verification failed, unexpected value i =" + i + " value = " + entry.getValue());
+          }
+          count++;
         }
-        if (!entry.getValue().equals(new Value(Integer.toString(i).getBytes(UTF_8)))) {
-          throw new Exception("verification failed, unexpected value i =" + i + " value = " + entry.getValue());
+
+        if (count != 1) {
+          throw new Exception("verification failed, unexpected count i =" + i + " count=" + count);
         }
-        count++;
-      }
 
-      if (count != 1) {
-        throw new Exception("verification failed, unexpected count i =" + i + " count=" + count);
       }
-
     }
-
   }
 
 }
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/LogicalTimeIT.java b/test/src/main/java/org/apache/accumulo/test/functional/LogicalTimeIT.java
index d92cd07fad..35695dd5ce 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/LogicalTimeIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/LogicalTimeIT.java
@@ -96,14 +96,16 @@ private void runMergeTest(Connector conn, String table, String[] splits, String[
     bw.addMutation(m);
     bw.flush();
 
-    Scanner scanner = conn.createScanner(table, Authorizations.EMPTY);
-    scanner.setRange(new Range(last));
+    try (Scanner scanner = conn.createScanner(table, Authorizations.EMPTY)) {
+      scanner.setRange(new Range(last));
 
-    bw.close();
+      bw.close();
 
-    long time = scanner.iterator().next().getKey().getTimestamp();
-    if (time != expected)
-      throw new RuntimeException("unexpected time " + time + " " + expected);
+      long time = scanner.iterator().next().getKey().getTimestamp();
+      if (time != expected) {
+        throw new RuntimeException("unexpected time " + time + " " + expected);
+      }
+    }
   }
 
 }
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/MapReduceIT.java b/test/src/main/java/org/apache/accumulo/test/functional/MapReduceIT.java
index fccf23c074..26fe5b7eb0 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/MapReduceIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/MapReduceIT.java
@@ -78,15 +78,15 @@ static void runTest(Connector c, MiniAccumuloClusterImpl cluster) throws Accumul
         .getZooKeepers(), "-u", "root", "-p", ROOT_PASSWORD, "-t", tablename, "--column", input_cfcq);
     assertEquals(0, hash.waitFor());
 
-    Scanner s = c.createScanner(tablename, Authorizations.EMPTY);
-    s.fetchColumn(new Text(input_cf), new Text(output_cq));
-    int i = 0;
-    for (Entry<Key,Value> entry : s) {
-      MessageDigest md = MessageDigest.getInstance("MD5");
-      byte[] check = Base64.getEncoder().encode(md.digest(("row" + i).getBytes()));
-      assertEquals(entry.getValue().toString(), new String(check));
-      i++;
+    try (Scanner s = c.createScanner(tablename, Authorizations.EMPTY)) {
+      s.fetchColumn(new Text(input_cf), new Text(output_cq));
+      int i = 0;
+      for (Entry<Key,Value> entry : s) {
+        MessageDigest md = MessageDigest.getInstance("MD5");
+        byte[] check = Base64.getEncoder().encode(md.digest(("row" + i).getBytes()));
+        assertEquals(entry.getValue().toString(), new String(check));
+        i++;
+      }
     }
-
   }
 }
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/MasterAssignmentIT.java b/test/src/main/java/org/apache/accumulo/test/functional/MasterAssignmentIT.java
index c6f7cd3eca..ce4ebd1ac5 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/MasterAssignmentIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/MasterAssignmentIT.java
@@ -92,9 +92,9 @@ public void test() throws Exception {
   private TabletLocationState getTabletLocationState(Connector c, String tableId) throws FileNotFoundException, ConfigurationException {
     Credentials creds = new Credentials(getAdminPrincipal(), getAdminToken());
     ClientContext context = new ClientContext(c.getInstance(), creds, getCluster().getClientConfig());
-    MetaDataTableScanner s = new MetaDataTableScanner(context, new Range(KeyExtent.getMetadataEntry(Table.ID.of(tableId), null)));
-    TabletLocationState tlState = s.next();
-    s.close();
-    return tlState;
+    try (MetaDataTableScanner s = new MetaDataTableScanner(context, new Range(KeyExtent.getMetadataEntry(Table.ID.of(tableId), null)))) {
+      TabletLocationState tlState = s.next();
+      return tlState;
+    }
   }
 }
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/MaxOpenIT.java b/test/src/main/java/org/apache/accumulo/test/functional/MaxOpenIT.java
index 102afaf13e..9362e33aed 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/MaxOpenIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/MaxOpenIT.java
@@ -135,42 +135,41 @@ public void run() throws Exception {
   }
 
   private long batchScan(Connector c, String tableName, List<Range> ranges, int threads) throws Exception {
-    BatchScanner bs = c.createBatchScanner(tableName, TestIngest.AUTHS, threads);
+    try (BatchScanner bs = c.createBatchScanner(tableName, TestIngest.AUTHS, threads)) {
 
-    bs.setRanges(ranges);
+      bs.setRanges(ranges);
 
-    int count = 0;
+      int count = 0;
 
-    long t1 = System.currentTimeMillis();
+      long t1 = System.currentTimeMillis();
 
-    byte rval[] = new byte[50];
-    Random random = new Random();
+      byte rval[] = new byte[50];
+      Random random = new Random();
 
-    for (Entry<Key,Value> entry : bs) {
-      count++;
-      int row = VerifyIngest.getRow(entry.getKey());
-      int col = VerifyIngest.getCol(entry.getKey());
+      for (Entry<Key,Value> entry : bs) {
+        count++;
+        int row = VerifyIngest.getRow(entry.getKey());
+        int col = VerifyIngest.getCol(entry.getKey());
 
-      if (row < 0 || row >= NUM_TO_INGEST) {
-        throw new Exception("unexcepted row " + row);
-      }
+        if (row < 0 || row >= NUM_TO_INGEST) {
+          throw new Exception("unexcepted row " + row);
+        }
 
-      rval = TestIngest.genRandomValue(random, rval, 2, row, col);
+        rval = TestIngest.genRandomValue(random, rval, 2, row, col);
 
-      if (entry.getValue().compareTo(rval) != 0) {
-        throw new Exception("unexcepted value row=" + row + " col=" + col);
+        if (entry.getValue().compareTo(rval) != 0) {
+          throw new Exception("unexcepted value row=" + row + " col=" + col);
+        }
       }
-    }
 
-    long t2 = System.currentTimeMillis();
+      long t2 = System.currentTimeMillis();
 
-    bs.close();
+      if (count != NUM_TO_INGEST) {
+        throw new Exception("Batch Scan did not return expected number of values " + count);
+      }
 
-    if (count != NUM_TO_INGEST) {
-      throw new Exception("Batch Scan did not return expected number of values " + count);
+      return t2 - t1;
     }
-
-    return t2 - t1;
   }
 
 }
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/MergeIT.java b/test/src/main/java/org/apache/accumulo/test/functional/MergeIT.java
index 3aaa13c446..fe8e477df6 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/MergeIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/MergeIT.java
@@ -175,30 +175,30 @@ private void runMergeTest(Connector conn, String table, String[] splits, String[
 
     conn.tableOperations().merge(table, start == null ? null : new Text(start), end == null ? null : new Text(end));
 
-    Scanner scanner = conn.createScanner(table, Authorizations.EMPTY);
+    try (Scanner scanner = conn.createScanner(table, Authorizations.EMPTY)) {
 
-    HashSet<String> observed = new HashSet<>();
-    for (Entry<Key,Value> entry : scanner) {
-      String row = entry.getKey().getRowData().toString();
-      if (!observed.add(row)) {
-        throw new Exception("Saw data twice " + table + " " + row);
+      HashSet<String> observed = new HashSet<>();
+      for (Entry<Key,Value> entry : scanner) {
+        String row = entry.getKey().getRowData().toString();
+        if (!observed.add(row)) {
+          throw new Exception("Saw data twice " + table + " " + row);
+        }
       }
-    }
 
-    if (!observed.equals(expected)) {
-      throw new Exception("data inconsistency " + table + " " + observed + " != " + expected);
-    }
+      if (!observed.equals(expected)) {
+        throw new Exception("data inconsistency " + table + " " + observed + " != " + expected);
+      }
 
-    HashSet<Text> currentSplits = new HashSet<>(conn.tableOperations().listSplits(table));
-    HashSet<Text> ess = new HashSet<>();
-    for (String es : expectedSplits) {
-      ess.add(new Text(es));
-    }
+      HashSet<Text> currentSplits = new HashSet<>(conn.tableOperations().listSplits(table));
+      HashSet<Text> ess = new HashSet<>();
+      for (String es : expectedSplits) {
+        ess.add(new Text(es));
+      }
 
-    if (!currentSplits.equals(ess)) {
-      throw new Exception("split inconsistency " + table + " " + currentSplits + " != " + ess);
+      if (!currentSplits.equals(ess)) {
+        throw new Exception("split inconsistency " + table + " " + currentSplits + " != " + ess);
+      }
     }
-
   }
 
   @Rule
@@ -217,8 +217,8 @@ public TestTabletIterator(Connector conn, String metadataTableName) throws Excep
 
     @Override
     protected void resetScanner() {
-      try {
-        Scanner ds = conn.createScanner(metadataTableName, Authorizations.EMPTY);
+      try (Scanner ds = conn.createScanner(metadataTableName, Authorizations.EMPTY)) {
+
         Text tablet = new KeyExtent(Table.ID.of("0"), new Text("m"), null).getMetadataEntry();
         ds.setRange(new Range(tablet, true, tablet, true));
 
@@ -229,11 +229,8 @@ protected void resetScanner() {
           Key k = entry.getKey();
           m.putDelete(k.getColumnFamily(), k.getColumnQualifier(), k.getTimestamp());
         }
-
         bw.addMutation(m);
-
         bw.close();
-
       } catch (Exception e) {
         throw new RuntimeException(e);
       }
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/MetadataIT.java b/test/src/main/java/org/apache/accumulo/test/functional/MetadataIT.java
index eb4e400ca7..eba45a41b0 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/MetadataIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/MetadataIT.java
@@ -67,33 +67,34 @@ public void testFlushAndCompact() throws Exception {
     // create a table to write some data to metadata table
     c.tableOperations().create(tableNames[0]);
 
-    Scanner rootScanner = c.createScanner(RootTable.NAME, Authorizations.EMPTY);
-    rootScanner.setRange(MetadataSchema.TabletsSection.getRange());
-    rootScanner.fetchColumnFamily(MetadataSchema.TabletsSection.DataFileColumnFamily.NAME);
+    try (Scanner rootScanner = c.createScanner(RootTable.NAME, Authorizations.EMPTY)) {
+      rootScanner.setRange(MetadataSchema.TabletsSection.getRange());
+      rootScanner.fetchColumnFamily(MetadataSchema.TabletsSection.DataFileColumnFamily.NAME);
 
-    Set<String> files1 = new HashSet<>();
-    for (Entry<Key,Value> entry : rootScanner)
-      files1.add(entry.getKey().getColumnQualifier().toString());
+      Set<String> files1 = new HashSet<>();
+      for (Entry<Key,Value> entry : rootScanner)
+        files1.add(entry.getKey().getColumnQualifier().toString());
 
-    c.tableOperations().create(tableNames[1]);
-    c.tableOperations().flush(MetadataTable.NAME, null, null, true);
+      c.tableOperations().create(tableNames[1]);
+      c.tableOperations().flush(MetadataTable.NAME, null, null, true);
 
-    Set<String> files2 = new HashSet<>();
-    for (Entry<Key,Value> entry : rootScanner)
-      files2.add(entry.getKey().getColumnQualifier().toString());
+      Set<String> files2 = new HashSet<>();
+      for (Entry<Key,Value> entry : rootScanner)
+        files2.add(entry.getKey().getColumnQualifier().toString());
 
-    // flush of metadata table should change file set in root table
-    Assert.assertTrue(files2.size() > 0);
-    Assert.assertNotEquals(files1, files2);
+      // flush of metadata table should change file set in root table
+      Assert.assertTrue(files2.size() > 0);
+      Assert.assertNotEquals(files1, files2);
 
-    c.tableOperations().compact(MetadataTable.NAME, null, null, false, true);
+      c.tableOperations().compact(MetadataTable.NAME, null, null, false, true);
 
-    Set<String> files3 = new HashSet<>();
-    for (Entry<Key,Value> entry : rootScanner)
-      files3.add(entry.getKey().getColumnQualifier().toString());
+      Set<String> files3 = new HashSet<>();
+      for (Entry<Key,Value> entry : rootScanner)
+        files3.add(entry.getKey().getColumnQualifier().toString());
 
-    // compaction of metadata table should change file set in root table
-    Assert.assertNotEquals(files2, files3);
+      // compaction of metadata table should change file set in root table
+      Assert.assertNotEquals(files2, files3);
+    }
   }
 
   @Test
@@ -109,12 +110,13 @@ public void mergeMeta() throws Exception {
       c.tableOperations().create(tableName);
     }
     c.tableOperations().merge(MetadataTable.NAME, null, null);
-    Scanner s = c.createScanner(RootTable.NAME, Authorizations.EMPTY);
-    s.setRange(MetadataSchema.DeletesSection.getRange());
-    while (Iterators.size(s.iterator()) == 0) {
-      sleepUninterruptibly(100, TimeUnit.MILLISECONDS);
+    try (Scanner s = c.createScanner(RootTable.NAME, Authorizations.EMPTY)) {
+      s.setRange(MetadataSchema.DeletesSection.getRange());
+      while (Iterators.size(s.iterator()) == 0) {
+        sleepUninterruptibly(100, TimeUnit.MILLISECONDS);
+      }
+      assertEquals(0, c.tableOperations().listSplits(MetadataTable.NAME).size());
     }
-    assertEquals(0, c.tableOperations().listSplits(MetadataTable.NAME).size());
   }
 
   @Test
@@ -124,26 +126,28 @@ public void batchScanTest() throws Exception {
     c.tableOperations().create(tableName);
 
     // batch scan regular metadata table
-    BatchScanner s = c.createBatchScanner(MetadataTable.NAME, Authorizations.EMPTY, 1);
-    s.setRanges(Collections.singleton(new Range()));
     int count = 0;
-    for (Entry<Key,Value> e : s) {
-      if (e != null)
-        count++;
+    try (BatchScanner s = c.createBatchScanner(MetadataTable.NAME, Authorizations.EMPTY, 1)) {
+
+      s.setRanges(Collections.singleton(new Range()));
+      for (Entry<Key,Value> e : s) {
+        if (e != null)
+          count++;
+      }
     }
-    s.close();
+
     assertTrue(count > 0);
 
     // batch scan root metadata table
-    s = c.createBatchScanner(RootTable.NAME, Authorizations.EMPTY, 1);
-    s.setRanges(Collections.singleton(new Range()));
-    count = 0;
-    for (Entry<Key,Value> e : s) {
-      if (e != null)
-        count++;
+    try (BatchScanner s = c.createBatchScanner(RootTable.NAME, Authorizations.EMPTY, 1)) {
+      s.setRanges(Collections.singleton(new Range()));
+      count = 0;
+      for (Entry<Key,Value> e : s) {
+        if (e != null)
+          count++;
+      }
+      assertTrue(count > 0);
     }
-    s.close();
-    assertTrue(count > 0);
   }
 
 }
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/PermissionsIT.java b/test/src/main/java/org/apache/accumulo/test/functional/PermissionsIT.java
index f02cd72c72..48681250b3 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/PermissionsIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/PermissionsIT.java
@@ -571,7 +571,6 @@ private void createTestTable(Connector c, String testUser, String tableName) thr
   }
 
   private void testMissingTablePermission(Connector test_user_conn, ClusterUser testUser, TablePermission perm, String tableName) throws Exception {
-    Scanner scanner;
     BatchWriter writer;
     Mutation m;
     log.debug("Confirming that the lack of the {} permission properly restricts the user", perm);
@@ -579,13 +578,13 @@ private void testMissingTablePermission(Connector test_user_conn, ClusterUser te
     // test permission prior to granting it
     switch (perm) {
       case READ:
-        try {
-          scanner = test_user_conn.createScanner(tableName, Authorizations.EMPTY);
+        try (Scanner scanner = test_user_conn.createScanner(tableName, Authorizations.EMPTY)) {
           int i = 0;
           for (Entry<Key,Value> entry : scanner)
             i += 1 + entry.getKey().getRowData().length();
-          if (i != 0)
+          if (i != 0) {
             throw new IllegalStateException("Should NOT be able to read from the table");
+          }
         } catch (RuntimeException e) {
           AccumuloSecurityException se = (AccumuloSecurityException) e.getCause();
           if (se.getSecurityErrorCode() != SecurityErrorCode.PERMISSION_DENIED)
@@ -658,7 +657,6 @@ private void testMissingTablePermission(Connector test_user_conn, ClusterUser te
 
   private void testGrantedTablePermission(Connector test_user_conn, ClusterUser normalUser, TablePermission perm, String tableName) throws AccumuloException,
       TableExistsException, AccumuloSecurityException, TableNotFoundException, MutationsRejectedException {
-    Scanner scanner;
     BatchWriter writer;
     Mutation m;
     log.debug("Confirming that the presence of the {} permission properly permits the user", perm);
@@ -666,10 +664,11 @@ private void testGrantedTablePermission(Connector test_user_conn, ClusterUser no
     // test permission after granting it
     switch (perm) {
       case READ:
-        scanner = test_user_conn.createScanner(tableName, Authorizations.EMPTY);
-        Iterator<Entry<Key,Value>> iter = scanner.iterator();
-        while (iter.hasNext())
-          iter.next();
+        try (Scanner scanner = test_user_conn.createScanner(tableName, Authorizations.EMPTY)) {
+          Iterator<Entry<Key,Value>> iter = scanner.iterator();
+          while (iter.hasNext())
+            iter.next();
+        }
         break;
       case WRITE:
         writer = test_user_conn.createBatchWriter(tableName, new BatchWriterConfig());
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/ReadWriteIT.java b/test/src/main/java/org/apache/accumulo/test/functional/ReadWriteIT.java
index e961b74002..d4a4c32d37 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/ReadWriteIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/ReadWriteIT.java
@@ -384,14 +384,17 @@ public void localityGroupPerf() throws Exception {
     bw.addMutation(m("zzzzzzzzzzz", "colf2", "cq", "value"));
     bw.close();
     long now = System.currentTimeMillis();
-    Scanner scanner = connector.createScanner(tableName, Authorizations.EMPTY);
-    scanner.fetchColumnFamily(new Text("colf"));
-    Iterators.size(scanner.iterator());
+    try (Scanner scanner = connector.createScanner(tableName, Authorizations.EMPTY)) {
+      scanner.fetchColumnFamily(new Text("colf"));
+      Iterators.size(scanner.iterator());
+    }
     long diff = System.currentTimeMillis() - now;
     now = System.currentTimeMillis();
-    scanner = connector.createScanner(tableName, Authorizations.EMPTY);
-    scanner.fetchColumnFamily(new Text("colf2"));
-    Iterators.size(scanner.iterator());
+
+    try (Scanner scanner = connector.createScanner(tableName, Authorizations.EMPTY)) {
+      scanner.fetchColumnFamily(new Text("colf2"));
+      Iterators.size(scanner.iterator());
+    }
     bw.close();
     long diff2 = System.currentTimeMillis() - now;
     assertTrue(diff2 < diff);
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/RecoveryWithEmptyRFileIT.java b/test/src/main/java/org/apache/accumulo/test/functional/RecoveryWithEmptyRFileIT.java
index 5c2e1a18f4..1f11b20acc 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/RecoveryWithEmptyRFileIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/RecoveryWithEmptyRFileIT.java
@@ -74,36 +74,36 @@ public void replaceMissingRFile() throws Exception {
     connector.tableOperations().offline(tableName, true);
 
     log.debug("Replacing rfile(s) with empty");
-    Scanner meta = connector.createScanner(MetadataTable.NAME, Authorizations.EMPTY);
-    String tableId = connector.tableOperations().tableIdMap().get(tableName);
-    meta.setRange(new Range(new Text(tableId + ";"), new Text(tableId + "<")));
-    meta.fetchColumnFamily(DataFileColumnFamily.NAME);
-    boolean foundFile = false;
-    for (Entry<Key,Value> entry : meta) {
-      foundFile = true;
-      Path rfile = new Path(entry.getKey().getColumnQualifier().toString());
-      log.debug("Removing rfile '{}'", rfile);
-      cluster.getFileSystem().delete(rfile, false);
-      Process info = cluster.exec(CreateEmpty.class, rfile.toString());
-      assertEquals(0, info.waitFor());
+    try (Scanner meta = connector.createScanner(MetadataTable.NAME, Authorizations.EMPTY)) {
+      String tableId = connector.tableOperations().tableIdMap().get(tableName);
+      meta.setRange(new Range(new Text(tableId + ";"), new Text(tableId + "<")));
+      meta.fetchColumnFamily(DataFileColumnFamily.NAME);
+      boolean foundFile = false;
+      for (Entry<Key,Value> entry : meta) {
+        foundFile = true;
+        Path rfile = new Path(entry.getKey().getColumnQualifier().toString());
+        log.debug("Removing rfile '{}'", rfile);
+        cluster.getFileSystem().delete(rfile, false);
+        Process info = cluster.exec(CreateEmpty.class, rfile.toString());
+        assertEquals(0, info.waitFor());
+      }
+      assertTrue(foundFile);
     }
-    meta.close();
-    assertTrue(foundFile);
 
     log.trace("invalidate cached file handles by issuing a compaction");
     connector.tableOperations().online(tableName, true);
     connector.tableOperations().compact(tableName, null, null, false, true);
 
     log.debug("make sure we can still scan");
-    Scanner scan = connector.createScanner(tableName, Authorizations.EMPTY);
-    scan.setRange(new Range());
-    long cells = 0l;
-    for (Entry<Key,Value> entry : scan) {
-      if (entry != null)
-        cells++;
+    try (Scanner scan = connector.createScanner(tableName, Authorizations.EMPTY)) {
+      scan.setRange(new Range());
+      long cells = 0l;
+      for (Entry<Key,Value> entry : scan) {
+        if (entry != null)
+          cells++;
+      }
+      assertEquals(0l, cells);
     }
-    scan.close();
-    assertEquals(0l, cells);
   }
 
 }
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/RegexGroupBalanceIT.java b/test/src/main/java/org/apache/accumulo/test/functional/RegexGroupBalanceIT.java
index c77ecccbc1..ca41415e14 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/RegexGroupBalanceIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/RegexGroupBalanceIT.java
@@ -163,31 +163,32 @@ private boolean checkGroup(Table<String,String,MutableInt> groupLocationCounts,
   }
 
   private Table<String,String,MutableInt> getCounts(Connector conn, String tablename) throws TableNotFoundException {
-    Scanner s = conn.createScanner(MetadataTable.NAME, Authorizations.EMPTY);
-    s.fetchColumnFamily(MetadataSchema.TabletsSection.CurrentLocationColumnFamily.NAME);
-    org.apache.accumulo.core.client.impl.Table.ID tableId = org.apache.accumulo.core.client.impl.Table.ID
-        .of(conn.tableOperations().tableIdMap().get(tablename));
-    s.setRange(MetadataSchema.TabletsSection.getRange(tableId));
-
-    Table<String,String,MutableInt> groupLocationCounts = HashBasedTable.create();
-
-    for (Entry<Key,Value> entry : s) {
-      String group = entry.getKey().getRow().toString();
-      if (group.endsWith("<")) {
-        group = "03";
-      } else {
-        group = group.substring(tableId.canonicalID().length() + 1).substring(0, 2);
+    try (Scanner s = conn.createScanner(MetadataTable.NAME, Authorizations.EMPTY)) {
+      s.fetchColumnFamily(MetadataSchema.TabletsSection.CurrentLocationColumnFamily.NAME);
+      org.apache.accumulo.core.client.impl.Table.ID tableId = org.apache.accumulo.core.client.impl.Table.ID.of(conn.tableOperations().tableIdMap()
+          .get(tablename));
+      s.setRange(MetadataSchema.TabletsSection.getRange(tableId));
+
+      Table<String,String,MutableInt> groupLocationCounts = HashBasedTable.create();
+
+      for (Entry<Key,Value> entry : s) {
+        String group = entry.getKey().getRow().toString();
+        if (group.endsWith("<")) {
+          group = "03";
+        } else {
+          group = group.substring(tableId.canonicalID().length() + 1).substring(0, 2);
+        }
+        String loc = new TServerInstance(entry.getValue(), entry.getKey().getColumnQualifier()).toString();
+
+        MutableInt count = groupLocationCounts.get(group, loc);
+        if (count == null) {
+          count = new MutableInt(0);
+          groupLocationCounts.put(group, loc, count);
+        }
+
+        count.increment();
       }
-      String loc = new TServerInstance(entry.getValue(), entry.getKey().getColumnQualifier()).toString();
-
-      MutableInt count = groupLocationCounts.get(group, loc);
-      if (count == null) {
-        count = new MutableInt(0);
-        groupLocationCounts.put(group, loc, count);
-      }
-
-      count.increment();
+      return groupLocationCounts;
     }
-    return groupLocationCounts;
   }
 }
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/RowDeleteIT.java b/test/src/main/java/org/apache/accumulo/test/functional/RowDeleteIT.java
index 74d76b8ec0..9db3615d83 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/RowDeleteIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/RowDeleteIT.java
@@ -80,30 +80,33 @@ public void run() throws Exception {
 
     checkRFiles(c, tableName, 1, 1, 1, 1);
 
-    Scanner scanner = c.createScanner(tableName, Authorizations.EMPTY);
-    int count = Iterators.size(scanner.iterator());
-    assertEquals("count == " + count, 2, count);
+    int count;
+    try (Scanner scanner = c.createScanner(tableName, Authorizations.EMPTY)) {
+      count = Iterators.size(scanner.iterator());
+      assertEquals("count == " + count, 2, count);
 
-    bw.addMutation(nm("r1", "", "", RowDeletingIterator.DELETE_ROW_VALUE));
+      bw.addMutation(nm("r1", "", "", RowDeletingIterator.DELETE_ROW_VALUE));
 
-    bw.flush();
-    c.tableOperations().flush(tableName, null, null, true);
-
-    checkRFiles(c, tableName, 1, 1, 2, 2);
+      bw.flush();
+      c.tableOperations().flush(tableName, null, null, true);
 
-    scanner = c.createScanner(tableName, Authorizations.EMPTY);
-    count = Iterators.size(scanner.iterator());
-    assertEquals("count == " + count, 3, count);
+      checkRFiles(c, tableName, 1, 1, 2, 2);
+    }
 
-    c.tableOperations().compact(tableName, null, null, false, true);
+    try (Scanner scanner = c.createScanner(tableName, Authorizations.EMPTY)) {
+      count = Iterators.size(scanner.iterator());
+      assertEquals("count == " + count, 3, count);
 
-    checkRFiles(c, tableName, 1, 1, 0, 0);
+      c.tableOperations().compact(tableName, null, null, false, true);
 
-    scanner = c.createScanner(tableName, Authorizations.EMPTY);
-    count = Iterators.size(scanner.iterator());
-    assertEquals("count == " + count, 0, count);
-    bw.close();
+      checkRFiles(c, tableName, 1, 1, 0, 0);
+    }
 
+    try (Scanner scanner = c.createScanner(tableName, Authorizations.EMPTY)) {
+      count = Iterators.size(scanner.iterator());
+      assertEquals("count == " + count, 0, count);
+      bw.close();
+    }
   }
 
 }
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/ScanIdIT.java b/test/src/main/java/org/apache/accumulo/test/functional/ScanIdIT.java
index c82e302340..3b3a1ede66 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/ScanIdIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/ScanIdIT.java
@@ -230,46 +230,46 @@ public void run() {
         // create different ranges to try to hit more than one tablet.
         scanner.setRange(new Range(new Text(Integer.toString(workerIndex)), new Text("9")));
 
-      } catch (TableNotFoundException e) {
-        throw new IllegalStateException("Initialization failure. Could not create scanner", e);
-      }
-
-      scanner.fetchColumnFamily(new Text("fam1"));
+        scanner.fetchColumnFamily(new Text("fam1"));
 
-      for (Map.Entry<Key,Value> entry : scanner) {
+        for (Map.Entry<Key,Value> entry : scanner) {
 
-        // exit when success condition is met.
-        if (!testInProgress.get()) {
-          scanner.clearScanIterators();
-          scanner.close();
-
-          return;
-        }
+          // exit when success condition is met.
+          if (!testInProgress.get()) {
+            scanner.clearScanIterators();
+            scanner.close();
+            return;
+          }
 
-        Text row = entry.getKey().getRow();
+          Text row = entry.getKey().getRow();
 
-        log.debug("worker {}, row {}", workerIndex, row.toString());
+          log.debug("worker {}, row {}", workerIndex, row.toString());
 
-        if (entry.getValue() != null) {
+          if (entry.getValue() != null) {
 
-          Value prevValue = resultsByWorker.put(workerIndex, entry.getValue());
+            Value prevValue = resultsByWorker.put(workerIndex, entry.getValue());
 
-          // value should always being increasing
-          if (prevValue != null) {
+            // value should always being increasing
+            if (prevValue != null) {
 
-            log.trace("worker {} values {}", workerIndex, String.format("%1$s < %2$s", prevValue, entry.getValue()));
+              log.trace("worker {} values {}", workerIndex, String.format("%1$s < %2$s", prevValue, entry.getValue()));
 
-            assertTrue(prevValue.compareTo(entry.getValue()) > 0);
+              assertTrue(prevValue.compareTo(entry.getValue()) > 0);
+            }
+          } else {
+            log.info("Scanner returned null");
+            fail("Scanner returned unexpected null value");
           }
-        } else {
-          log.info("Scanner returned null");
-          fail("Scanner returned unexpected null value");
-        }
 
+        }
+        log.debug("Scanner ran out of data. (info only, not an error) ");
+      } catch (TableNotFoundException e) {
+        throw new IllegalStateException("Initialization failure. Could not create scanner", e);
+      } finally {
+        if (scanner != null) {
+          scanner.close();
+        }
       }
-
-      log.debug("Scanner ran out of data. (info only, not an error) ");
-
     }
   }
 
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/ScanIteratorIT.java b/test/src/main/java/org/apache/accumulo/test/functional/ScanIteratorIT.java
index 662cf7524a..9a3fd3f5a6 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/ScanIteratorIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/ScanIteratorIT.java
@@ -124,46 +124,43 @@ public void run() throws Exception {
 
     bw.close();
 
-    Scanner scanner = c.createScanner(tableName, new Authorizations());
-
-    setupIter(scanner);
-    verify(scanner, 1, 999);
-
-    BatchScanner bscanner = c.createBatchScanner(tableName, new Authorizations(), 3);
-    bscanner.setRanges(Collections.singleton(new Range((Key) null, null)));
-
-    setupIter(bscanner);
-    verify(bscanner, 1, 999);
-
-    ArrayList<Range> ranges = new ArrayList<>();
-    ranges.add(new Range(new Text(String.format("%06d", 1))));
-    ranges.add(new Range(new Text(String.format("%06d", 6)), new Text(String.format("%06d", 16))));
-    ranges.add(new Range(new Text(String.format("%06d", 20))));
-    ranges.add(new Range(new Text(String.format("%06d", 23))));
-    ranges.add(new Range(new Text(String.format("%06d", 56)), new Text(String.format("%06d", 61))));
-    ranges.add(new Range(new Text(String.format("%06d", 501)), new Text(String.format("%06d", 504))));
-    ranges.add(new Range(new Text(String.format("%06d", 998)), new Text(String.format("%06d", 1000))));
-
-    HashSet<Integer> got = new HashSet<>();
-    HashSet<Integer> expected = new HashSet<>();
-    for (int i : new int[] {1, 7, 9, 11, 13, 15, 23, 57, 59, 61, 501, 503, 999}) {
-      expected.add(i);
-    }
+    try (Scanner scanner = c.createScanner(tableName, new Authorizations()); BatchScanner bscanner = c.createBatchScanner(tableName, new Authorizations(), 3)) {
 
-    bscanner.setRanges(ranges);
+      setupIter(scanner);
+      verify(scanner, 1, 999);
 
-    for (Entry<Key,Value> entry : bscanner) {
-      got.add(Integer.parseInt(entry.getKey().getRow().toString()));
-    }
+      bscanner.setRanges(Collections.singleton(new Range((Key) null, null)));
 
-    System.out.println("got : " + got);
+      setupIter(bscanner);
+      verify(bscanner, 1, 999);
 
-    if (!got.equals(expected)) {
-      throw new Exception(got + " != " + expected);
-    }
+      ArrayList<Range> ranges = new ArrayList<>();
+      ranges.add(new Range(new Text(String.format("%06d", 1))));
+      ranges.add(new Range(new Text(String.format("%06d", 6)), new Text(String.format("%06d", 16))));
+      ranges.add(new Range(new Text(String.format("%06d", 20))));
+      ranges.add(new Range(new Text(String.format("%06d", 23))));
+      ranges.add(new Range(new Text(String.format("%06d", 56)), new Text(String.format("%06d", 61))));
+      ranges.add(new Range(new Text(String.format("%06d", 501)), new Text(String.format("%06d", 504))));
+      ranges.add(new Range(new Text(String.format("%06d", 998)), new Text(String.format("%06d", 1000))));
+
+      HashSet<Integer> got = new HashSet<>();
+      HashSet<Integer> expected = new HashSet<>();
+      for (int i : new int[] {1, 7, 9, 11, 13, 15, 23, 57, 59, 61, 501, 503, 999}) {
+        expected.add(i);
+      }
+
+      bscanner.setRanges(ranges);
 
-    bscanner.close();
+      for (Entry<Key,Value> entry : bscanner) {
+        got.add(Integer.parseInt(entry.getKey().getRow().toString()));
+      }
+
+      System.out.println("got : " + got);
 
+      if (!got.equals(expected)) {
+        throw new Exception(got + " != " + expected);
+      }
+    }
   }
 
   private void verify(Iterable<Entry<Key,Value>> scanner, int start, int finish) throws Exception {
@@ -224,18 +221,15 @@ private void runTest(Authorizations auths, boolean shouldFail) throws Exception
 
     IteratorSetting setting = new IteratorSetting(10, AuthsIterator.class);
 
-    Scanner scanner = userC.createScanner(tableName, auths);
-    scanner.addScanIterator(setting);
-
-    BatchScanner batchScanner = userC.createBatchScanner(tableName, auths, 1);
-    batchScanner.setRanges(Collections.singleton(new Range("1")));
-    batchScanner.addScanIterator(setting);
+    try (Scanner scanner = userC.createScanner(tableName, auths); BatchScanner batchScanner = userC.createBatchScanner(tableName, auths, 1)) {
+      scanner.addScanIterator(setting);
 
-    runTest(scanner, auths, shouldFail);
-    runTest(batchScanner, auths, shouldFail);
+      batchScanner.setRanges(Collections.singleton(new Range("1")));
+      batchScanner.addScanIterator(setting);
 
-    scanner.close();
-    batchScanner.close();
+      runTest(scanner, auths, shouldFail);
+      runTest(batchScanner, auths, shouldFail);
+    }
   }
 
   private void writeTestMutation(Connector userC) throws TableNotFoundException, MutationsRejectedException {
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/ScanRangeIT.java b/test/src/main/java/org/apache/accumulo/test/functional/ScanRangeIT.java
index 7ab96c44a1..fe4fec320f 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/ScanRangeIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/ScanRangeIT.java
@@ -157,52 +157,53 @@ private void scanRange(Connector c, String table, IntKey ik1, IntKey ik2) throws
   }
 
   private void scanRange(Connector c, String table, IntKey ik1, boolean inclusive1, IntKey ik2, boolean inclusive2) throws Exception {
-    Scanner scanner = c.createScanner(table, Authorizations.EMPTY);
+    try (Scanner scanner = c.createScanner(table, Authorizations.EMPTY)) {
 
-    Key key1 = null;
-    Key key2 = null;
+      Key key1 = null;
+      Key key2 = null;
 
-    IntKey expectedIntKey;
-    IntKey expectedEndIntKey;
+      IntKey expectedIntKey;
+      IntKey expectedEndIntKey;
 
-    if (ik1 != null) {
-      key1 = ik1.createKey();
-      expectedIntKey = ik1;
+      if (ik1 != null) {
+        key1 = ik1.createKey();
+        expectedIntKey = ik1;
 
-      if (!inclusive1) {
-        expectedIntKey = expectedIntKey.increment();
+        if (!inclusive1) {
+          expectedIntKey = expectedIntKey.increment();
+        }
+      } else {
+        expectedIntKey = new IntKey(0, 0, 0, 0);
       }
-    } else {
-      expectedIntKey = new IntKey(0, 0, 0, 0);
-    }
 
-    if (ik2 != null) {
-      key2 = ik2.createKey();
-      expectedEndIntKey = ik2;
+      if (ik2 != null) {
+        key2 = ik2.createKey();
+        expectedEndIntKey = ik2;
 
-      if (inclusive2) {
-        expectedEndIntKey = expectedEndIntKey.increment();
+        if (inclusive2) {
+          expectedEndIntKey = expectedEndIntKey.increment();
+        }
+      } else {
+        expectedEndIntKey = new IntKey(ROW_LIMIT, 0, 0, 0);
       }
-    } else {
-      expectedEndIntKey = new IntKey(ROW_LIMIT, 0, 0, 0);
-    }
 
-    Range range = new Range(key1, inclusive1, key2, inclusive2);
+      Range range = new Range(key1, inclusive1, key2, inclusive2);
 
-    scanner.setRange(range);
+      scanner.setRange(range);
 
-    for (Entry<Key,Value> entry : scanner) {
+      for (Entry<Key,Value> entry : scanner) {
 
-      Key expectedKey = expectedIntKey.createKey();
-      if (!expectedKey.equals(entry.getKey())) {
-        throw new Exception(" " + expectedKey + " != " + entry.getKey());
-      }
+        Key expectedKey = expectedIntKey.createKey();
+        if (!expectedKey.equals(entry.getKey())) {
+          throw new Exception(" " + expectedKey + " != " + entry.getKey());
+        }
 
-      expectedIntKey = expectedIntKey.increment();
-    }
+        expectedIntKey = expectedIntKey.increment();
+      }
 
-    if (!expectedIntKey.createKey().equals(expectedEndIntKey.createKey())) {
-      throw new Exception(" " + expectedIntKey.createKey() + " != " + expectedEndIntKey.createKey());
+      if (!expectedIntKey.createKey().equals(expectedEndIntKey.createKey())) {
+        throw new Exception(" " + expectedIntKey.createKey() + " != " + expectedEndIntKey.createKey());
+      }
     }
   }
 
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/ScanSessionTimeOutIT.java b/test/src/main/java/org/apache/accumulo/test/functional/ScanSessionTimeOutIT.java
index ec3fdbaba5..c16c2705eb 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/ScanSessionTimeOutIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/ScanSessionTimeOutIT.java
@@ -106,18 +106,18 @@ public void run() throws Exception {
 
     bw.close();
 
-    Scanner scanner = c.createScanner(tableName, new Authorizations());
-    scanner.setBatchSize(1000);
+    try (Scanner scanner = c.createScanner(tableName, new Authorizations())) {
+      scanner.setBatchSize(1000);
 
-    Iterator<Entry<Key,Value>> iter = scanner.iterator();
+      Iterator<Entry<Key,Value>> iter = scanner.iterator();
 
-    verify(iter, 0, 200);
+      verify(iter, 0, 200);
 
-    // sleep three times the session timeout
-    sleepUninterruptibly(9, TimeUnit.SECONDS);
-
-    verify(iter, 200, 100000);
+      // sleep three times the session timeout
+      sleepUninterruptibly(9, TimeUnit.SECONDS);
 
+      verify(iter, 200, 100000);
+    }
   }
 
   protected void verify(Iterator<Entry<Key,Value>> iter, int start, int stop) throws Exception {
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/ScannerContextIT.java b/test/src/main/java/org/apache/accumulo/test/functional/ScannerContextIT.java
index 579881ef26..cebe0344ff 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/ScannerContextIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/ScannerContextIT.java
@@ -206,28 +206,26 @@ public void testOneScannerDoesntInterfereWithAnother() throws Exception {
       }
       bw.close();
 
-      Scanner one = c.createScanner(tableName, Authorizations.EMPTY);
-
-      Scanner two = c.createScanner(tableName, Authorizations.EMPTY);
-
-      IteratorSetting cfg = new IteratorSetting(21, "reverse", "org.apache.accumulo.test.functional.ValueReversingIterator");
-      one.addScanIterator(cfg);
-      one.setClassLoaderContext(CONTEXT);
-
-      Iterator<Entry<Key,Value>> iterator = one.iterator();
-      for (int i = 0; i < ITERATIONS; i++) {
-        assertTrue(iterator.hasNext());
-        Entry<Key,Value> next = iterator.next();
-        assertEquals("tseT", next.getValue().toString());
-      }
-
-      Iterator<Entry<Key,Value>> iterator2 = two.iterator();
-      for (int i = 0; i < ITERATIONS; i++) {
-        assertTrue(iterator2.hasNext());
-        Entry<Key,Value> next = iterator2.next();
-        assertEquals("Test", next.getValue().toString());
+      try (Scanner one = c.createScanner(tableName, Authorizations.EMPTY); Scanner two = c.createScanner(tableName, Authorizations.EMPTY)) {
+
+        IteratorSetting cfg = new IteratorSetting(21, "reverse", "org.apache.accumulo.test.functional.ValueReversingIterator");
+        one.addScanIterator(cfg);
+        one.setClassLoaderContext(CONTEXT);
+
+        Iterator<Entry<Key,Value>> iterator = one.iterator();
+        for (int i = 0; i < ITERATIONS; i++) {
+          assertTrue(iterator.hasNext());
+          Entry<Key,Value> next = iterator.next();
+          assertEquals("tseT", next.getValue().toString());
+        }
+
+        Iterator<Entry<Key,Value>> iterator2 = two.iterator();
+        for (int i = 0; i < ITERATIONS; i++) {
+          assertTrue(iterator2.hasNext());
+          Entry<Key,Value> next = iterator2.next();
+          assertEquals("Test", next.getValue().toString());
+        }
       }
-
     } finally {
       // Delete file in tmp
       fs.delete(dstPath, true);
@@ -253,27 +251,27 @@ public void testClearContext() throws Exception {
       }
       bw.close();
 
-      Scanner one = c.createScanner(tableName, Authorizations.EMPTY);
-      IteratorSetting cfg = new IteratorSetting(21, "reverse", "org.apache.accumulo.test.functional.ValueReversingIterator");
-      one.addScanIterator(cfg);
-      one.setClassLoaderContext(CONTEXT);
-
-      Iterator<Entry<Key,Value>> iterator = one.iterator();
-      for (int i = 0; i < ITERATIONS; i++) {
-        assertTrue(iterator.hasNext());
-        Entry<Key,Value> next = iterator.next();
-        assertEquals("tseT", next.getValue().toString());
+      try (Scanner one = c.createScanner(tableName, Authorizations.EMPTY)) {
+        IteratorSetting cfg = new IteratorSetting(21, "reverse", "org.apache.accumulo.test.functional.ValueReversingIterator");
+        one.addScanIterator(cfg);
+        one.setClassLoaderContext(CONTEXT);
+
+        Iterator<Entry<Key,Value>> iterator = one.iterator();
+        for (int i = 0; i < ITERATIONS; i++) {
+          assertTrue(iterator.hasNext());
+          Entry<Key,Value> next = iterator.next();
+          assertEquals("tseT", next.getValue().toString());
+        }
+
+        one.removeScanIterator("reverse");
+        one.clearClassLoaderContext();
+        iterator = one.iterator();
+        for (int i = 0; i < ITERATIONS; i++) {
+          assertTrue(iterator.hasNext());
+          Entry<Key,Value> next = iterator.next();
+          assertEquals("Test", next.getValue().toString());
+        }
       }
-
-      one.removeScanIterator("reverse");
-      one.clearClassLoaderContext();
-      iterator = one.iterator();
-      for (int i = 0; i < ITERATIONS; i++) {
-        assertTrue(iterator.hasNext());
-        Entry<Key,Value> next = iterator.next();
-        assertEquals("Test", next.getValue().toString());
-      }
-
     } finally {
       // Delete file in tmp
       fs.delete(dstPath, true);
@@ -281,26 +279,26 @@ public void testClearContext() throws Exception {
   }
 
   private void scanCheck(Connector c, String tableName, IteratorSetting cfg, String context, String expected) throws Exception {
-    Scanner bs = c.createScanner(tableName, Authorizations.EMPTY);
-    if (null != context) {
-      bs.setClassLoaderContext(context);
-    }
-    if (null != cfg) {
-      bs.addScanIterator(cfg);
-    }
-    Iterator<Entry<Key,Value>> iterator = bs.iterator();
-    for (int i = 0; i < ITERATIONS; i++) {
-      assertTrue(iterator.hasNext());
-      Entry<Key,Value> next = iterator.next();
-      assertEquals(expected, next.getValue().toString());
+    try (Scanner bs = c.createScanner(tableName, Authorizations.EMPTY)) {
+      if (null != context) {
+        bs.setClassLoaderContext(context);
+      }
+      if (null != cfg) {
+        bs.addScanIterator(cfg);
+      }
+      Iterator<Entry<Key,Value>> iterator = bs.iterator();
+      for (int i = 0; i < ITERATIONS; i++) {
+        assertTrue(iterator.hasNext());
+        Entry<Key,Value> next = iterator.next();
+        assertEquals(expected, next.getValue().toString());
+      }
+      assertFalse(iterator.hasNext());
     }
-    assertFalse(iterator.hasNext());
   }
 
   private void batchCheck(Connector c, String tableName, IteratorSetting cfg, String context, String expected) throws Exception {
-    BatchScanner bs = c.createBatchScanner(tableName, Authorizations.EMPTY, 1);
-    bs.setRanges(Collections.singleton(new Range()));
-    try {
+    try (BatchScanner bs = c.createBatchScanner(tableName, Authorizations.EMPTY, 1)) {
+      bs.setRanges(Collections.singleton(new Range()));
       if (null != context) {
         bs.setClassLoaderContext(context);
       }
@@ -314,8 +312,6 @@ private void batchCheck(Connector c, String tableName, IteratorSetting cfg, Stri
         assertEquals(expected, next.getValue().toString());
       }
       assertFalse(iterator.hasNext());
-    } finally {
-      bs.close();
     }
   }
 
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/ScannerIT.java b/test/src/main/java/org/apache/accumulo/test/functional/ScannerIT.java
index 340a58ee27..8d375838da 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/ScannerIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/ScannerIT.java
@@ -63,59 +63,64 @@ public void testScannerReadaheadConfiguration() throws Exception {
     bw.addMutation(m);
     bw.close();
 
-    Scanner s = c.createScanner(table, new Authorizations());
+    IteratorSetting cfg;
+    Stopwatch sw;
+    Iterator<Entry<Key,Value>> iterator;
+    try (Scanner s = c.createScanner(table, new Authorizations())) {
 
-    IteratorSetting cfg = new IteratorSetting(100, SlowIterator.class);
-    // A batch size of one will end up calling seek() for each element with no calls to next()
-    SlowIterator.setSeekSleepTime(cfg, 100l);
+      cfg = new IteratorSetting(100, SlowIterator.class);
+      // A batch size of one will end up calling seek() for each element with no calls to next()
+      SlowIterator.setSeekSleepTime(cfg, 100l);
 
-    s.addScanIterator(cfg);
-    // Never start readahead
-    s.setReadaheadThreshold(Long.MAX_VALUE);
-    s.setBatchSize(1);
-    s.setRange(new Range());
+      s.addScanIterator(cfg);
+      // Never start readahead
+      s.setReadaheadThreshold(Long.MAX_VALUE);
+      s.setBatchSize(1);
+      s.setRange(new Range());
 
-    Stopwatch sw = new Stopwatch();
-    Iterator<Entry<Key,Value>> iterator = s.iterator();
+      sw = new Stopwatch();
+      iterator = s.iterator();
 
-    sw.start();
-    while (iterator.hasNext()) {
-      sw.stop();
-
-      // While we "do work" in the client, we should be fetching the next result
-      UtilWaitThread.sleep(100l);
-      iterator.next();
       sw.start();
+      while (iterator.hasNext()) {
+        sw.stop();
+
+        // While we "do work" in the client, we should be fetching the next result
+        UtilWaitThread.sleep(100l);
+        iterator.next();
+        sw.start();
+      }
+      sw.stop();
     }
-    sw.stop();
 
     long millisWithWait = sw.elapsed(TimeUnit.MILLISECONDS);
 
-    s = c.createScanner(table, new Authorizations());
-    s.addScanIterator(cfg);
-    s.setRange(new Range());
-    s.setBatchSize(1);
-    s.setReadaheadThreshold(0l);
-
-    sw = new Stopwatch();
-    iterator = s.iterator();
+    try (Scanner s = c.createScanner(table, new Authorizations())) {
+      s.addScanIterator(cfg);
+      s.setRange(new Range());
+      s.setBatchSize(1);
+      s.setReadaheadThreshold(0l);
 
-    sw.start();
-    while (iterator.hasNext()) {
-      sw.stop();
+      sw = new Stopwatch();
+      iterator = s.iterator();
 
-      // While we "do work" in the client, we should be fetching the next result
-      UtilWaitThread.sleep(100l);
-      iterator.next();
       sw.start();
-    }
-    sw.stop();
+      while (iterator.hasNext()) {
+        sw.stop();
+
+        // While we "do work" in the client, we should be fetching the next result
+        UtilWaitThread.sleep(100l);
+        iterator.next();
+        sw.start();
+      }
+      sw.stop();
 
-    long millisWithNoWait = sw.elapsed(TimeUnit.MILLISECONDS);
+      long millisWithNoWait = sw.elapsed(TimeUnit.MILLISECONDS);
 
-    // The "no-wait" time should be much less than the "wait-time"
-    Assert.assertTrue("Expected less time to be taken with immediate readahead (" + millisWithNoWait + ") than without immediate readahead (" + millisWithWait
-        + ")", millisWithNoWait < millisWithWait);
+      // The "no-wait" time should be much less than the "wait-time"
+      Assert.assertTrue("Expected less time to be taken with immediate readahead (" + millisWithNoWait + ") than without immediate readahead ("
+          + millisWithWait + ")", millisWithNoWait < millisWithWait);
+    }
   }
 
 }
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/ServerSideErrorIT.java b/test/src/main/java/org/apache/accumulo/test/functional/ServerSideErrorIT.java
index f70fc32962..dadc5ac24f 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/ServerSideErrorIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/ServerSideErrorIT.java
@@ -64,67 +64,68 @@ public void run() throws Exception {
 
     bw.close();
 
-    // try to scan table
-    Scanner scanner = c.createScanner(tableName, Authorizations.EMPTY);
-
     boolean caught = false;
-    try {
-      for (Entry<Key,Value> entry : scanner) {
-        entry.getKey();
+    // try to scan table
+    try (Scanner scanner = c.createScanner(tableName, Authorizations.EMPTY)) {
+
+      try {
+        for (Entry<Key,Value> entry : scanner) {
+          entry.getKey();
+        }
+      } catch (Exception e) {
+        caught = true;
       }
-    } catch (Exception e) {
-      caught = true;
-    }
 
-    if (!caught)
-      throw new Exception("Scan did not fail");
+      if (!caught)
+        throw new Exception("Scan did not fail");
+
+      // try to batch scan the table
+      try (BatchScanner bs = c.createBatchScanner(tableName, Authorizations.EMPTY, 2)) {
+        bs.setRanges(Collections.singleton(new Range()));
+
+        caught = false;
+        try {
+          for (Entry<Key,Value> entry : bs) {
+            entry.getKey();
+          }
+        } catch (Exception e) {
+          caught = true;
+        }
+      }
 
-    // try to batch scan the table
-    BatchScanner bs = c.createBatchScanner(tableName, Authorizations.EMPTY, 2);
-    bs.setRanges(Collections.singleton(new Range()));
+      if (!caught)
+        throw new Exception("batch scan did not fail");
 
-    caught = false;
-    try {
-      for (Entry<Key,Value> entry : bs) {
-        entry.getKey();
+      // remove the bad agg so accumulo can shutdown
+      TableOperations to = c.tableOperations();
+      for (Entry<String,String> e : to.getProperties(tableName)) {
+        to.removeProperty(tableName, e.getKey());
       }
-    } catch (Exception e) {
-      caught = true;
-    } finally {
-      bs.close();
-    }
 
-    if (!caught)
-      throw new Exception("batch scan did not fail");
-
-    // remove the bad agg so accumulo can shutdown
-    TableOperations to = c.tableOperations();
-    for (Entry<String,String> e : to.getProperties(tableName)) {
-      to.removeProperty(tableName, e.getKey());
+      sleepUninterruptibly(500, TimeUnit.MILLISECONDS);
     }
 
-    sleepUninterruptibly(500, TimeUnit.MILLISECONDS);
-
     // should be able to scan now
-    scanner = c.createScanner(tableName, Authorizations.EMPTY);
-    for (Entry<Key,Value> entry : scanner) {
-      entry.getKey();
-    }
-
-    // set a non existant iterator, should cause scan to fail on server side
-    scanner.addScanIterator(new IteratorSetting(100, "bogus", "com.bogus.iterator"));
-
-    caught = false;
-    try {
+    try (Scanner scanner = c.createScanner(tableName, Authorizations.EMPTY)) {
       for (Entry<Key,Value> entry : scanner) {
-        // should error
         entry.getKey();
       }
-    } catch (Exception e) {
-      caught = true;
-    }
 
-    if (!caught)
-      throw new Exception("Scan did not fail");
+      // set a non existant iterator, should cause scan to fail on server side
+      scanner.addScanIterator(new IteratorSetting(100, "bogus", "com.bogus.iterator"));
+
+      caught = false;
+      try {
+        for (Entry<Key,Value> entry : scanner) {
+          // should error
+          entry.getKey();
+        }
+      } catch (Exception e) {
+        caught = true;
+      }
+
+      if (!caught)
+        throw new Exception("Scan did not fail");
+    }
   }
 }
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/SessionBlockVerifyIT.java b/test/src/main/java/org/apache/accumulo/test/functional/SessionBlockVerifyIT.java
index ca59041ff4..7c15704c76 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/SessionBlockVerifyIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/SessionBlockVerifyIT.java
@@ -97,78 +97,77 @@ public void run() throws Exception {
 
     bw.close();
 
-    Scanner scanner = c.createScanner(tableName, new Authorizations());
-    scanner.setReadaheadThreshold(20000);
-    scanner.setRange(new Range(String.format("%08d", 0), String.format("%08d", 1000)));
-
-    // test by making a slow iterator and then a couple of fast ones.
-    // when then checking we shouldn't have any running except the slow iterator
-    IteratorSetting setting = new IteratorSetting(21, SlowIterator.class);
-    SlowIterator.setSeekSleepTime(setting, Long.MAX_VALUE);
-    SlowIterator.setSleepTime(setting, Long.MAX_VALUE);
-    scanner.addScanIterator(setting);
-
-    final Iterator<Entry<Key,Value>> slow = scanner.iterator();
-
-    final List<Future<Boolean>> callables = new ArrayList<>();
-    final CountDownLatch latch = new CountDownLatch(10);
-    for (int i = 0; i < 10; i++) {
-      Future<Boolean> callable = service.submit(new Callable<Boolean>() {
-        public Boolean call() {
-          latch.countDown();
-          while (slow.hasNext()) {
-
-            slow.next();
+    try (Scanner scanner = c.createScanner(tableName, new Authorizations())) {
+      scanner.setReadaheadThreshold(20000);
+      scanner.setRange(new Range(String.format("%08d", 0), String.format("%08d", 1000)));
+
+      // test by making a slow iterator and then a couple of fast ones.
+      // when then checking we shouldn't have any running except the slow iterator
+      IteratorSetting setting = new IteratorSetting(21, SlowIterator.class);
+      SlowIterator.setSeekSleepTime(setting, Long.MAX_VALUE);
+      SlowIterator.setSleepTime(setting, Long.MAX_VALUE);
+      scanner.addScanIterator(setting);
+
+      final Iterator<Entry<Key,Value>> slow = scanner.iterator();
+
+      final List<Future<Boolean>> callables = new ArrayList<>();
+      final CountDownLatch latch = new CountDownLatch(10);
+      for (int i = 0; i < 10; i++) {
+        Future<Boolean> callable = service.submit(new Callable<Boolean>() {
+          public Boolean call() {
+            latch.countDown();
+            while (slow.hasNext()) {
+
+              slow.next();
+            }
+            return slow.hasNext();
           }
-          return slow.hasNext();
-        }
-      });
-      callables.add(callable);
-    }
-
-    latch.await();
-
-    log.info("Starting SessionBlockVerifyIT");
+        });
+        callables.add(callable);
+      }
 
-    // let's add more for good measure.
-    for (int i = 0; i < 2; i++) {
-      Scanner scanner2 = c.createScanner(tableName, new Authorizations());
+      latch.await();
 
-      scanner2.setRange(new Range(String.format("%08d", 0), String.format("%08d", 1000)));
+      log.info("Starting SessionBlockVerifyIT");
 
-      scanner2.setBatchSize(1);
-      Iterator<Entry<Key,Value>> iter = scanner2.iterator();
-      // call super's verify mechanism
-      verify(iter, 0, 1000);
+      // let's add more for good measure.
+      for (int i = 0; i < 2; i++) {
+        try (Scanner scanner2 = c.createScanner(tableName, new Authorizations())) {
+          scanner2.setRange(new Range(String.format("%08d", 0), String.format("%08d", 1000)));
+          scanner2.setBatchSize(1);
+          Iterator<Entry<Key,Value>> iter = scanner2.iterator();
+          // call super's verify mechanism
+          verify(iter, 0, 1000);
+        }
+      }
 
-    }
+      int sessionsFound = 0;
+      // we have configured 1 tserver, so we can grab the one and only
+      String tserver = Iterables.getOnlyElement(c.instanceOperations().getTabletServers());
 
-    int sessionsFound = 0;
-    // we have configured 1 tserver, so we can grab the one and only
-    String tserver = Iterables.getOnlyElement(c.instanceOperations().getTabletServers());
+      final List<ActiveScan> scans = c.instanceOperations().getActiveScans(tserver);
 
-    final List<ActiveScan> scans = c.instanceOperations().getActiveScans(tserver);
+      for (ActiveScan scan : scans) {
+        // only here to minimize chance of seeing meta extent scans
 
-    for (ActiveScan scan : scans) {
-      // only here to minimize chance of seeing meta extent scans
+        if (tableName.equals(scan.getTable()) && scan.getSsiList().size() > 0) {
+          assertEquals("Not the expected iterator", 1, scan.getSsiList().size());
+          assertTrue("Not the expected iterator", scan.getSsiList().iterator().next().contains("SlowIterator"));
+          sessionsFound++;
+        }
 
-      if (tableName.equals(scan.getTable()) && scan.getSsiList().size() > 0) {
-        assertEquals("Not the expected iterator", 1, scan.getSsiList().size());
-        assertTrue("Not the expected iterator", scan.getSsiList().iterator().next().contains("SlowIterator"));
-        sessionsFound++;
       }
 
-    }
-
-    /**
-     * The message below indicates the problem that we experience within ACCUMULO-3509. The issue manifests as a blockage in the Scanner synchronization that
-     * prevent us from making the close call against it. Since the close blocks until a read is finished, we ultimately have a block within the sweep of
-     * SessionManager. As a result never reap subsequent idle sessions AND we will orphan the sessionsToCleanup in the sweep, leading to an inaccurate count
-     * within sessionsFound.
-     */
-    assertEquals("Must have ten sessions. Failure indicates a synchronization block within the sweep mechanism", 10, sessionsFound);
-    for (Future<Boolean> callable : callables) {
-      callable.cancel(true);
+      /**
+       * The message below indicates the problem that we experience within ACCUMULO-3509. The issue manifests as a blockage in the Scanner synchronization that
+       * prevent us from making the close call against it. Since the close blocks until a read is finished, we ultimately have a block within the sweep of
+       * SessionManager. As a result never reap subsequent idle sessions AND we will orphan the sessionsToCleanup in the sweep, leading to an inaccurate count
+       * within sessionsFound.
+       */
+      assertEquals("Must have ten sessions. Failure indicates a synchronization block within the sweep mechanism", 10, sessionsFound);
+      for (Future<Boolean> callable : callables) {
+        callable.cancel(true);
+      }
     }
     service.shutdown();
   }
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/SparseColumnFamilyIT.java b/test/src/main/java/org/apache/accumulo/test/functional/SparseColumnFamilyIT.java
index 8cece0b8a2..b30cd78249 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/SparseColumnFamilyIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/SparseColumnFamilyIT.java
@@ -69,22 +69,23 @@ public void sparceColumnFamily() throws Exception {
 
     c.tableOperations().flush(scftt, null, null, true);
 
-    Scanner scanner = c.createScanner(scftt, Authorizations.EMPTY);
-
-    for (int i = 0; i < 200; i++) {
-
-      // every time we search for column family 1, it will scan the entire file
-      // that has mostly column family 0 until the bug is fixed
-      scanner.setRange(new Range(String.format("%06d", i), null));
-      scanner.clearColumns();
-      scanner.setBatchSize(3);
-      scanner.fetchColumnFamily(new Text(String.format("%03d", 1)));
-
-      Iterator<Entry<Key,Value>> iter = scanner.iterator();
-      if (iter.hasNext()) {
-        Entry<Key,Value> entry = iter.next();
-        if (!"001".equals(entry.getKey().getColumnFamilyData().toString())) {
-          throw new Exception();
+    try (Scanner scanner = c.createScanner(scftt, Authorizations.EMPTY)) {
+
+      for (int i = 0; i < 200; i++) {
+
+        // every time we search for column family 1, it will scan the entire file
+        // that has mostly column family 0 until the bug is fixed
+        scanner.setRange(new Range(String.format("%06d", i), null));
+        scanner.clearColumns();
+        scanner.setBatchSize(3);
+        scanner.fetchColumnFamily(new Text(String.format("%03d", 1)));
+
+        Iterator<Entry<Key,Value>> iter = scanner.iterator();
+        if (iter.hasNext()) {
+          Entry<Key,Value> entry = iter.next();
+          if (!"001".equals(entry.getKey().getColumnFamilyData().toString())) {
+            throw new Exception();
+          }
         }
       }
     }
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/SplitIT.java b/test/src/main/java/org/apache/accumulo/test/functional/SplitIT.java
index 272b8dd1f7..ccb81161c2 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/SplitIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/SplitIT.java
@@ -149,22 +149,23 @@ public void tabletShouldSplit() throws Exception {
       sleepUninterruptibly(15, TimeUnit.SECONDS);
     }
     Table.ID id = Table.ID.of(c.tableOperations().tableIdMap().get(table));
-    Scanner s = c.createScanner(MetadataTable.NAME, Authorizations.EMPTY);
-    KeyExtent extent = new KeyExtent(id, null, null);
-    s.setRange(extent.toMetadataRange());
-    MetadataSchema.TabletsSection.TabletColumnFamily.PREV_ROW_COLUMN.fetch(s);
-    int count = 0;
-    int shortened = 0;
-    for (Entry<Key,Value> entry : s) {
-      extent = new KeyExtent(entry.getKey().getRow(), entry.getValue());
-      if (extent.getEndRow() != null && extent.getEndRow().toString().length() < 14)
-        shortened++;
-      count++;
+    try (Scanner s = c.createScanner(MetadataTable.NAME, Authorizations.EMPTY)) {
+      KeyExtent extent = new KeyExtent(id, null, null);
+      s.setRange(extent.toMetadataRange());
+      MetadataSchema.TabletsSection.TabletColumnFamily.PREV_ROW_COLUMN.fetch(s);
+      int count = 0;
+      int shortened = 0;
+      for (Entry<Key,Value> entry : s) {
+        extent = new KeyExtent(entry.getKey().getRow(), entry.getValue());
+        if (extent.getEndRow() != null && extent.getEndRow().toString().length() < 14)
+          shortened++;
+        count++;
+      }
+
+      assertTrue("Shortened should be greater than zero: " + shortened, shortened > 0);
+      assertTrue("Count should be cgreater than 10: " + count, count > 10);
     }
 
-    assertTrue("Shortened should be greater than zero: " + shortened, shortened > 0);
-    assertTrue("Count should be cgreater than 10: " + count, count > 10);
-
     String[] args;
     if (clientConfig.getBoolean(ClientProperty.INSTANCE_RPC_SASL_ENABLED.getKey(), false)) {
       ClusterUser rootUser = getAdminUser();
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/TableChangeStateIT.java b/test/src/main/java/org/apache/accumulo/test/functional/TableChangeStateIT.java
index 6c4e735cce..3b4c284ce6 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/TableChangeStateIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/TableChangeStateIT.java
@@ -282,20 +282,19 @@ private void createData(final String tableName) {
 
       long startTimestamp = System.nanoTime();
 
-      Scanner scanner = connector.createScanner(tableName, Authorizations.EMPTY);
-      int count = 0;
-      for (Map.Entry<Key,Value> elt : scanner) {
-        String expected = String.format("%05d", count);
-        assert (elt.getKey().getRow().toString().equals(expected));
-        count++;
-      }
-
-      log.trace("Scan time for {} rows {} ms", NUM_ROWS, TimeUnit.MILLISECONDS.convert((System.nanoTime() - startTimestamp), TimeUnit.NANOSECONDS));
+      try (Scanner scanner = connector.createScanner(tableName, Authorizations.EMPTY)) {
+        int count = 0;
+        for (Map.Entry<Key,Value> elt : scanner) {
+          String expected = String.format("%05d", count);
+          assert (elt.getKey().getRow().toString().equals(expected));
+          count++;
+        }
 
-      scanner.close();
+        log.trace("Scan time for {} rows {} ms", NUM_ROWS, TimeUnit.MILLISECONDS.convert((System.nanoTime() - startTimestamp), TimeUnit.NANOSECONDS));
 
-      if (count != NUM_ROWS) {
-        throw new IllegalStateException(String.format("Number of rows %1$d does not match expected %2$d", count, NUM_ROWS));
+        if (count != NUM_ROWS) {
+          throw new IllegalStateException(String.format("Number of rows %1$d does not match expected %2$d", count, NUM_ROWS));
+        }
       }
     } catch (AccumuloException | AccumuloSecurityException | TableNotFoundException | TableExistsException ex) {
       throw new IllegalStateException("Create data failed with exception", ex);
@@ -409,22 +408,22 @@ public void run() {
 
         // validate expected data created and exists in table.
 
-        Scanner scanner = connector.createScanner(tableName, Authorizations.EMPTY);
+        try (Scanner scanner = connector.createScanner(tableName, Authorizations.EMPTY)) {
 
-        int count = 0;
-        for (Map.Entry<Key,Value> elt : scanner) {
-          String expected = String.format("%05d", count);
-          assert (elt.getKey().getRow().toString().equals(expected));
-          count++;
-        }
+          int count = 0;
+          for (Map.Entry<Key,Value> elt : scanner) {
+            String expected = String.format("%05d", count);
+            assert (elt.getKey().getRow().toString().equals(expected));
+            count++;
+          }
 
-        log.trace("After compaction, scan time for {} rows {} ms", NUM_ROWS,
-            TimeUnit.MILLISECONDS.convert((System.nanoTime() - startTimestamp), TimeUnit.NANOSECONDS));
+          log.trace("After compaction, scan time for {} rows {} ms", NUM_ROWS,
+              TimeUnit.MILLISECONDS.convert((System.nanoTime() - startTimestamp), TimeUnit.NANOSECONDS));
 
-        if (count != NUM_ROWS) {
-          throw new IllegalStateException(String.format("After compaction, number of rows %1$d does not match expected %2$d", count, NUM_ROWS));
+          if (count != NUM_ROWS) {
+            throw new IllegalStateException(String.format("After compaction, number of rows %1$d does not match expected %2$d", count, NUM_ROWS));
+          }
         }
-
       } catch (TableNotFoundException ex) {
         throw new IllegalStateException("test failed, table " + tableName + " does not exist", ex);
       } catch (AccumuloSecurityException ex) {
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/TableIT.java b/test/src/main/java/org/apache/accumulo/test/functional/TableIT.java
index 19a09f5824..a49ba99295 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/TableIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/TableIT.java
@@ -87,25 +87,27 @@ public void test() throws Exception {
     vopts.setTableName(tableName);
     VerifyIngest.verifyIngest(c, vopts, new ScannerOpts());
     Table.ID id = Table.ID.of(to.tableIdMap().get(tableName));
-    Scanner s = c.createScanner(MetadataTable.NAME, Authorizations.EMPTY);
-    s.setRange(new KeyExtent(id, null, null).toMetadataRange());
-    s.fetchColumnFamily(MetadataSchema.TabletsSection.DataFileColumnFamily.NAME);
-    assertTrue(Iterators.size(s.iterator()) > 0);
+    try (Scanner s = c.createScanner(MetadataTable.NAME, Authorizations.EMPTY)) {
+      s.setRange(new KeyExtent(id, null, null).toMetadataRange());
+      s.fetchColumnFamily(MetadataSchema.TabletsSection.DataFileColumnFamily.NAME);
+      assertTrue(Iterators.size(s.iterator()) > 0);
 
-    FileSystem fs = getCluster().getFileSystem();
-    assertTrue(fs.listStatus(new Path(rootPath + "/accumulo/tables/" + id)).length > 0);
-    to.delete(tableName);
-    assertEquals(0, Iterators.size(s.iterator()));
-    try {
-      assertEquals(0, fs.listStatus(new Path(rootPath + "/accumulo/tables/" + id)).length);
-    } catch (FileNotFoundException ex) {
-      // that's fine, too
+      FileSystem fs = getCluster().getFileSystem();
+      assertTrue(fs.listStatus(new Path(rootPath + "/accumulo/tables/" + id)).length > 0);
+      to.delete(tableName);
+      assertEquals(0, Iterators.size(s.iterator()));
+
+      try {
+        assertEquals(0, fs.listStatus(new Path(rootPath + "/accumulo/tables/" + id)).length);
+      } catch (FileNotFoundException ex) {
+        // that's fine, too
+      }
+      assertNull(to.tableIdMap().get(tableName));
+      to.create(tableName);
+      TestIngest.ingest(c, opts, new BatchWriterOpts());
+      VerifyIngest.verifyIngest(c, vopts, new ScannerOpts());
+      to.delete(tableName);
     }
-    assertNull(to.tableIdMap().get(tableName));
-    to.create(tableName);
-    TestIngest.ingest(c, opts, new BatchWriterOpts());
-    VerifyIngest.verifyIngest(c, vopts, new ScannerOpts());
-    to.delete(tableName);
   }
 
 }
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/TabletIT.java b/test/src/main/java/org/apache/accumulo/test/functional/TabletIT.java
index 8d52058a28..e4389f091c 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/TabletIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/TabletIT.java
@@ -88,14 +88,15 @@ public void createTableTest(String tableName, boolean readOnly) throws Exception
       b.close();
     }
 
-    Scanner scanner = getConnector().createScanner(tableName, Authorizations.EMPTY);
-    int count = 0;
-    for (Entry<Key,Value> elt : scanner) {
-      String expected = String.format("%05d", count);
-      assert (elt.getKey().getRow().toString().equals(expected));
-      count++;
+    try (Scanner scanner = getConnector().createScanner(tableName, Authorizations.EMPTY)) {
+      int count = 0;
+      for (Entry<Key,Value> elt : scanner) {
+        String expected = String.format("%05d", count);
+        assert (elt.getKey().getRow().toString().equals(expected));
+        count++;
+      }
+      assertEquals(N, count);
     }
-    assertEquals(N, count);
   }
 
 }
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/TabletStateChangeIteratorIT.java b/test/src/main/java/org/apache/accumulo/test/functional/TabletStateChangeIteratorIT.java
index 8b496d8e10..6e516de7ba 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/TabletStateChangeIteratorIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/TabletStateChangeIteratorIT.java
@@ -138,17 +138,17 @@ private void addDuplicateLocation(String table, String tableNameToModify) throws
 
   private void reassignLocation(String table, String tableNameToModify) throws TableNotFoundException, MutationsRejectedException {
     Table.ID tableIdToModify = Table.ID.of(getConnector().tableOperations().tableIdMap().get(tableNameToModify));
-    Scanner scanner = getConnector().createScanner(table, Authorizations.EMPTY);
-    scanner.setRange(new KeyExtent(tableIdToModify, null, null).toMetadataRange());
-    scanner.fetchColumnFamily(MetadataSchema.TabletsSection.CurrentLocationColumnFamily.NAME);
-    Entry<Key,Value> entry = scanner.iterator().next();
-    Mutation m = new Mutation(entry.getKey().getRow());
-    m.putDelete(entry.getKey().getColumnFamily(), entry.getKey().getColumnQualifier(), entry.getKey().getTimestamp());
-    m.put(entry.getKey().getColumnFamily(), new Text("1234567"), entry.getKey().getTimestamp() + 1, new Value("fake:9005".getBytes(UTF_8)));
-    scanner.close();
-    BatchWriter bw = getConnector().createBatchWriter(table, null);
-    bw.addMutation(m);
-    bw.close();
+    try (Scanner scanner = getConnector().createScanner(table, Authorizations.EMPTY)) {
+      scanner.setRange(new KeyExtent(tableIdToModify, null, null).toMetadataRange());
+      scanner.fetchColumnFamily(MetadataSchema.TabletsSection.CurrentLocationColumnFamily.NAME);
+      Entry<Key,Value> entry = scanner.iterator().next();
+      Mutation m = new Mutation(entry.getKey().getRow());
+      m.putDelete(entry.getKey().getColumnFamily(), entry.getKey().getColumnQualifier(), entry.getKey().getTimestamp());
+      m.put(entry.getKey().getColumnFamily(), new Text("1234567"), entry.getKey().getTimestamp() + 1, new Value("fake:9005".getBytes(UTF_8)));
+      BatchWriter bw = getConnector().createBatchWriter(table, null);
+      bw.addMutation(m);
+      bw.close();
+    }
   }
 
   private void removeLocation(String table, String tableNameToModify) throws TableNotFoundException, MutationsRejectedException {
@@ -162,12 +162,13 @@ private void removeLocation(String table, String tableNameToModify) throws Table
 
   private int findTabletsNeedingAttention(String table, State state) throws TableNotFoundException {
     int results = 0;
-    Scanner scanner = getConnector().createScanner(table, Authorizations.EMPTY);
-    MetaDataTableScanner.configureScanner(scanner, state);
-    scanner.updateScanIteratorOption("tabletChange", "debug", "1");
-    for (Entry<Key,Value> e : scanner) {
-      if (e != null)
-        results++;
+    try (Scanner scanner = getConnector().createScanner(table, Authorizations.EMPTY)) {
+      MetaDataTableScanner.configureScanner(scanner, state);
+      scanner.updateScanIteratorOption("tabletChange", "debug", "1");
+      for (Entry<Key,Value> e : scanner) {
+        if (e != null)
+          results++;
+      }
     }
     return results;
   }
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/TimeoutIT.java b/test/src/main/java/org/apache/accumulo/test/functional/TimeoutIT.java
index d9fa3bda35..e8bef88666 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/TimeoutIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/TimeoutIT.java
@@ -93,28 +93,28 @@ public void testBatchScannerTimeout(Connector conn, String tableName) throws Exc
     bw.addMutation(m);
     bw.close();
 
-    BatchScanner bs = getConnector().createBatchScanner(tableName, Authorizations.EMPTY, 2);
-    bs.setRanges(Collections.singletonList(new Range()));
+    try (BatchScanner bs = getConnector().createBatchScanner(tableName, Authorizations.EMPTY, 2)) {
+      bs.setRanges(Collections.singletonList(new Range()));
 
-    // should not timeout
-    for (Entry<Key,Value> entry : bs) {
-      entry.getKey();
-    }
-
-    bs.setTimeout(5, TimeUnit.SECONDS);
-    IteratorSetting iterSetting = new IteratorSetting(100, SlowIterator.class);
-    iterSetting.addOption("sleepTime", 2000 + "");
-    bs.addScanIterator(iterSetting);
-
-    try {
+      // should not timeout
       for (Entry<Key,Value> entry : bs) {
         entry.getKey();
       }
-      fail("batch scanner did not time out");
-    } catch (TimedOutException toe) {
-      // toe.printStackTrace();
+
+      bs.setTimeout(5, TimeUnit.SECONDS);
+      IteratorSetting iterSetting = new IteratorSetting(100, SlowIterator.class);
+      iterSetting.addOption("sleepTime", 2000 + "");
+      bs.addScanIterator(iterSetting);
+
+      try {
+        for (Entry<Key,Value> entry : bs) {
+          entry.getKey();
+        }
+        fail("batch scanner did not time out");
+      } catch (TimedOutException toe) {
+        // toe.printStackTrace();
+      }
     }
-    bs.close();
   }
 
 }
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/VisibilityIT.java b/test/src/main/java/org/apache/accumulo/test/functional/VisibilityIT.java
index 8285461a3f..f7a223c865 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/VisibilityIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/VisibilityIT.java
@@ -249,20 +249,21 @@ private void queryData(Connector c, String tableName, Set<String> allAuths, Set<
   }
 
   private void queryDefaultData(Connector c, String tableName) throws Exception {
-    Scanner scanner;
-
     // should return no records
     c.securityOperations().changeUserAuthorizations(getAdminPrincipal(), new Authorizations("BASE", "DEFLABEL"));
-    scanner = getConnector().createScanner(tableName, new Authorizations());
-    verifyDefault(scanner, 0);
+    try (Scanner scanner = getConnector().createScanner(tableName, new Authorizations())) {
+      verifyDefault(scanner, 0);
+    }
 
     // should return one record
-    scanner = getConnector().createScanner(tableName, new Authorizations("BASE"));
-    verifyDefault(scanner, 1);
+    try (Scanner scanner = getConnector().createScanner(tableName, new Authorizations("BASE"))) {
+      verifyDefault(scanner, 1);
+    }
 
     // should return all three records
-    scanner = getConnector().createScanner(tableName, new Authorizations("BASE", "DEFLABEL"));
-    verifyDefault(scanner, 3);
+    try (Scanner scanner = getConnector().createScanner(tableName, new Authorizations("BASE", "DEFLABEL"))) {
+      verifyDefault(scanner, 3);
+    }
   }
 
   private void verifyDefault(Scanner scanner, int expectedCount) throws Exception {
@@ -290,13 +291,14 @@ private ByteArraySet nbas(Set<String> auths) {
   }
 
   private void verify(Connector c, String tableName, ByteArraySet nss, String... expected) throws Exception {
-    Scanner scanner = c.createScanner(tableName, new Authorizations(nss));
-    verify(scanner.iterator(), expected);
+    try (Scanner scanner = c.createScanner(tableName, new Authorizations(nss));
+        BatchScanner bs = getConnector().createBatchScanner(tableName, new Authorizations(nss), 3)) {
+
+      verify(scanner.iterator(), expected);
 
-    BatchScanner bs = getConnector().createBatchScanner(tableName, new Authorizations(nss), 3);
-    bs.setRanges(Collections.singleton(new Range()));
-    verify(bs.iterator(), expected);
-    bs.close();
+      bs.setRanges(Collections.singleton(new Range()));
+      verify(bs.iterator(), expected);
+    }
   }
 
   private void verify(Iterator<Entry<Key,Value>> iter, String... expected) throws Exception {
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/WALSunnyDayIT.java b/test/src/main/java/org/apache/accumulo/test/functional/WALSunnyDayIT.java
index 9d88c705d8..df8289a2f8 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/WALSunnyDayIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/WALSunnyDayIT.java
@@ -158,10 +158,10 @@ public void test() throws Exception {
   }
 
   private void verifySomeData(Connector c, String tableName, int expected) throws Exception {
-    Scanner scan = c.createScanner(tableName, EMPTY);
-    int result = Iterators.size(scan.iterator());
-    scan.close();
-    Assert.assertEquals(expected, result);
+    try (Scanner scan = c.createScanner(tableName, EMPTY)) {
+      int result = Iterators.size(scan.iterator());
+      Assert.assertEquals(expected, result);
+    }
   }
 
   private void writeSomeData(Connector conn, String tableName, int row, int col) throws Exception {
@@ -189,28 +189,28 @@ private void writeSomeData(Connector conn, String tableName, int row, int col) t
 
   private Map<KeyExtent,List<String>> getRecoveryMarkers(Connector c) throws Exception {
     Map<KeyExtent,List<String>> result = new HashMap<>();
-    Scanner root = c.createScanner(RootTable.NAME, EMPTY);
-    root.setRange(TabletsSection.getRange());
-    root.fetchColumnFamily(TabletsSection.LogColumnFamily.NAME);
-    TabletColumnFamily.PREV_ROW_COLUMN.fetch(root);
+    try (Scanner root = c.createScanner(RootTable.NAME, EMPTY); Scanner meta = c.createScanner(MetadataTable.NAME, EMPTY)) {
+      root.setRange(TabletsSection.getRange());
+      root.fetchColumnFamily(TabletsSection.LogColumnFamily.NAME);
+      TabletColumnFamily.PREV_ROW_COLUMN.fetch(root);
 
-    Scanner meta = c.createScanner(MetadataTable.NAME, EMPTY);
-    meta.setRange(TabletsSection.getRange());
-    meta.fetchColumnFamily(TabletsSection.LogColumnFamily.NAME);
-    TabletColumnFamily.PREV_ROW_COLUMN.fetch(meta);
+      meta.setRange(TabletsSection.getRange());
+      meta.fetchColumnFamily(TabletsSection.LogColumnFamily.NAME);
+      TabletColumnFamily.PREV_ROW_COLUMN.fetch(meta);
 
-    List<String> logs = new ArrayList<>();
-    Iterator<Entry<Key,Value>> both = Iterators.concat(root.iterator(), meta.iterator());
-    while (both.hasNext()) {
-      Entry<Key,Value> entry = both.next();
-      Key key = entry.getKey();
-      if (key.getColumnFamily().equals(TabletsSection.LogColumnFamily.NAME)) {
-        logs.add(key.getColumnQualifier().toString());
-      }
-      if (TabletColumnFamily.PREV_ROW_COLUMN.hasColumns(key) && !logs.isEmpty()) {
-        KeyExtent extent = new KeyExtent(key.getRow(), entry.getValue());
-        result.put(extent, logs);
-        logs = new ArrayList<>();
+      List<String> logs = new ArrayList<>();
+      Iterator<Entry<Key,Value>> both = Iterators.concat(root.iterator(), meta.iterator());
+      while (both.hasNext()) {
+        Entry<Key,Value> entry = both.next();
+        Key key = entry.getKey();
+        if (key.getColumnFamily().equals(TabletsSection.LogColumnFamily.NAME)) {
+          logs.add(key.getColumnQualifier().toString());
+        }
+        if (TabletColumnFamily.PREV_ROW_COLUMN.hasColumns(key) && !logs.isEmpty()) {
+          KeyExtent extent = new KeyExtent(key.getRow(), entry.getValue());
+          result.put(extent, logs);
+          logs = new ArrayList<>();
+        }
       }
     }
     return result;
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/ZookeeperRestartIT.java b/test/src/main/java/org/apache/accumulo/test/functional/ZookeeperRestartIT.java
index a7eaef3424..7fecac7d31 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/ZookeeperRestartIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/ZookeeperRestartIT.java
@@ -76,13 +76,14 @@ public void test() throws Exception {
     cluster.start();
 
     // use the tservers
-    Scanner s = c.createScanner("test_ingest", Authorizations.EMPTY);
-    Iterator<Entry<Key,Value>> i = s.iterator();
-    assertTrue(i.hasNext());
-    assertEquals("row", i.next().getKey().getRow().toString());
-    assertFalse(i.hasNext());
-    // use the master
-    c.tableOperations().delete("test_ingest");
+    try (Scanner s = c.createScanner("test_ingest", Authorizations.EMPTY)) {
+      Iterator<Entry<Key,Value>> i = s.iterator();
+      assertTrue(i.hasNext());
+      assertEquals("row", i.next().getKey().getRow().toString());
+      assertFalse(i.hasNext());
+      // use the master
+      c.tableOperations().delete("test_ingest");
+    }
   }
 
 }
diff --git a/test/src/main/java/org/apache/accumulo/test/gc/replication/CloseWriteAheadLogReferencesIT.java b/test/src/main/java/org/apache/accumulo/test/gc/replication/CloseWriteAheadLogReferencesIT.java
index 63107e56ac..d8f2903641 100644
--- a/test/src/main/java/org/apache/accumulo/test/gc/replication/CloseWriteAheadLogReferencesIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/gc/replication/CloseWriteAheadLogReferencesIT.java
@@ -136,11 +136,12 @@ public void unclosedWalsLeaveStatusOpen() throws Exception {
 
     refs.updateReplicationEntries(conn, wals);
 
-    Scanner s = conn.createScanner(MetadataTable.NAME, Authorizations.EMPTY);
-    s.fetchColumnFamily(ReplicationSection.COLF);
-    Entry<Key,Value> entry = Iterables.getOnlyElement(s);
-    Status status = Status.parseFrom(entry.getValue().get());
-    Assert.assertFalse(status.getClosed());
+    try (Scanner s = conn.createScanner(MetadataTable.NAME, Authorizations.EMPTY)) {
+      s.fetchColumnFamily(ReplicationSection.COLF);
+      Entry<Key,Value> entry = Iterables.getOnlyElement(s);
+      Status status = Status.parseFrom(entry.getValue().get());
+      Assert.assertFalse(status.getClosed());
+    }
   }
 
   @Test
@@ -155,11 +156,12 @@ public void closedWalsUpdateStatus() throws Exception {
 
     refs.updateReplicationEntries(conn, wals);
 
-    Scanner s = conn.createScanner(MetadataTable.NAME, Authorizations.EMPTY);
-    s.fetchColumnFamily(ReplicationSection.COLF);
-    Entry<Key,Value> entry = Iterables.getOnlyElement(s);
-    Status status = Status.parseFrom(entry.getValue().get());
-    Assert.assertTrue(status.getClosed());
+    try (Scanner s = conn.createScanner(MetadataTable.NAME, Authorizations.EMPTY)) {
+      s.fetchColumnFamily(ReplicationSection.COLF);
+      Entry<Key,Value> entry = Iterables.getOnlyElement(s);
+      Status status = Status.parseFrom(entry.getValue().get());
+      Assert.assertTrue(status.getClosed());
+    }
   }
 
   @Test
@@ -174,10 +176,11 @@ public void partiallyReplicatedReferencedWalsAreNotClosed() throws Exception {
 
     refs.updateReplicationEntries(conn, wals);
 
-    Scanner s = ReplicationTable.getScanner(conn);
-    Entry<Key,Value> entry = Iterables.getOnlyElement(s);
-    Status status = Status.parseFrom(entry.getValue().get());
-    Assert.assertFalse(status.getClosed());
+    try (Scanner s = ReplicationTable.getScanner(conn)) {
+      Entry<Key,Value> entry = Iterables.getOnlyElement(s);
+      Status status = Status.parseFrom(entry.getValue().get());
+      Assert.assertFalse(status.getClosed());
+    }
   }
 
 }
diff --git a/test/src/main/java/org/apache/accumulo/test/mapred/AccumuloOutputFormatIT.java b/test/src/main/java/org/apache/accumulo/test/mapred/AccumuloOutputFormatIT.java
index 049a5da41c..68c2b01223 100644
--- a/test/src/main/java/org/apache/accumulo/test/mapred/AccumuloOutputFormatIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/mapred/AccumuloOutputFormatIT.java
@@ -217,12 +217,13 @@ public void testMR() throws Exception {
     MRTester.main(new String[] {"root", ROOT_PASSWORD, table1, table2, instanceName, getCluster().getZooKeepers()});
     assertNull(e1);
 
-    Scanner scanner = c.createScanner(table2, new Authorizations());
-    Iterator<Entry<Key,Value>> iter = scanner.iterator();
-    assertTrue(iter.hasNext());
-    Entry<Key,Value> entry = iter.next();
-    assertEquals(Integer.parseInt(new String(entry.getValue().get())), 100);
-    assertFalse(iter.hasNext());
+    try (Scanner scanner = c.createScanner(table2, new Authorizations())) {
+      Iterator<Entry<Key,Value>> iter = scanner.iterator();
+      assertTrue(iter.hasNext());
+      Entry<Key,Value> entry = iter.next();
+      assertEquals(Integer.parseInt(new String(entry.getValue().get())), 100);
+      assertFalse(iter.hasNext());
+    }
   }
 
 }
diff --git a/test/src/main/java/org/apache/accumulo/test/mapred/TokenFileIT.java b/test/src/main/java/org/apache/accumulo/test/mapred/TokenFileIT.java
index 78fc76d4ff..478db1d1a1 100644
--- a/test/src/main/java/org/apache/accumulo/test/mapred/TokenFileIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/mapred/TokenFileIT.java
@@ -165,11 +165,12 @@ public void testMR() throws Exception {
     MRTokenFileTester.main(new String[] {tf.getAbsolutePath(), table1, table2});
     assertNull(e1);
 
-    Scanner scanner = c.createScanner(table2, new Authorizations());
-    Iterator<Entry<Key,Value>> iter = scanner.iterator();
-    assertTrue(iter.hasNext());
-    Entry<Key,Value> entry = iter.next();
-    assertEquals(Integer.parseInt(new String(entry.getValue().get())), 100);
-    assertFalse(iter.hasNext());
+    try (Scanner scanner = c.createScanner(table2, new Authorizations())) {
+      Iterator<Entry<Key,Value>> iter = scanner.iterator();
+      assertTrue(iter.hasNext());
+      Entry<Key,Value> entry = iter.next();
+      assertEquals(Integer.parseInt(new String(entry.getValue().get())), 100);
+      assertFalse(iter.hasNext());
+    }
   }
 }
diff --git a/test/src/main/java/org/apache/accumulo/test/mapreduce/AccumuloOutputFormatIT.java b/test/src/main/java/org/apache/accumulo/test/mapreduce/AccumuloOutputFormatIT.java
index 811f3fe480..ff57722e3d 100644
--- a/test/src/main/java/org/apache/accumulo/test/mapreduce/AccumuloOutputFormatIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/mapreduce/AccumuloOutputFormatIT.java
@@ -144,11 +144,12 @@ public void testMR() throws Exception {
     MRTester.main(new String[] {table1, table2});
     assertNull(e1);
 
-    Scanner scanner = c.createScanner(table2, new Authorizations());
-    Iterator<Entry<Key,Value>> iter = scanner.iterator();
-    assertTrue(iter.hasNext());
-    Entry<Key,Value> entry = iter.next();
-    assertEquals(Integer.parseInt(new String(entry.getValue().get())), 100);
-    assertFalse(iter.hasNext());
+    try (Scanner scanner = c.createScanner(table2, new Authorizations())) {
+      Iterator<Entry<Key,Value>> iter = scanner.iterator();
+      assertTrue(iter.hasNext());
+      Entry<Key,Value> entry = iter.next();
+      assertEquals(Integer.parseInt(new String(entry.getValue().get())), 100);
+      assertFalse(iter.hasNext());
+    }
   }
 }
diff --git a/test/src/main/java/org/apache/accumulo/test/mapreduce/TokenFileIT.java b/test/src/main/java/org/apache/accumulo/test/mapreduce/TokenFileIT.java
index 6c3b9efd76..db8d060c2b 100644
--- a/test/src/main/java/org/apache/accumulo/test/mapreduce/TokenFileIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/mapreduce/TokenFileIT.java
@@ -158,11 +158,12 @@ public void testMR() throws Exception {
     MRTokenFileTester.main(new String[] {tf.getAbsolutePath(), table1, table2});
     assertNull(e1);
 
-    Scanner scanner = c.createScanner(table2, new Authorizations());
-    Iterator<Entry<Key,Value>> iter = scanner.iterator();
-    assertTrue(iter.hasNext());
-    Entry<Key,Value> entry = iter.next();
-    assertEquals(Integer.parseInt(new String(entry.getValue().get())), 100);
-    assertFalse(iter.hasNext());
+    try (Scanner scanner = c.createScanner(table2, new Authorizations())) {
+      Iterator<Entry<Key,Value>> iter = scanner.iterator();
+      assertTrue(iter.hasNext());
+      Entry<Key,Value> entry = iter.next();
+      assertEquals(Integer.parseInt(new String(entry.getValue().get())), 100);
+      assertFalse(iter.hasNext());
+    }
   }
 }
diff --git a/test/src/main/java/org/apache/accumulo/test/performance/metadata/MetadataBatchScanTest.java b/test/src/main/java/org/apache/accumulo/test/performance/metadata/MetadataBatchScanTest.java
index 794d1b14f1..0138de1dbe 100644
--- a/test/src/main/java/org/apache/accumulo/test/performance/metadata/MetadataBatchScanTest.java
+++ b/test/src/main/java/org/apache/accumulo/test/performance/metadata/MetadataBatchScanTest.java
@@ -176,22 +176,20 @@ public void run() {
   }
 
   private static ScanStats runScanTest(Connector connector, int numLoop, List<Range> ranges) throws Exception {
-    Scanner scanner = null;
-
-    BatchScanner bs = connector.createBatchScanner(MetadataTable.NAME, Authorizations.EMPTY, 1);
-    bs.fetchColumnFamily(TabletsSection.CurrentLocationColumnFamily.NAME);
-    TabletsSection.TabletColumnFamily.PREV_ROW_COLUMN.fetch(bs);
+    ScanStats stats = new ScanStats();
 
-    bs.setRanges(ranges);
+    try (BatchScanner bs = connector.createBatchScanner(MetadataTable.NAME, Authorizations.EMPTY, 1)) {
+      bs.fetchColumnFamily(TabletsSection.CurrentLocationColumnFamily.NAME);
+      TabletsSection.TabletColumnFamily.PREV_ROW_COLUMN.fetch(bs);
 
-    // System.out.println(ranges);
+      bs.setRanges(ranges);
 
-    ScanStats stats = new ScanStats();
-    for (int i = 0; i < numLoop; i++) {
-      ScanStat ss = scan(bs, ranges, scanner);
-      stats.merge(ss);
+      // System.out.println(ranges);
+      for (int i = 0; i < numLoop; i++) {
+        ScanStat ss = scan(bs, ranges, null);
+        stats.merge(ss);
+      }
     }
-
     return stats;
   }
 
diff --git a/test/src/main/java/org/apache/accumulo/test/performance/scan/CollectTabletStats.java b/test/src/main/java/org/apache/accumulo/test/performance/scan/CollectTabletStats.java
index 84c4e77170..8040beb17a 100644
--- a/test/src/main/java/org/apache/accumulo/test/performance/scan/CollectTabletStats.java
+++ b/test/src/main/java/org/apache/accumulo/test/performance/scan/CollectTabletStats.java
@@ -506,82 +506,82 @@ private static int readFilesUsingIterStack(VolumeManager fs, ServerConfiguration
   private static int scanTablet(Connector conn, String table, Authorizations auths, int batchSize, Text prevEndRow, Text endRow, String[] columns)
       throws Exception {
 
-    Scanner scanner = conn.createScanner(table, auths);
-    scanner.setBatchSize(batchSize);
-    scanner.setRange(new Range(prevEndRow, false, endRow, true));
+    try (Scanner scanner = conn.createScanner(table, auths)) {
+      scanner.setBatchSize(batchSize);
+      scanner.setRange(new Range(prevEndRow, false, endRow, true));
 
-    for (String c : columns) {
-      scanner.fetchColumnFamily(new Text(c));
-    }
+      for (String c : columns) {
+        scanner.fetchColumnFamily(new Text(c));
+      }
 
-    int count = 0;
+      int count = 0;
 
-    for (Entry<Key,Value> entry : scanner) {
-      if (entry != null)
-        count++;
+      for (Entry<Key,Value> entry : scanner) {
+        if (entry != null)
+          count++;
+      }
+      return count;
     }
-
-    return count;
   }
 
   private static void calcTabletStats(Connector conn, String table, Authorizations auths, int batchSize, KeyExtent ke, String[] columns) throws Exception {
 
     // long t1 = System.currentTimeMillis();
 
-    Scanner scanner = conn.createScanner(table, auths);
-    scanner.setBatchSize(batchSize);
-    scanner.setRange(new Range(ke.getPrevEndRow(), false, ke.getEndRow(), true));
+    try (Scanner scanner = conn.createScanner(table, auths)) {
+      scanner.setBatchSize(batchSize);
+      scanner.setRange(new Range(ke.getPrevEndRow(), false, ke.getEndRow(), true));
 
-    for (String c : columns) {
-      scanner.fetchColumnFamily(new Text(c));
-    }
+      for (String c : columns) {
+        scanner.fetchColumnFamily(new Text(c));
+      }
 
-    Stat rowLen = new Stat();
-    Stat cfLen = new Stat();
-    Stat cqLen = new Stat();
-    Stat cvLen = new Stat();
-    Stat valLen = new Stat();
-    Stat colsPerRow = new Stat();
+      Stat rowLen = new Stat();
+      Stat cfLen = new Stat();
+      Stat cqLen = new Stat();
+      Stat cvLen = new Stat();
+      Stat valLen = new Stat();
+      Stat colsPerRow = new Stat();
 
-    Text lastRow = null;
-    int colsPerRowCount = 0;
+      Text lastRow = null;
+      int colsPerRowCount = 0;
 
-    for (Entry<Key,Value> entry : scanner) {
+      for (Entry<Key,Value> entry : scanner) {
 
-      Key key = entry.getKey();
-      Text row = key.getRow();
+        Key key = entry.getKey();
+        Text row = key.getRow();
 
-      if (lastRow == null) {
-        lastRow = row;
-      }
+        if (lastRow == null) {
+          lastRow = row;
+        }
 
-      if (!lastRow.equals(row)) {
-        colsPerRow.addStat(colsPerRowCount);
-        lastRow = row;
-        colsPerRowCount = 0;
-      }
+        if (!lastRow.equals(row)) {
+          colsPerRow.addStat(colsPerRowCount);
+          lastRow = row;
+          colsPerRowCount = 0;
+        }
 
-      colsPerRowCount++;
+        colsPerRowCount++;
 
-      rowLen.addStat(row.getLength());
-      cfLen.addStat(key.getColumnFamilyData().length());
-      cqLen.addStat(key.getColumnQualifierData().length());
-      cvLen.addStat(key.getColumnVisibilityData().length());
-      valLen.addStat(entry.getValue().get().length);
-    }
+        rowLen.addStat(row.getLength());
+        cfLen.addStat(key.getColumnFamilyData().length());
+        cqLen.addStat(key.getColumnQualifierData().length());
+        cvLen.addStat(key.getColumnVisibilityData().length());
+        valLen.addStat(entry.getValue().get().length);
+      }
 
-    synchronized (System.out) {
-      System.out.println("");
-      System.out.println("\tTablet " + ke.getUUID() + " statistics : ");
-      printStat("Row length", rowLen);
-      printStat("Column family length", cfLen);
-      printStat("Column qualifier length", cqLen);
-      printStat("Column visibility length", cvLen);
-      printStat("Value length", valLen);
-      printStat("Columns per row", colsPerRow);
-      System.out.println("");
+      synchronized (System.out) {
+        System.out.println("");
+        System.out.println("\tTablet " + ke.getUUID() + " statistics : ");
+        printStat("Row length", rowLen);
+        printStat("Column family length", cfLen);
+        printStat("Column qualifier length", cqLen);
+        printStat("Column visibility length", cvLen);
+        printStat("Value length", valLen);
+        printStat("Columns per row", colsPerRow);
+        System.out.println("");
+      }
     }
-
   }
 
   private static void printStat(String desc, Stat s) {
diff --git a/test/src/main/java/org/apache/accumulo/test/performance/thrift/NullTserver.java b/test/src/main/java/org/apache/accumulo/test/performance/thrift/NullTserver.java
index a337091040..a710f4bc2e 100644
--- a/test/src/main/java/org/apache/accumulo/test/performance/thrift/NullTserver.java
+++ b/test/src/main/java/org/apache/accumulo/test/performance/thrift/NullTserver.java
@@ -299,15 +299,16 @@ public static void main(String[] args) throws Exception {
 
     // read the locations for the table
     Range tableRange = new KeyExtent(tableId, null, null).toMetadataRange();
-    MetaDataTableScanner s = new MetaDataTableScanner(context, tableRange);
-    long randomSessionID = opts.port;
-    TServerInstance instance = new TServerInstance(addr, randomSessionID);
     List<Assignment> assignments = new ArrayList<>();
-    while (s.hasNext()) {
-      TabletLocationState next = s.next();
-      assignments.add(new Assignment(next.extent, instance));
+    try (MetaDataTableScanner s = new MetaDataTableScanner(context, tableRange)) {
+      long randomSessionID = opts.port;
+      TServerInstance instance = new TServerInstance(addr, randomSessionID);
+
+      while (s.hasNext()) {
+        TabletLocationState next = s.next();
+        assignments.add(new Assignment(next.extent, instance));
+      }
     }
-    s.close();
     // point them to this server
     MetaDataStateStore store = new MetaDataStateStore(context);
     store.setLocations(assignments);
diff --git a/test/src/main/java/org/apache/accumulo/test/replication/CyclicReplicationIT.java b/test/src/main/java/org/apache/accumulo/test/replication/CyclicReplicationIT.java
index b16419bcf3..9af88d49a8 100644
--- a/test/src/main/java/org/apache/accumulo/test/replication/CyclicReplicationIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/replication/CyclicReplicationIT.java
@@ -284,46 +284,51 @@ public void dataIsNotOverReplicated() throws Exception {
       Thread.sleep(1000);
 
       // Sanity check that the element is there on master1
-      Scanner s = connMaster1.createScanner(master1Table, Authorizations.EMPTY);
-      Entry<Key,Value> entry = Iterables.getOnlyElement(s);
-      Assert.assertEquals("1", entry.getValue().toString());
+      Entry<Key,Value> entry;
+      try (Scanner s = connMaster1.createScanner(master1Table, Authorizations.EMPTY)) {
+        entry = Iterables.getOnlyElement(s);
+        Assert.assertEquals("1", entry.getValue().toString());
 
-      // Wait for this table to replicate
-      connMaster1.replicationOperations().drain(master1Table, files);
+        // Wait for this table to replicate
+        connMaster1.replicationOperations().drain(master1Table, files);
 
-      Thread.sleep(5000);
+        Thread.sleep(5000);
+      }
 
       // Check that the element made it to master2 only once
-      s = connMaster2.createScanner(master2Table, Authorizations.EMPTY);
-      entry = Iterables.getOnlyElement(s);
-      Assert.assertEquals("1", entry.getValue().toString());
+      try (Scanner s = connMaster2.createScanner(master2Table, Authorizations.EMPTY)) {
+        entry = Iterables.getOnlyElement(s);
+        Assert.assertEquals("1", entry.getValue().toString());
 
-      // Wait for master2 to finish replicating it back
-      files = connMaster2.replicationOperations().referencedFiles(master2Table);
+        // Wait for master2 to finish replicating it back
+        files = connMaster2.replicationOperations().referencedFiles(master2Table);
 
-      // Kill and restart the tserver to close the WAL on master2
-      for (ProcessReference proc : master2Cluster.getProcesses().get(ServerType.TABLET_SERVER)) {
-        master2Cluster.killProcess(ServerType.TABLET_SERVER, proc);
-      }
+        // Kill and restart the tserver to close the WAL on master2
+        for (ProcessReference proc : master2Cluster.getProcesses().get(ServerType.TABLET_SERVER)) {
+          master2Cluster.killProcess(ServerType.TABLET_SERVER, proc);
+        }
 
-      master2Cluster.exec(TabletServer.class);
+        master2Cluster.exec(TabletServer.class);
 
-      // Try to avoid ACCUMULO-2964
-      Thread.sleep(1000);
+        // Try to avoid ACCUMULO-2964
+        Thread.sleep(1000);
+      }
 
       // Check that the element made it to master2 only once
-      s = connMaster2.createScanner(master2Table, Authorizations.EMPTY);
-      entry = Iterables.getOnlyElement(s);
-      Assert.assertEquals("1", entry.getValue().toString());
+      try (Scanner s = connMaster2.createScanner(master2Table, Authorizations.EMPTY)) {
+        entry = Iterables.getOnlyElement(s);
+        Assert.assertEquals("1", entry.getValue().toString());
 
-      connMaster2.replicationOperations().drain(master2Table, files);
+        connMaster2.replicationOperations().drain(master2Table, files);
 
-      Thread.sleep(5000);
+        Thread.sleep(5000);
+      }
 
       // Verify that the entry wasn't sent back to master1
-      s = connMaster1.createScanner(master1Table, Authorizations.EMPTY);
-      entry = Iterables.getOnlyElement(s);
-      Assert.assertEquals("1", entry.getValue().toString());
+      try (Scanner s = connMaster1.createScanner(master1Table, Authorizations.EMPTY)) {
+        entry = Iterables.getOnlyElement(s);
+        Assert.assertEquals("1", entry.getValue().toString());
+      }
     } finally {
       master1Cluster.stop();
       master2Cluster.stop();
diff --git a/test/src/main/java/org/apache/accumulo/test/replication/FinishedWorkUpdaterIT.java b/test/src/main/java/org/apache/accumulo/test/replication/FinishedWorkUpdaterIT.java
index f03570fd29..9f1b194920 100644
--- a/test/src/main/java/org/apache/accumulo/test/replication/FinishedWorkUpdaterIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/replication/FinishedWorkUpdaterIT.java
@@ -77,17 +77,18 @@ public void recordsWithProgressUpdateBothTables() throws Exception {
 
     updater.run();
 
-    Scanner s = ReplicationTable.getScanner(conn);
-    s.setRange(Range.exact(file));
-    StatusSection.limit(s);
-    Entry<Key,Value> entry = Iterables.getOnlyElement(s);
-
-    Assert.assertEquals(entry.getKey().getColumnFamily(), StatusSection.NAME);
-    Assert.assertEquals(entry.getKey().getColumnQualifier().toString(), target.getSourceTableId().canonicalID());
-
-    // We should only rely on the correct begin attribute being returned
-    Status actual = Status.parseFrom(entry.getValue().get());
-    Assert.assertEquals(stat.getBegin(), actual.getBegin());
+    try (Scanner s = ReplicationTable.getScanner(conn)) {
+      s.setRange(Range.exact(file));
+      StatusSection.limit(s);
+      Entry<Key,Value> entry = Iterables.getOnlyElement(s);
+
+      Assert.assertEquals(entry.getKey().getColumnFamily(), StatusSection.NAME);
+      Assert.assertEquals(entry.getKey().getColumnQualifier().toString(), target.getSourceTableId().canonicalID());
+
+      // We should only rely on the correct begin attribute being returned
+      Status actual = Status.parseFrom(entry.getValue().get());
+      Assert.assertEquals(stat.getBegin(), actual.getBegin());
+    }
   }
 
   @Test
@@ -117,17 +118,18 @@ public void chooseMinimumBeginOffset() throws Exception {
 
     updater.run();
 
-    Scanner s = ReplicationTable.getScanner(conn);
-    s.setRange(Range.exact(file));
-    StatusSection.limit(s);
-    Entry<Key,Value> entry = Iterables.getOnlyElement(s);
+    try (Scanner s = ReplicationTable.getScanner(conn)) {
+      s.setRange(Range.exact(file));
+      StatusSection.limit(s);
+      Entry<Key,Value> entry = Iterables.getOnlyElement(s);
 
-    Assert.assertEquals(entry.getKey().getColumnFamily(), StatusSection.NAME);
-    Assert.assertEquals(entry.getKey().getColumnQualifier().toString(), target1.getSourceTableId().canonicalID());
+      Assert.assertEquals(entry.getKey().getColumnFamily(), StatusSection.NAME);
+      Assert.assertEquals(entry.getKey().getColumnQualifier().toString(), target1.getSourceTableId().canonicalID());
 
-    // We should only rely on the correct begin attribute being returned
-    Status actual = Status.parseFrom(entry.getValue().get());
-    Assert.assertEquals(1, actual.getBegin());
+      // We should only rely on the correct begin attribute being returned
+      Status actual = Status.parseFrom(entry.getValue().get());
+      Assert.assertEquals(1, actual.getBegin());
+    }
   }
 
   @Test
@@ -157,17 +159,18 @@ public void chooseMinimumBeginOffsetInfiniteEnd() throws Exception {
 
     updater.run();
 
-    Scanner s = ReplicationTable.getScanner(conn);
-    s.setRange(Range.exact(file));
-    StatusSection.limit(s);
-    Entry<Key,Value> entry = Iterables.getOnlyElement(s);
+    try (Scanner s = ReplicationTable.getScanner(conn)) {
+      s.setRange(Range.exact(file));
+      StatusSection.limit(s);
+      Entry<Key,Value> entry = Iterables.getOnlyElement(s);
 
-    Assert.assertEquals(entry.getKey().getColumnFamily(), StatusSection.NAME);
-    Assert.assertEquals(entry.getKey().getColumnQualifier().toString(), target1.getSourceTableId().canonicalID());
+      Assert.assertEquals(entry.getKey().getColumnFamily(), StatusSection.NAME);
+      Assert.assertEquals(entry.getKey().getColumnQualifier().toString(), target1.getSourceTableId().canonicalID());
 
-    // We should only rely on the correct begin attribute being returned
-    Status actual = Status.parseFrom(entry.getValue().get());
-    Assert.assertEquals(1, actual.getBegin());
+      // We should only rely on the correct begin attribute being returned
+      Status actual = Status.parseFrom(entry.getValue().get());
+      Assert.assertEquals(1, actual.getBegin());
+    }
   }
 
 }
diff --git a/test/src/main/java/org/apache/accumulo/test/replication/GarbageCollectorCommunicatesWithTServersIT.java b/test/src/main/java/org/apache/accumulo/test/replication/GarbageCollectorCommunicatesWithTServersIT.java
index ef11bdf724..8aaf65b2dd 100644
--- a/test/src/main/java/org/apache/accumulo/test/replication/GarbageCollectorCommunicatesWithTServersIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/replication/GarbageCollectorCommunicatesWithTServersIT.java
@@ -127,21 +127,21 @@ public void configure(MiniAccumuloConfigImpl cfg, Configuration coreSite) {
 
     Assert.assertNotNull("Could not determine table ID for " + tableName, tableId);
 
-    Scanner s = conn.createScanner(MetadataTable.NAME, Authorizations.EMPTY);
-    Range r = MetadataSchema.TabletsSection.getRange(tableId);
-    s.setRange(r);
-    s.fetchColumnFamily(MetadataSchema.TabletsSection.DataFileColumnFamily.NAME);
-
     Set<String> rfiles = new HashSet<>();
-    for (Entry<Key,Value> entry : s) {
-      log.debug("Reading RFiles: {}={}", entry.getKey().toStringNoTruncate(), entry.getValue());
-      // uri://path/to/wal
-      String cq = entry.getKey().getColumnQualifier().toString();
-      String path = new Path(cq).toString();
-      log.debug("Normalize path to rfile: {}", path);
-      rfiles.add(path);
+    try (Scanner s = conn.createScanner(MetadataTable.NAME, Authorizations.EMPTY)) {
+      Range r = MetadataSchema.TabletsSection.getRange(tableId);
+      s.setRange(r);
+      s.fetchColumnFamily(MetadataSchema.TabletsSection.DataFileColumnFamily.NAME);
+
+      for (Entry<Key,Value> entry : s) {
+        log.debug("Reading RFiles: {}={}", entry.getKey().toStringNoTruncate(), entry.getValue());
+        // uri://path/to/wal
+        String cq = entry.getKey().getColumnQualifier().toString();
+        String path = new Path(cq).toString();
+        log.debug("Normalize path to rfile: {}", path);
+        rfiles.add(path);
+      }
     }
-
     return rfiles;
   }
 
@@ -154,20 +154,20 @@ public void configure(MiniAccumuloConfigImpl cfg, Configuration coreSite) {
 
     Assert.assertNotNull("Could not determine table ID for " + tableName, tableId);
 
-    Scanner s = conn.createScanner(MetadataTable.NAME, Authorizations.EMPTY);
-    Range r = MetadataSchema.ReplicationSection.getRange();
-    s.setRange(r);
-    s.fetchColumn(MetadataSchema.ReplicationSection.COLF, new Text(tableId));
-
     Map<String,Status> fileToStatus = new HashMap<>();
-    for (Entry<Key,Value> entry : s) {
-      Text file = new Text();
-      MetadataSchema.ReplicationSection.getFile(entry.getKey(), file);
-      Status status = Status.parseFrom(entry.getValue().get());
-      log.info("Got status for {}: {}", file, ProtobufUtil.toString(status));
-      fileToStatus.put(file.toString(), status);
+    try (Scanner s = conn.createScanner(MetadataTable.NAME, Authorizations.EMPTY)) {
+      Range r = MetadataSchema.ReplicationSection.getRange();
+      s.setRange(r);
+      s.fetchColumn(MetadataSchema.ReplicationSection.COLF, new Text(tableId));
+
+      for (Entry<Key,Value> entry : s) {
+        Text file = new Text();
+        MetadataSchema.ReplicationSection.getFile(entry.getKey(), file);
+        Status status = Status.parseFrom(entry.getValue().get());
+        log.info("Got status for {}: {}", file, ProtobufUtil.toString(status));
+        fileToStatus.put(file.toString(), status);
+      }
     }
-
     return fileToStatus;
   }
 
diff --git a/test/src/main/java/org/apache/accumulo/test/replication/MultiInstanceReplicationIT.java b/test/src/main/java/org/apache/accumulo/test/replication/MultiInstanceReplicationIT.java
index 991038395e..645f92ddb9 100644
--- a/test/src/main/java/org/apache/accumulo/test/replication/MultiInstanceReplicationIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/replication/MultiInstanceReplicationIT.java
@@ -289,22 +289,24 @@ public Boolean call() throws Exception {
         log.info("{} {}", kv.getKey().toStringNoTruncate(), ProtobufUtil.toString(Status.parseFrom(kv.getValue().get())));
       }
 
-      Scanner master = connMaster.createScanner(masterTable, Authorizations.EMPTY), peer = connPeer.createScanner(peerTable, Authorizations.EMPTY);
-      Iterator<Entry<Key,Value>> masterIter = master.iterator(), peerIter = peer.iterator();
-      Entry<Key,Value> masterEntry = null, peerEntry = null;
-      while (masterIter.hasNext() && peerIter.hasNext()) {
-        masterEntry = masterIter.next();
-        peerEntry = peerIter.next();
-        Assert.assertEquals(masterEntry.getKey() + " was not equal to " + peerEntry.getKey(), 0,
-            masterEntry.getKey().compareTo(peerEntry.getKey(), PartialKey.ROW_COLFAM_COLQUAL_COLVIS));
-        Assert.assertEquals(masterEntry.getValue(), peerEntry.getValue());
-      }
+      try (Scanner master = connMaster.createScanner(masterTable, Authorizations.EMPTY); Scanner peer = connPeer.createScanner(peerTable, Authorizations.EMPTY)) {
+        Iterator<Entry<Key,Value>> masterIter = master.iterator(), peerIter = peer.iterator();
+        Entry<Key,Value> masterEntry = null, peerEntry = null;
+        while (masterIter.hasNext() && peerIter.hasNext()) {
+          masterEntry = masterIter.next();
+          peerEntry = peerIter.next();
+          Assert.assertEquals(masterEntry.getKey() + " was not equal to " + peerEntry.getKey(), 0,
+              masterEntry.getKey().compareTo(peerEntry.getKey(), PartialKey.ROW_COLFAM_COLQUAL_COLVIS));
+          Assert.assertEquals(masterEntry.getValue(), peerEntry.getValue());
+        }
 
-      log.info("Last master entry: {}", masterEntry);
-      log.info("Last peer entry: {}", peerEntry);
+        log.info("Last master entry: {}", masterEntry);
+        log.info("Last peer entry: {}", peerEntry);
 
-      Assert.assertFalse("Had more data to read from the master", masterIter.hasNext());
-      Assert.assertFalse("Had more data to read from the peer", peerIter.hasNext());
+        Assert.assertFalse("Had more data to read from the master", masterIter.hasNext());
+        Assert.assertFalse("Had more data to read from the peer", peerIter.hasNext());
+        master.close();
+      }
     } finally {
       peerCluster.stop();
     }
@@ -549,18 +551,18 @@ public void dataWasReplicatedToThePeerWithoutDrain() throws Exception {
 
     connMaster.replicationOperations().drain(masterTable, files);
 
-    Scanner master = connMaster.createScanner(masterTable, Authorizations.EMPTY), peer = connPeer.createScanner(peerTable, Authorizations.EMPTY);
-    Iterator<Entry<Key,Value>> masterIter = master.iterator(), peerIter = peer.iterator();
-    while (masterIter.hasNext() && peerIter.hasNext()) {
-      Entry<Key,Value> masterEntry = masterIter.next(), peerEntry = peerIter.next();
-      Assert.assertEquals(peerEntry.getKey() + " was not equal to " + peerEntry.getKey(), 0,
-          masterEntry.getKey().compareTo(peerEntry.getKey(), PartialKey.ROW_COLFAM_COLQUAL_COLVIS));
-      Assert.assertEquals(masterEntry.getValue(), peerEntry.getValue());
-    }
-
-    Assert.assertFalse("Had more data to read from the master", masterIter.hasNext());
-    Assert.assertFalse("Had more data to read from the peer", peerIter.hasNext());
+    try (Scanner master = connMaster.createScanner(masterTable, Authorizations.EMPTY); Scanner peer = connPeer.createScanner(peerTable, Authorizations.EMPTY)) {
+      Iterator<Entry<Key,Value>> masterIter = master.iterator(), peerIter = peer.iterator();
+      while (masterIter.hasNext() && peerIter.hasNext()) {
+        Entry<Key,Value> masterEntry = masterIter.next(), peerEntry = peerIter.next();
+        Assert.assertEquals(peerEntry.getKey() + " was not equal to " + peerEntry.getKey(), 0,
+            masterEntry.getKey().compareTo(peerEntry.getKey(), PartialKey.ROW_COLFAM_COLQUAL_COLVIS));
+        Assert.assertEquals(masterEntry.getValue(), peerEntry.getValue());
+      }
 
+      Assert.assertFalse("Had more data to read from the master", masterIter.hasNext());
+      Assert.assertFalse("Had more data to read from the peer", peerIter.hasNext());
+    }
     peerCluster.stop();
   }
 
@@ -673,12 +675,13 @@ public void dataReplicatedToCorrectTableWithoutDrain() throws Exception {
       for (int i = 0; i < 10 && !fullyReplicated; i++) {
         sleepUninterruptibly(2, TimeUnit.SECONDS);
 
-        Scanner s = ReplicationTable.getScanner(connMaster);
-        WorkSection.limit(s);
-        for (Entry<Key,Value> entry : s) {
-          Status status = Status.parseFrom(entry.getValue().get());
-          if (StatusUtil.isFullyReplicated(status)) {
-            fullyReplicated |= true;
+        try (Scanner s = ReplicationTable.getScanner(connMaster)) {
+          WorkSection.limit(s);
+          for (Entry<Key,Value> entry : s) {
+            Status status = Status.parseFrom(entry.getValue().get());
+            if (StatusUtil.isFullyReplicated(status)) {
+              fullyReplicated |= true;
+            }
           }
         }
       }
diff --git a/test/src/main/java/org/apache/accumulo/test/replication/MultiTserverReplicationIT.java b/test/src/main/java/org/apache/accumulo/test/replication/MultiTserverReplicationIT.java
index c9d4126ece..e75535a283 100644
--- a/test/src/main/java/org/apache/accumulo/test/replication/MultiTserverReplicationIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/replication/MultiTserverReplicationIT.java
@@ -59,28 +59,29 @@ public void tserverReplicationServicePortsAreAdvertised() throws Exception {
 
     // Wait for a tserver to come up to fulfill this request
     conn.tableOperations().create("foo");
-    Scanner s = conn.createScanner("foo", Authorizations.EMPTY);
-    Assert.assertEquals(0, Iterables.size(s));
-
-    ZooReader zreader = new ZooReader(inst.getZooKeepers(), inst.getZooKeepersSessionTimeOut());
-    Set<String> tserverHost = new HashSet<>();
-    tserverHost.addAll(zreader.getChildren(ZooUtil.getRoot(inst) + Constants.ZTSERVERS));
-
-    Set<HostAndPort> replicationServices = new HashSet<>();
-
-    for (String tserver : tserverHost) {
-      try {
-        byte[] portData = zreader.getData(ZooUtil.getRoot(inst) + ReplicationConstants.ZOO_TSERVERS + "/" + tserver, null);
-        HostAndPort replAddress = HostAndPort.fromString(new String(portData, UTF_8));
-        replicationServices.add(replAddress);
-      } catch (Exception e) {
-        log.error("Could not find port for {}", tserver, e);
-        Assert.fail("Did not find replication port advertisement for " + tserver);
+    try (Scanner s = conn.createScanner("foo", Authorizations.EMPTY)) {
+      Assert.assertEquals(0, Iterables.size(s));
+
+      ZooReader zreader = new ZooReader(inst.getZooKeepers(), inst.getZooKeepersSessionTimeOut());
+      Set<String> tserverHost = new HashSet<>();
+      tserverHost.addAll(zreader.getChildren(ZooUtil.getRoot(inst) + Constants.ZTSERVERS));
+
+      Set<HostAndPort> replicationServices = new HashSet<>();
+
+      for (String tserver : tserverHost) {
+        try {
+          byte[] portData = zreader.getData(ZooUtil.getRoot(inst) + ReplicationConstants.ZOO_TSERVERS + "/" + tserver, null);
+          HostAndPort replAddress = HostAndPort.fromString(new String(portData, UTF_8));
+          replicationServices.add(replAddress);
+        } catch (Exception e) {
+          log.error("Could not find port for {}", tserver, e);
+          Assert.fail("Did not find replication port advertisement for " + tserver);
+        }
       }
-    }
 
-    // Each tserver should also have equial replicaiton services running internally
-    Assert.assertEquals("Expected an equal number of replication servicers and tservers", tserverHost.size(), replicationServices.size());
+      // Each tserver should also have equial replicaiton services running internally
+      Assert.assertEquals("Expected an equal number of replication servicers and tservers", tserverHost.size(), replicationServices.size());
+    }
   }
 
   @Test
@@ -91,25 +92,26 @@ public void masterReplicationServicePortsAreAdvertised() throws Exception {
 
     // Wait for a tserver to come up to fulfill this request
     conn.tableOperations().create("foo");
-    Scanner s = conn.createScanner("foo", Authorizations.EMPTY);
-    Assert.assertEquals(0, Iterables.size(s));
+    try (Scanner s = conn.createScanner("foo", Authorizations.EMPTY)) {
+      Assert.assertEquals(0, Iterables.size(s));
 
-    ZooReader zreader = new ZooReader(inst.getZooKeepers(), inst.getZooKeepersSessionTimeOut());
+      ZooReader zreader = new ZooReader(inst.getZooKeepers(), inst.getZooKeepersSessionTimeOut());
 
-    // Should have one master instance
-    Assert.assertEquals(1, inst.getMasterLocations().size());
+      // Should have one master instance
+      Assert.assertEquals(1, inst.getMasterLocations().size());
 
-    // Get the master thrift service addr
-    String masterAddr = Iterables.getOnlyElement(inst.getMasterLocations());
+      // Get the master thrift service addr
+      String masterAddr = Iterables.getOnlyElement(inst.getMasterLocations());
 
-    // Get the master replication coordinator addr
-    String replCoordAddr = new String(zreader.getData(ZooUtil.getRoot(inst) + Constants.ZMASTER_REPLICATION_COORDINATOR_ADDR, null), UTF_8);
+      // Get the master replication coordinator addr
+      String replCoordAddr = new String(zreader.getData(ZooUtil.getRoot(inst) + Constants.ZMASTER_REPLICATION_COORDINATOR_ADDR, null), UTF_8);
 
-    // They shouldn't be the same
-    Assert.assertNotEquals(masterAddr, replCoordAddr);
+      // They shouldn't be the same
+      Assert.assertNotEquals(masterAddr, replCoordAddr);
 
-    // Neither should be zero as the port
-    Assert.assertNotEquals(0, HostAndPort.fromString(masterAddr).getPort());
-    Assert.assertNotEquals(0, HostAndPort.fromString(replCoordAddr).getPort());
+      // Neither should be zero as the port
+      Assert.assertNotEquals(0, HostAndPort.fromString(masterAddr).getPort());
+      Assert.assertNotEquals(0, HostAndPort.fromString(replCoordAddr).getPort());
+    }
   }
 }
diff --git a/test/src/main/java/org/apache/accumulo/test/replication/RemoveCompleteReplicationRecordsIT.java b/test/src/main/java/org/apache/accumulo/test/replication/RemoveCompleteReplicationRecordsIT.java
index 2a4af6b69e..964aca6950 100644
--- a/test/src/main/java/org/apache/accumulo/test/replication/RemoveCompleteReplicationRecordsIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/replication/RemoveCompleteReplicationRecordsIT.java
@@ -96,18 +96,17 @@ public void notYetReplicationRecordsIgnored() throws Exception {
 
     Assert.assertEquals(numRecords, Iterables.size(ReplicationTable.getScanner(conn)));
 
-    BatchScanner bs = ReplicationTable.getBatchScanner(conn, 1);
-    bs.setRanges(Collections.singleton(new Range()));
-    IteratorSetting cfg = new IteratorSetting(50, WholeRowIterator.class);
-    bs.addScanIterator(cfg);
-    bw = EasyMock.createMock(BatchWriter.class);
+    try (BatchScanner bs = ReplicationTable.getBatchScanner(conn, 1)) {
+      bs.setRanges(Collections.singleton(new Range()));
+      IteratorSetting cfg = new IteratorSetting(50, WholeRowIterator.class);
+      bs.addScanIterator(cfg);
+      bw = EasyMock.createMock(BatchWriter.class);
 
-    EasyMock.replay(bw);
+      EasyMock.replay(bw);
 
-    rcrr.removeCompleteRecords(conn, bs, bw);
-    bs.close();
-
-    Assert.assertEquals(numRecords, Iterables.size(ReplicationTable.getScanner(conn)));
+      rcrr.removeCompleteRecords(conn, bs, bw);
+      Assert.assertEquals(numRecords, Iterables.size(ReplicationTable.getScanner(conn)));
+    }
   }
 
   @Test
@@ -129,19 +128,18 @@ public void partiallyReplicatedRecordsIgnored() throws Exception {
 
     Assert.assertEquals(numRecords, Iterables.size(ReplicationTable.getScanner(conn)));
 
-    BatchScanner bs = ReplicationTable.getBatchScanner(conn, 1);
-    bs.setRanges(Collections.singleton(new Range()));
-    IteratorSetting cfg = new IteratorSetting(50, WholeRowIterator.class);
-    bs.addScanIterator(cfg);
-    bw = EasyMock.createMock(BatchWriter.class);
+    try (BatchScanner bs = ReplicationTable.getBatchScanner(conn, 1)) {
+      bs.setRanges(Collections.singleton(new Range()));
+      IteratorSetting cfg = new IteratorSetting(50, WholeRowIterator.class);
+      bs.addScanIterator(cfg);
+      bw = EasyMock.createMock(BatchWriter.class);
 
-    EasyMock.replay(bw);
+      EasyMock.replay(bw);
 
-    // We don't remove any records, so we can just pass in a fake BW for both
-    rcrr.removeCompleteRecords(conn, bs, bw);
-    bs.close();
-
-    Assert.assertEquals(numRecords, Iterables.size(ReplicationTable.getScanner(conn)));
+      // We don't remove any records, so we can just pass in a fake BW for both
+      rcrr.removeCompleteRecords(conn, bs, bw);
+      Assert.assertEquals(numRecords, Iterables.size(ReplicationTable.getScanner(conn)));
+    }
   }
 
   @Test
@@ -183,16 +181,16 @@ public void replicatedClosedWorkRecordsAreNotRemovedWithoutClosedStatusRecords()
     Assert.assertEquals(numRecords, Iterables.size(ReplicationTable.getScanner(conn)));
 
     // We should not remove any records because they're missing closed status
-    BatchScanner bs = ReplicationTable.getBatchScanner(conn, 1);
-    bs.setRanges(Collections.singleton(new Range()));
-    IteratorSetting cfg = new IteratorSetting(50, WholeRowIterator.class);
-    bs.addScanIterator(cfg);
-
-    try {
-      Assert.assertEquals(0l, rcrr.removeCompleteRecords(conn, bs, replBw));
-    } finally {
-      bs.close();
-      replBw.close();
+    try (BatchScanner bs = ReplicationTable.getBatchScanner(conn, 1)) {
+      bs.setRanges(Collections.singleton(new Range()));
+      IteratorSetting cfg = new IteratorSetting(50, WholeRowIterator.class);
+      bs.addScanIterator(cfg);
+
+      try {
+        Assert.assertEquals(0l, rcrr.removeCompleteRecords(conn, bs, replBw));
+      } finally {
+        replBw.close();
+      }
     }
   }
 
@@ -264,27 +262,27 @@ public void replicatedClosedRowsAreRemoved() throws Exception {
     Assert.assertEquals(numRecords, Iterables.size(ReplicationTable.getScanner(conn)));
 
     // We should remove the two fully completed records we inserted
-    BatchScanner bs = ReplicationTable.getBatchScanner(conn, 1);
-    bs.setRanges(Collections.singleton(new Range()));
-    StatusSection.limit(bs);
-    WorkSection.limit(bs);
-    IteratorSetting cfg = new IteratorSetting(50, WholeRowIterator.class);
-    bs.addScanIterator(cfg);
-
-    try {
-      Assert.assertEquals(4l, rcrr.removeCompleteRecords(conn, bs, replBw));
-    } finally {
-      bs.close();
-      replBw.close();
-    }
-
-    int actualRecords = 0;
-    for (Entry<Key,Value> entry : ReplicationTable.getScanner(conn)) {
-      Assert.assertFalse(filesToRemove.contains(entry.getKey().getRow().toString()));
-      actualRecords++;
+    try (BatchScanner bs = ReplicationTable.getBatchScanner(conn, 1)) {
+      bs.setRanges(Collections.singleton(new Range()));
+      StatusSection.limit(bs);
+      WorkSection.limit(bs);
+      IteratorSetting cfg = new IteratorSetting(50, WholeRowIterator.class);
+      bs.addScanIterator(cfg);
+
+      try {
+        Assert.assertEquals(4l, rcrr.removeCompleteRecords(conn, bs, replBw));
+      } finally {
+        replBw.close();
+      }
+
+      int actualRecords = 0;
+      for (Entry<Key,Value> entry : ReplicationTable.getScanner(conn)) {
+        Assert.assertFalse(filesToRemove.contains(entry.getKey().getRow().toString()));
+        actualRecords++;
+      }
+
+      Assert.assertEquals(finalNumRecords, actualRecords);
     }
-
-    Assert.assertEquals(finalNumRecords, actualRecords);
   }
 
   @Test
@@ -326,16 +324,16 @@ public void partiallyReplicatedEntriesPrecludeRowDeletion() throws Exception {
     Assert.assertEquals(numRecords, Iterables.size(ReplicationTable.getScanner(conn)));
 
     // We should remove the two fully completed records we inserted
-    BatchScanner bs = ReplicationTable.getBatchScanner(conn, 1);
-    bs.setRanges(Collections.singleton(new Range()));
-    IteratorSetting cfg = new IteratorSetting(50, WholeRowIterator.class);
-    bs.addScanIterator(cfg);
-
-    try {
-      Assert.assertEquals(0l, rcrr.removeCompleteRecords(conn, bs, replBw));
-    } finally {
-      bs.close();
-      replBw.close();
+    try (BatchScanner bs = ReplicationTable.getBatchScanner(conn, 1)) {
+      bs.setRanges(Collections.singleton(new Range()));
+      IteratorSetting cfg = new IteratorSetting(50, WholeRowIterator.class);
+      bs.addScanIterator(cfg);
+
+      try {
+        Assert.assertEquals(0l, rcrr.removeCompleteRecords(conn, bs, replBw));
+      } finally {
+        replBw.close();
+      }
     }
   }
 }
diff --git a/test/src/main/java/org/apache/accumulo/test/replication/ReplicationIT.java b/test/src/main/java/org/apache/accumulo/test/replication/ReplicationIT.java
index 59343ae15a..9a20042057 100644
--- a/test/src/main/java/org/apache/accumulo/test/replication/ReplicationIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/replication/ReplicationIT.java
@@ -142,34 +142,34 @@ public void configure(MiniAccumuloConfigImpl cfg, Configuration hadoopCoreSite)
   private Multimap<String,Table.ID> getLogs(Connector conn) throws Exception {
     // Map of server to tableId
     Multimap<TServerInstance,String> serverToTableID = HashMultimap.create();
-    Scanner scanner = conn.createScanner(MetadataTable.NAME, Authorizations.EMPTY);
-    scanner.setRange(MetadataSchema.TabletsSection.getRange());
-    scanner.fetchColumnFamily(MetadataSchema.TabletsSection.CurrentLocationColumnFamily.NAME);
-    for (Entry<Key,Value> entry : scanner) {
-      TServerInstance key = new TServerInstance(entry.getValue(), entry.getKey().getColumnQualifier());
-      byte[] tableId = KeyExtent.tableOfMetadataRow(entry.getKey().getRow());
-      serverToTableID.put(key, new String(tableId, UTF_8));
-    }
-    // Map of logs to tableId
-    Multimap<String,Table.ID> logs = HashMultimap.create();
-    Instance i = conn.getInstance();
-    ZooReaderWriter zk = new ZooReaderWriter(i.getZooKeepers(), i.getZooKeepersSessionTimeOut(), "");
-    WalStateManager wals = new WalStateManager(conn.getInstance(), zk);
-    for (Entry<TServerInstance,List<UUID>> entry : wals.getAllMarkers().entrySet()) {
-      for (UUID id : entry.getValue()) {
-        Pair<WalState,Path> state = wals.state(entry.getKey(), id);
-        for (String tableId : serverToTableID.get(entry.getKey())) {
-          logs.put(state.getSecond().toString(), Table.ID.of(tableId));
+    try (Scanner scanner = conn.createScanner(MetadataTable.NAME, Authorizations.EMPTY)) {
+      scanner.setRange(MetadataSchema.TabletsSection.getRange());
+      scanner.fetchColumnFamily(MetadataSchema.TabletsSection.CurrentLocationColumnFamily.NAME);
+      for (Entry<Key,Value> entry : scanner) {
+        TServerInstance key = new TServerInstance(entry.getValue(), entry.getKey().getColumnQualifier());
+        byte[] tableId = KeyExtent.tableOfMetadataRow(entry.getKey().getRow());
+        serverToTableID.put(key, new String(tableId, UTF_8));
+      }
+      // Map of logs to tableId
+      Multimap<String,Table.ID> logs = HashMultimap.create();
+      Instance i = conn.getInstance();
+      ZooReaderWriter zk = new ZooReaderWriter(i.getZooKeepers(), i.getZooKeepersSessionTimeOut(), "");
+      WalStateManager wals = new WalStateManager(conn.getInstance(), zk);
+      for (Entry<TServerInstance,List<UUID>> entry : wals.getAllMarkers().entrySet()) {
+        for (UUID id : entry.getValue()) {
+          Pair<WalState,Path> state = wals.state(entry.getKey(), id);
+          for (String tableId : serverToTableID.get(entry.getKey())) {
+            logs.put(state.getSecond().toString(), Table.ID.of(tableId));
+          }
         }
       }
+      return logs;
     }
-    return logs;
   }
 
   private Multimap<String,Table.ID> getAllLogs(Connector conn) throws Exception {
     Multimap<String,Table.ID> logs = getLogs(conn);
-    try {
-      Scanner scanner = conn.createScanner(ReplicationTable.NAME, Authorizations.EMPTY);
+    try (Scanner scanner = conn.createScanner(ReplicationTable.NAME, Authorizations.EMPTY)) {
       StatusSection.limit(scanner);
       Text buff = new Text();
       for (Entry<Key,Value> entry : scanner) {
@@ -303,22 +303,22 @@ public void correctRecordsCompleteFile() throws Exception {
         conn.securityOperations().hasTablePermission("root", ReplicationTable.NAME, TablePermission.READ));
 
     Set<String> replRows = new HashSet<>();
-    Scanner scanner;
     int attempts = 5;
     while (replRows.isEmpty() && attempts > 0) {
-      scanner = ReplicationTable.getScanner(conn);
-      StatusSection.limit(scanner);
-      for (Entry<Key,Value> entry : scanner) {
-        Key k = entry.getKey();
+      try (Scanner scanner = ReplicationTable.getScanner(conn)) {
+        StatusSection.limit(scanner);
+        for (Entry<Key,Value> entry : scanner) {
+          Key k = entry.getKey();
 
-        String fileUri = k.getRow().toString();
-        try {
-          new URI(fileUri);
-        } catch (URISyntaxException e) {
-          Assert.fail("Expected a valid URI: " + fileUri);
-        }
+          String fileUri = k.getRow().toString();
+          try {
+            new URI(fileUri);
+          } catch (URISyntaxException e) {
+            Assert.fail("Expected a valid URI: " + fileUri);
+          }
 
-        replRows.add(fileUri);
+          replRows.add(fileUri);
+        }
       }
     }
 
@@ -417,19 +417,20 @@ public void twoEntriesForTwoTables() throws Exception {
     Assert.assertTrue(ReplicationTable.isOnline(conn));
 
     // Verify that we found a single replication record that's for table1
-    Scanner s = ReplicationTable.getScanner(conn);
-    StatusSection.limit(s);
-    for (int i = 0; i < 5; i++) {
-      if (Iterators.size(s.iterator()) == 1) {
-        break;
+    Entry<Key,Value> entry;
+    try (Scanner s = ReplicationTable.getScanner(conn)) {
+      StatusSection.limit(s);
+      for (int i = 0; i < 5; i++) {
+        if (Iterators.size(s.iterator()) == 1) {
+          break;
+        }
+        Thread.sleep(1000);
       }
-      Thread.sleep(1000);
+      entry = Iterators.getOnlyElement(s.iterator());
     }
-    Entry<Key,Value> entry = Iterators.getOnlyElement(s.iterator());
     // We should at least find one status record for this table, we might find a second if another log was started from ingesting the data
     Assert.assertEquals("Expected to find replication entry for " + table1, conn.tableOperations().tableIdMap().get(table1), entry.getKey()
         .getColumnQualifier().toString());
-    s.close();
 
     // Enable replication on table2
     conn.tableOperations().setProperty(table2, Property.TABLE_REPLICATION.getKey(), "true");
@@ -444,36 +445,39 @@ public void twoEntriesForTwoTables() throws Exception {
     Set<String> tableIdsForMetadata = Sets.newHashSet(tableIds);
 
     List<Entry<Key,Value>> records = new ArrayList<>();
-    s = conn.createScanner(MetadataTable.NAME, Authorizations.EMPTY);
-    s.setRange(MetadataSchema.ReplicationSection.getRange());
-    for (Entry<Key,Value> metadata : s) {
-      records.add(metadata);
-      log.debug("Meta: {} => {}", metadata.getKey().toStringNoTruncate(), metadata.getValue().toString());
-    }
 
-    Assert.assertEquals("Expected to find 2 records, but actually found " + records, 2, records.size());
+    try (Scanner s = conn.createScanner(MetadataTable.NAME, Authorizations.EMPTY)) {
+      s.setRange(MetadataSchema.ReplicationSection.getRange());
+      for (Entry<Key,Value> metadata : s) {
+        records.add(metadata);
+        log.debug("Meta: {} => {}", metadata.getKey().toStringNoTruncate(), metadata.getValue().toString());
+      }
 
-    for (Entry<Key,Value> metadata : records) {
-      Assert.assertTrue("Expected record to be in metadata but wasn't " + metadata.getKey().toStringNoTruncate() + ", tableIds remaining "
-          + tableIdsForMetadata, tableIdsForMetadata.remove(metadata.getKey().getColumnQualifier().toString()));
-    }
+      Assert.assertEquals("Expected to find 2 records, but actually found " + records, 2, records.size());
+
+      for (Entry<Key,Value> metadata : records) {
+        Assert.assertTrue("Expected record to be in metadata but wasn't " + metadata.getKey().toStringNoTruncate() + ", tableIds remaining "
+            + tableIdsForMetadata, tableIdsForMetadata.remove(metadata.getKey().getColumnQualifier().toString()));
+      }
 
-    Assert.assertTrue("Expected that we had removed all metadata entries " + tableIdsForMetadata, tableIdsForMetadata.isEmpty());
+      Assert.assertTrue("Expected that we had removed all metadata entries " + tableIdsForMetadata, tableIdsForMetadata.isEmpty());
 
-    // Should be creating these records in replication table from metadata table every second
-    Thread.sleep(5000);
+      // Should be creating these records in replication table from metadata table every second
+      Thread.sleep(5000);
+    }
 
     // Verify that we found two replication records: one for table1 and one for table2
-    s = ReplicationTable.getScanner(conn);
-    StatusSection.limit(s);
-    Iterator<Entry<Key,Value>> iter = s.iterator();
-    Assert.assertTrue("Found no records in replication table", iter.hasNext());
-    entry = iter.next();
-    Assert.assertTrue("Expected to find element in replication table", tableIds.remove(entry.getKey().getColumnQualifier().toString()));
-    Assert.assertTrue("Expected to find two elements in replication table, only found one ", iter.hasNext());
-    entry = iter.next();
-    Assert.assertTrue("Expected to find element in replication table", tableIds.remove(entry.getKey().getColumnQualifier().toString()));
-    Assert.assertFalse("Expected to only find two elements in replication table", iter.hasNext());
+    try (Scanner s = ReplicationTable.getScanner(conn)) {
+      StatusSection.limit(s);
+      Iterator<Entry<Key,Value>> iter = s.iterator();
+      Assert.assertTrue("Found no records in replication table", iter.hasNext());
+      entry = iter.next();
+      Assert.assertTrue("Expected to find element in replication table", tableIds.remove(entry.getKey().getColumnQualifier().toString()));
+      Assert.assertTrue("Expected to find two elements in replication table, only found one ", iter.hasNext());
+      entry = iter.next();
+      Assert.assertTrue("Expected to find element in replication table", tableIds.remove(entry.getKey().getColumnQualifier().toString()));
+      Assert.assertFalse("Expected to only find two elements in replication table", iter.hasNext());
+    }
   }
 
   private void writeSomeData(Connector conn, String table, int rows, int cols) throws Exception {
@@ -583,13 +587,14 @@ public void run() {
   }
 
   private Set<String> getReferencesToFilesToBeReplicated(final Connector conn) throws ReplicationTableOfflineException {
-    Scanner s = ReplicationTable.getScanner(conn);
-    StatusSection.limit(s);
-    Set<String> replFiles = new HashSet<>();
-    for (Entry<Key,Value> entry : s) {
-      replFiles.add(entry.getKey().getRow().toString());
+    try (Scanner s = ReplicationTable.getScanner(conn)) {
+      StatusSection.limit(s);
+      Set<String> replFiles = new HashSet<>();
+      for (Entry<Key,Value> entry : s) {
+        replFiles.add(entry.getKey().getRow().toString());
+      }
+      return replFiles;
     }
-    return replFiles;
   }
 
   @Test
@@ -609,25 +614,28 @@ public void combinerWorksOnMetadata() throws Exception {
     bw.addMutation(m);
     bw.close();
 
-    Scanner s = conn.createScanner(MetadataTable.NAME, Authorizations.EMPTY);
-    s.setRange(ReplicationSection.getRange());
+    Status actual;
+    try (Scanner s = conn.createScanner(MetadataTable.NAME, Authorizations.EMPTY)) {
+      s.setRange(ReplicationSection.getRange());
 
-    Status actual = Status.parseFrom(Iterables.getOnlyElement(s).getValue().get());
-    Assert.assertEquals(stat1, actual);
+      actual = Status.parseFrom(Iterables.getOnlyElement(s).getValue().get());
+      Assert.assertEquals(stat1, actual);
 
-    bw = conn.createBatchWriter(MetadataTable.NAME, new BatchWriterConfig());
-    m = new Mutation(ReplicationSection.getRowPrefix() + "file:/accumulo/wals/tserver+port/uuid");
-    m.put(ReplicationSection.COLF, new Text("1"), ProtobufUtil.toValue(stat2));
-    bw.addMutation(m);
-    bw.close();
+      bw = conn.createBatchWriter(MetadataTable.NAME, new BatchWriterConfig());
+      m = new Mutation(ReplicationSection.getRowPrefix() + "file:/accumulo/wals/tserver+port/uuid");
+      m.put(ReplicationSection.COLF, new Text("1"), ProtobufUtil.toValue(stat2));
+      bw.addMutation(m);
+      bw.close();
+    }
 
-    s = conn.createScanner(MetadataTable.NAME, Authorizations.EMPTY);
-    s.setRange(ReplicationSection.getRange());
+    try (Scanner s = conn.createScanner(MetadataTable.NAME, Authorizations.EMPTY)) {
+      s.setRange(ReplicationSection.getRange());
 
-    actual = Status.parseFrom(Iterables.getOnlyElement(s).getValue().get());
-    Status expected = Status.newBuilder().setBegin(0).setEnd(0).setClosed(true).setInfiniteEnd(true).setCreatedTime(100).build();
+      actual = Status.parseFrom(Iterables.getOnlyElement(s).getValue().get());
+      Status expected = Status.newBuilder().setBegin(0).setEnd(0).setClosed(true).setInfiniteEnd(true).setCreatedTime(100).build();
 
-    Assert.assertEquals(expected, actual);
+      Assert.assertEquals(expected, actual);
+    }
   }
 
   @Test
@@ -700,83 +708,83 @@ public void filesClosedAfterUnused() throws Exception {
     bw.addMutation(m);
     bw.close();
 
-    Scanner s = conn.createScanner(MetadataTable.NAME, Authorizations.EMPTY);
-    s.fetchColumnFamily(TabletsSection.LogColumnFamily.NAME);
-    s.setRange(TabletsSection.getRange(tableId));
-    Set<String> wals = new HashSet<>();
-    for (Entry<Key,Value> entry : s) {
-      LogEntry logEntry = LogEntry.fromKeyValue(entry.getKey(), entry.getValue());
-      wals.add(new Path(logEntry.filename).toString());
-    }
-
-    log.warn("Found wals {}", wals);
+    try (Scanner s = conn.createScanner(MetadataTable.NAME, Authorizations.EMPTY)) {
+      s.fetchColumnFamily(TabletsSection.LogColumnFamily.NAME);
+      s.setRange(TabletsSection.getRange(tableId));
+      Set<String> wals = new HashSet<>();
+      for (Entry<Key,Value> entry : s) {
+        LogEntry logEntry = LogEntry.fromKeyValue(entry.getKey(), entry.getValue());
+        wals.add(new Path(logEntry.filename).toString());
+      }
 
-    bw = conn.createBatchWriter(table, new BatchWriterConfig());
-    m = new Mutation("three");
-    byte[] bytes = new byte[1024 * 1024];
-    m.put("1".getBytes(), new byte[0], bytes);
-    m.put("2".getBytes(), new byte[0], bytes);
-    m.put("3".getBytes(), new byte[0], bytes);
-    m.put("4".getBytes(), new byte[0], bytes);
-    m.put("5".getBytes(), new byte[0], bytes);
-    bw.addMutation(m);
-    bw.close();
+      log.warn("Found wals {}", wals);
 
-    conn.tableOperations().flush(table, null, null, true);
+      bw = conn.createBatchWriter(table, new BatchWriterConfig());
+      m = new Mutation("three");
+      byte[] bytes = new byte[1024 * 1024];
+      m.put("1".getBytes(), new byte[0], bytes);
+      m.put("2".getBytes(), new byte[0], bytes);
+      m.put("3".getBytes(), new byte[0], bytes);
+      m.put("4".getBytes(), new byte[0], bytes);
+      m.put("5".getBytes(), new byte[0], bytes);
+      bw.addMutation(m);
+      bw.close();
 
-    while (!ReplicationTable.isOnline(conn)) {
-      sleepUninterruptibly(MILLIS_BETWEEN_REPLICATION_TABLE_ONLINE_CHECKS, TimeUnit.MILLISECONDS);
-    }
+      conn.tableOperations().flush(table, null, null, true);
 
-    for (int i = 0; i < 10; i++) {
-      s = conn.createScanner(MetadataTable.NAME, Authorizations.EMPTY);
-      s.fetchColumnFamily(LogColumnFamily.NAME);
-      s.setRange(TabletsSection.getRange(tableId));
-      for (Entry<Key,Value> entry : s) {
-        log.info("{}={}", entry.getKey().toStringNoTruncate(), entry.getValue());
+      while (!ReplicationTable.isOnline(conn)) {
+        sleepUninterruptibly(MILLIS_BETWEEN_REPLICATION_TABLE_ONLINE_CHECKS, TimeUnit.MILLISECONDS);
       }
 
-      try {
-        s = ReplicationTable.getScanner(conn);
-        StatusSection.limit(s);
-        Text buff = new Text();
-        boolean allReferencedLogsClosed = true;
-        int recordsFound = 0;
-        for (Entry<Key,Value> e : s) {
-          recordsFound++;
-          allReferencedLogsClosed = true;
-          StatusSection.getFile(e.getKey(), buff);
-          String file = buff.toString();
-          if (wals.contains(file)) {
-            Status stat = Status.parseFrom(e.getValue().get());
-            if (!stat.getClosed()) {
-              log.info("{} wasn't closed", file);
-              allReferencedLogsClosed = false;
-            }
+      for (int i = 0; i < 10; i++) {
+        try (Scanner s2 = conn.createScanner(MetadataTable.NAME, Authorizations.EMPTY)) {
+          s2.fetchColumnFamily(LogColumnFamily.NAME);
+          s2.setRange(TabletsSection.getRange(tableId));
+          for (Entry<Key,Value> entry : s2) {
+            log.info("{}={}", entry.getKey().toStringNoTruncate(), entry.getValue());
           }
         }
 
-        if (recordsFound > 0 && allReferencedLogsClosed) {
-          return;
-        }
-        Thread.sleep(2000);
-      } catch (RuntimeException e) {
-        Throwable cause = e.getCause();
-        if (cause instanceof AccumuloSecurityException) {
-          AccumuloSecurityException ase = (AccumuloSecurityException) cause;
-          switch (ase.getSecurityErrorCode()) {
-            case PERMISSION_DENIED:
-              // We tried to read the replication table before the GRANT went through
-              Thread.sleep(2000);
-              break;
-            default:
-              throw e;
+        try (Scanner s3 = ReplicationTable.getScanner(conn)) {
+          StatusSection.limit(s3);
+          Text buff = new Text();
+          boolean allReferencedLogsClosed = true;
+          int recordsFound = 0;
+          for (Entry<Key,Value> e : s3) {
+            recordsFound++;
+            allReferencedLogsClosed = true;
+            StatusSection.getFile(e.getKey(), buff);
+            String file = buff.toString();
+            if (wals.contains(file)) {
+              Status stat = Status.parseFrom(e.getValue().get());
+              if (!stat.getClosed()) {
+                log.info("{} wasn't closed", file);
+                allReferencedLogsClosed = false;
+              }
+            }
+          }
+
+          if (recordsFound > 0 && allReferencedLogsClosed) {
+            return;
+          }
+          Thread.sleep(2000);
+        } catch (RuntimeException e) {
+          Throwable cause = e.getCause();
+          if (cause instanceof AccumuloSecurityException) {
+            AccumuloSecurityException ase = (AccumuloSecurityException) cause;
+            switch (ase.getSecurityErrorCode()) {
+              case PERMISSION_DENIED:
+                // We tried to read the replication table before the GRANT went through
+                Thread.sleep(2000);
+                break;
+              default:
+                throw e;
+            }
           }
         }
       }
+      Assert.fail("We had a file that was referenced but didn't get closed");
     }
-
-    Assert.fail("We had a file that was referenced but didn't get closed");
   }
 
   @Test
@@ -838,107 +846,114 @@ public void singleTableWithSingleTarget() throws Exception {
     conn.tableOperations().flush(table1, null, null, true);
 
     // Make sure that we have one status element, should be a new file
-    Scanner s = ReplicationTable.getScanner(conn);
-    StatusSection.limit(s);
-    Entry<Key,Value> entry = null;
-    Status expectedStatus = StatusUtil.openWithUnknownLength();
-    attempts = 10;
-    // This record will move from new to new with infinite length because of the minc (flush)
-    while (null == entry && attempts > 0) {
-      try {
-        entry = Iterables.getOnlyElement(s);
-        Status actual = Status.parseFrom(entry.getValue().get());
-        if (actual.getInfiniteEnd() != expectedStatus.getInfiniteEnd()) {
+    try (Scanner s = ReplicationTable.getScanner(conn)) {
+      StatusSection.limit(s);
+      Entry<Key,Value> entry = null;
+      Status expectedStatus = StatusUtil.openWithUnknownLength();
+      attempts = 10;
+      // This record will move from new to new with infinite length because of the minc (flush)
+      while (null == entry && attempts > 0) {
+        try {
+          entry = Iterables.getOnlyElement(s);
+          Status actual = Status.parseFrom(entry.getValue().get());
+          if (actual.getInfiniteEnd() != expectedStatus.getInfiniteEnd()) {
+            entry = null;
+            // the master process didn't yet fire and write the new mutation, wait for it to do
+            // so and try to read it again
+            Thread.sleep(1000);
+          }
+        } catch (NoSuchElementException e) {
           entry = null;
-          // the master process didn't yet fire and write the new mutation, wait for it to do
-          // so and try to read it again
-          Thread.sleep(1000);
-        }
-      } catch (NoSuchElementException e) {
-        entry = null;
-        Thread.sleep(500);
-      } catch (IllegalArgumentException e) {
-        // saw this contain 2 elements once
-        s = ReplicationTable.getScanner(conn);
-        StatusSection.limit(s);
-        for (Entry<Key,Value> content : s) {
-          log.info("{} => {}", content.getKey().toStringNoTruncate(), content.getValue());
+          Thread.sleep(500);
+        } catch (IllegalArgumentException e) {
+          // saw this contain 2 elements once
+          try (Scanner s2 = ReplicationTable.getScanner(conn)) {
+            StatusSection.limit(s2);
+            for (Entry<Key,Value> content : s2) {
+              log.info("{} => {}", content.getKey().toStringNoTruncate(), content.getValue());
+            }
+            throw e;
+          }
+        } finally {
+          attempts--;
         }
-        throw e;
-      } finally {
-        attempts--;
       }
-    }
-
-    Assert.assertNotNull("Could not find expected entry in replication table", entry);
-    Status actual = Status.parseFrom(entry.getValue().get());
-    Assert.assertTrue("Expected to find a replication entry that is open with infinite length: " + ProtobufUtil.toString(actual),
-        !actual.getClosed() && actual.getInfiniteEnd());
 
-    // Try a couple of times to watch for the work record to be created
-    boolean notFound = true;
-    for (int i = 0; i < 10 && notFound; i++) {
-      s = ReplicationTable.getScanner(conn);
-      WorkSection.limit(s);
-      int elementsFound = Iterables.size(s);
-      if (0 < elementsFound) {
-        Assert.assertEquals(1, elementsFound);
-        notFound = false;
+      Assert.assertNotNull("Could not find expected entry in replication table", entry);
+      Status actual = Status.parseFrom(entry.getValue().get());
+      Assert.assertTrue("Expected to find a replication entry that is open with infinite length: " + ProtobufUtil.toString(actual), !actual.getClosed()
+          && actual.getInfiniteEnd());
+
+      // Try a couple of times to watch for the work record to be created
+      boolean notFound = true;
+      for (int i = 0; i < 10 && notFound; i++) {
+        try (Scanner s2 = ReplicationTable.getScanner(conn)) {
+          WorkSection.limit(s2);
+          int elementsFound = Iterables.size(s2);
+          if (0 < elementsFound) {
+            Assert.assertEquals(1, elementsFound);
+            notFound = false;
+          }
+          Thread.sleep(500);
+        }
       }
-      Thread.sleep(500);
-    }
 
-    // If we didn't find the work record, print the contents of the table
-    if (notFound) {
-      s = ReplicationTable.getScanner(conn);
-      for (Entry<Key,Value> content : s) {
-        log.info("{} => {}", content.getKey().toStringNoTruncate(), content.getValue());
+      // If we didn't find the work record, print the contents of the table
+      if (notFound) {
+        try (Scanner s2 = ReplicationTable.getScanner(conn)) {
+          for (Entry<Key,Value> content : s2) {
+            log.info("{} => {}", content.getKey().toStringNoTruncate(), content.getValue());
+          }
+          Assert.assertFalse("Did not find the work entry for the status entry", notFound);
+        }
       }
-      Assert.assertFalse("Did not find the work entry for the status entry", notFound);
-    }
 
-    // Write some more data so that we over-run the single WAL
-    writeSomeData(conn, table1, 3000, 50);
+      // Write some more data so that we over-run the single WAL
+      writeSomeData(conn, table1, 3000, 50);
 
-    log.info("Issued compaction for table");
-    conn.tableOperations().compact(table1, null, null, true, true);
-    log.info("Compaction completed");
+      log.info("Issued compaction for table");
+      conn.tableOperations().compact(table1, null, null, true, true);
+      log.info("Compaction completed");
 
-    // Master is creating entries in the replication table from the metadata table every second.
-    // Compaction should trigger the record to be written to metadata. Wait a bit to ensure
-    // that the master has time to work.
-    Thread.sleep(5000);
+      // Master is creating entries in the replication table from the metadata table every second.
+      // Compaction should trigger the record to be written to metadata. Wait a bit to ensure
+      // that the master has time to work.
+      Thread.sleep(5000);
 
-    s = ReplicationTable.getScanner(conn);
-    StatusSection.limit(s);
-    int numRecords = 0;
-    for (Entry<Key,Value> e : s) {
-      numRecords++;
-      log.info("Found status record {}\t{}", e.getKey().toStringNoTruncate(), ProtobufUtil.toString(Status.parseFrom(e.getValue().get())));
-    }
+      try (Scanner s2 = ReplicationTable.getScanner(conn)) {
+        StatusSection.limit(s2);
+        int numRecords = 0;
+        for (Entry<Key,Value> e : s2) {
+          numRecords++;
+          log.info("Found status record {}\t{}", e.getKey().toStringNoTruncate(), ProtobufUtil.toString(Status.parseFrom(e.getValue().get())));
+        }
 
-    Assert.assertEquals(2, numRecords);
+        Assert.assertEquals(2, numRecords);
+      }
 
-    // We should eventually get 2 work records recorded, need to account for a potential delay though
-    // might see: status1 -> work1 -> status2 -> (our scans) -> work2
-    notFound = true;
-    for (int i = 0; i < 10 && notFound; i++) {
-      s = ReplicationTable.getScanner(conn);
-      WorkSection.limit(s);
-      int elementsFound = Iterables.size(s);
-      if (2 == elementsFound) {
-        notFound = false;
+      // We should eventually get 2 work records recorded, need to account for a potential delay though
+      // might see: status1 -> work1 -> status2 -> (our scans) -> work2
+      notFound = true;
+      for (int i = 0; i < 10 && notFound; i++) {
+        try (Scanner s2 = ReplicationTable.getScanner(conn)) {
+          WorkSection.limit(s2);
+          int elementsFound = Iterables.size(s2);
+          if (2 == elementsFound) {
+            notFound = false;
+          }
+          Thread.sleep(500);
+        }
       }
-      Thread.sleep(500);
-    }
 
-    // If we didn't find the work record, print the contents of the table
-    if (notFound) {
-      s = ReplicationTable.getScanner(conn);
-      for (Entry<Key,Value> content : s) {
-        log.info("{} => {}", content.getKey().toStringNoTruncate(), content.getValue());
+      // If we didn't find the work record, print the contents of the table
+      if (notFound) {
+        try (Scanner s2 = ReplicationTable.getScanner(conn)) {
+          for (Entry<Key,Value> content : s2) {
+            log.info("{} => {}", content.getKey().toStringNoTruncate(), content.getValue());
+          }
+          Assert.assertFalse("Did not find the work entries for the status entries", notFound);
+        }
       }
-      Assert.assertFalse("Did not find the work entries for the status entries", notFound);
     }
   }
 
@@ -990,32 +1005,33 @@ public void correctClusterNameInWorkEntry() throws Exception {
     Assert.assertTrue(conn.securityOperations().hasTablePermission("root", ReplicationTable.NAME, TablePermission.READ));
 
     boolean notFound = true;
-    Scanner s;
     for (int i = 0; i < 10 && notFound; i++) {
-      s = ReplicationTable.getScanner(conn);
-      WorkSection.limit(s);
-      try {
-        Entry<Key,Value> e = Iterables.getOnlyElement(s);
-        Text expectedColqual = new ReplicationTarget("cluster1", "4", tableId).toText();
-        Assert.assertEquals(expectedColqual, e.getKey().getColumnQualifier());
-        notFound = false;
-      } catch (NoSuchElementException e) {} catch (IllegalArgumentException e) {
-        s = ReplicationTable.getScanner(conn);
-        for (Entry<Key,Value> content : s) {
-          log.info("{} => {}", content.getKey().toStringNoTruncate(), content.getValue());
+      try (Scanner s = ReplicationTable.getScanner(conn)) {
+        WorkSection.limit(s);
+        try {
+          Entry<Key,Value> e = Iterables.getOnlyElement(s);
+          Text expectedColqual = new ReplicationTarget("cluster1", "4", tableId).toText();
+          Assert.assertEquals(expectedColqual, e.getKey().getColumnQualifier());
+          notFound = false;
+        } catch (NoSuchElementException e) {} catch (IllegalArgumentException e) {
+          try (Scanner s2 = ReplicationTable.getScanner(conn)) {
+            for (Entry<Key,Value> content : s2) {
+              log.info("{} => {}", content.getKey().toStringNoTruncate(), content.getValue());
+            }
+            Assert.fail("Found more than one work section entry");
+          }
         }
-        Assert.fail("Found more than one work section entry");
+        Thread.sleep(500);
       }
-
-      Thread.sleep(500);
     }
 
     if (notFound) {
-      s = ReplicationTable.getScanner(conn);
-      for (Entry<Key,Value> content : s) {
-        log.info("{} => {}", content.getKey().toStringNoTruncate(), content.getValue());
+      try (Scanner s = ReplicationTable.getScanner(conn)) {
+        for (Entry<Key,Value> content : s) {
+          log.info("{} => {}", content.getKey().toStringNoTruncate(), content.getValue());
+        }
+        Assert.assertFalse("Did not find the work entry for the status entry", notFound);
       }
-      Assert.assertFalse("Did not find the work entry for the status entry", notFound);
     }
   }
 
@@ -1110,72 +1126,74 @@ public void run() {
       // We should either find all closed records or no records
       // After they're closed, they are candidates for deletion
       for (int i = 0; i < 10; i++) {
-        Scanner s = conn.createScanner(MetadataTable.NAME, Authorizations.EMPTY);
-        s.setRange(Range.prefix(ReplicationSection.getRowPrefix()));
-        Iterator<Entry<Key,Value>> iter = s.iterator();
-
-        long recordsFound = 0l;
-        while (allClosed && iter.hasNext()) {
-          Entry<Key,Value> entry = iter.next();
-          String wal = entry.getKey().getRow().toString();
-          if (metadataWals.contains(wal)) {
-            Status status = Status.parseFrom(entry.getValue().get());
-            log.info("{}={}", entry.getKey().toStringNoTruncate(), ProtobufUtil.toString(status));
-            allClosed &= status.getClosed();
-            recordsFound++;
+        try (Scanner s = conn.createScanner(MetadataTable.NAME, Authorizations.EMPTY)) {
+          s.setRange(Range.prefix(ReplicationSection.getRowPrefix()));
+          Iterator<Entry<Key,Value>> iter = s.iterator();
+
+          long recordsFound = 0l;
+          while (allClosed && iter.hasNext()) {
+            Entry<Key,Value> entry = iter.next();
+            String wal = entry.getKey().getRow().toString();
+            if (metadataWals.contains(wal)) {
+              Status status = Status.parseFrom(entry.getValue().get());
+              log.info("{}={}", entry.getKey().toStringNoTruncate(), ProtobufUtil.toString(status));
+              allClosed &= status.getClosed();
+              recordsFound++;
+            }
           }
-        }
 
-        log.info("Found {} records from the metadata table", recordsFound);
-        if (allClosed) {
-          break;
+          log.info("Found {} records from the metadata table", recordsFound);
+          if (allClosed) {
+            break;
+          }
+          sleepUninterruptibly(2, TimeUnit.SECONDS);
         }
-
-        sleepUninterruptibly(2, TimeUnit.SECONDS);
       }
 
       if (!allClosed) {
-        Scanner s = conn.createScanner(MetadataTable.NAME, Authorizations.EMPTY);
-        s.setRange(Range.prefix(ReplicationSection.getRowPrefix()));
-        for (Entry<Key,Value> entry : s) {
-          log.info("{} {}", entry.getKey().toStringNoTruncate(), ProtobufUtil.toString(Status.parseFrom(entry.getValue().get())));
+        try (Scanner s = conn.createScanner(MetadataTable.NAME, Authorizations.EMPTY)) {
+          s.setRange(Range.prefix(ReplicationSection.getRowPrefix()));
+          for (Entry<Key,Value> entry : s) {
+            log.info("{} {}", entry.getKey().toStringNoTruncate(), ProtobufUtil.toString(Status.parseFrom(entry.getValue().get())));
+          }
+          Assert.fail("Expected all replication records in the metadata table to be closed");
         }
-        Assert.fail("Expected all replication records in the metadata table to be closed");
       }
 
       for (int i = 0; i < 10; i++) {
         allClosed = true;
 
-        Scanner s = ReplicationTable.getScanner(conn);
-        Iterator<Entry<Key,Value>> iter = s.iterator();
-
-        long recordsFound = 0l;
-        while (allClosed && iter.hasNext()) {
-          Entry<Key,Value> entry = iter.next();
-          String wal = entry.getKey().getRow().toString();
-          if (metadataWals.contains(wal)) {
-            Status status = Status.parseFrom(entry.getValue().get());
-            log.info("{}={}", entry.getKey().toStringNoTruncate(), ProtobufUtil.toString(status));
-            allClosed &= status.getClosed();
-            recordsFound++;
+        try (Scanner s = ReplicationTable.getScanner(conn)) {
+          Iterator<Entry<Key,Value>> iter = s.iterator();
+
+          long recordsFound = 0l;
+          while (allClosed && iter.hasNext()) {
+            Entry<Key,Value> entry = iter.next();
+            String wal = entry.getKey().getRow().toString();
+            if (metadataWals.contains(wal)) {
+              Status status = Status.parseFrom(entry.getValue().get());
+              log.info("{}={}", entry.getKey().toStringNoTruncate(), ProtobufUtil.toString(status));
+              allClosed &= status.getClosed();
+              recordsFound++;
+            }
           }
-        }
 
-        log.info("Found {} records from the replication table", recordsFound);
-        if (allClosed) {
-          break;
+          log.info("Found {} records from the replication table", recordsFound);
+          if (allClosed) {
+            break;
+          }
+          sleepUninterruptibly(3, TimeUnit.SECONDS);
         }
-
-        sleepUninterruptibly(3, TimeUnit.SECONDS);
       }
 
       if (!allClosed) {
-        Scanner s = ReplicationTable.getScanner(conn);
-        StatusSection.limit(s);
-        for (Entry<Key,Value> entry : s) {
-          log.info("{} {}", entry.getKey().toStringNoTruncate(), TextFormat.shortDebugString(Status.parseFrom(entry.getValue().get())));
+        try (Scanner s = ReplicationTable.getScanner(conn)) {
+          StatusSection.limit(s);
+          for (Entry<Key,Value> entry : s) {
+            log.info("{} {}", entry.getKey().toStringNoTruncate(), TextFormat.shortDebugString(Status.parseFrom(entry.getValue().get())));
+          }
+          Assert.fail("Expected all replication records in the replication table to be closed");
         }
-        Assert.fail("Expected all replication records in the replication table to be closed");
       }
 
     } finally {
@@ -1238,21 +1256,21 @@ public void replicatedStatusEntriesAreDeleted() throws Exception {
 
     log.info("Checking for replication entries in replication");
     // Then we need to get those records over to the replication table
-    Scanner s;
     Set<String> entries = new HashSet<>();
     for (int i = 0; i < 5; i++) {
-      s = conn.createScanner(MetadataTable.NAME, Authorizations.EMPTY);
-      s.setRange(ReplicationSection.getRange());
-      entries.clear();
-      for (Entry<Key,Value> entry : s) {
-        entries.add(entry.getKey().getRow().toString());
-        log.info("{}={}", entry.getKey().toStringNoTruncate(), entry.getValue());
-      }
-      if (!entries.isEmpty()) {
-        log.info("Replication entries {}", entries);
-        break;
+      try (Scanner s = conn.createScanner(MetadataTable.NAME, Authorizations.EMPTY)) {
+        s.setRange(ReplicationSection.getRange());
+        entries.clear();
+        for (Entry<Key,Value> entry : s) {
+          entries.add(entry.getKey().getRow().toString());
+          log.info("{}={}", entry.getKey().toStringNoTruncate(), entry.getValue());
+        }
+        if (!entries.isEmpty()) {
+          log.info("Replication entries {}", entries);
+          break;
+        }
+        Thread.sleep(1000);
       }
-      Thread.sleep(1000);
     }
 
     Assert.assertFalse("Did not find any replication entries in the replication table", entries.isEmpty());
@@ -1260,8 +1278,7 @@ public void replicatedStatusEntriesAreDeleted() throws Exception {
     // Find the WorkSection record that will be created for that data we ingested
     boolean notFound = true;
     for (int i = 0; i < 10 && notFound; i++) {
-      try {
-        s = ReplicationTable.getScanner(conn);
+      try (Scanner s = ReplicationTable.getScanner(conn)) {
         WorkSection.limit(s);
         Entry<Key,Value> e = Iterables.getOnlyElement(s);
         log.info("Found entry: {}", e.getKey().toStringNoTruncate());
@@ -1272,11 +1289,12 @@ public void replicatedStatusEntriesAreDeleted() throws Exception {
 
       } catch (IllegalArgumentException e) {
         // Somehow we got more than one element. Log what they were
-        s = ReplicationTable.getScanner(conn);
-        for (Entry<Key,Value> content : s) {
-          log.info("{} => {}", content.getKey().toStringNoTruncate(), content.getValue());
+        try (Scanner s = ReplicationTable.getScanner(conn)) {
+          for (Entry<Key,Value> content : s) {
+            log.info("{} => {}", content.getKey().toStringNoTruncate(), content.getValue());
+          }
+          Assert.fail("Found more than one work section entry");
         }
-        Assert.fail("Found more than one work section entry");
       } catch (RuntimeException e) {
         // Catch a propagation issue, fail if it's not what we expect
         Throwable cause = e.getCause();
@@ -1294,16 +1312,16 @@ public void replicatedStatusEntriesAreDeleted() throws Exception {
           throw e;
         }
       }
-
       Thread.sleep(2000);
     }
 
     if (notFound) {
-      s = ReplicationTable.getScanner(conn);
-      for (Entry<Key,Value> content : s) {
-        log.info("{} => {}", content.getKey().toStringNoTruncate(), ProtobufUtil.toString(Status.parseFrom(content.getValue().get())));
+      try (Scanner s = ReplicationTable.getScanner(conn)) {
+        for (Entry<Key,Value> content : s) {
+          log.info("{} => {}", content.getKey().toStringNoTruncate(), ProtobufUtil.toString(Status.parseFrom(content.getValue().get())));
+        }
+        Assert.assertFalse("Did not find the work entry for the status entry", notFound);
       }
-      Assert.assertFalse("Did not find the work entry for the status entry", notFound);
     }
 
     /**
@@ -1329,9 +1347,10 @@ public void replicatedStatusEntriesAreDeleted() throws Exception {
     }
 
     log.info("Recovered metadata:");
-    s = conn.createScanner(MetadataTable.NAME, Authorizations.EMPTY);
-    for (Entry<Key,Value> entry : s) {
-      log.info("{}={}", entry.getKey().toStringNoTruncate(), entry.getValue());
+    try (Scanner s = conn.createScanner(MetadataTable.NAME, Authorizations.EMPTY)) {
+      for (Entry<Key,Value> entry : s) {
+        log.info("{}={}", entry.getKey().toStringNoTruncate(), entry.getValue());
+      }
     }
 
     cluster.getClusterControl().start(ServerType.GARBAGE_COLLECTOR);
@@ -1342,9 +1361,10 @@ public void replicatedStatusEntriesAreDeleted() throws Exception {
     Thread.sleep(1000);
 
     log.info("After GC");
-    s = conn.createScanner(MetadataTable.NAME, Authorizations.EMPTY);
-    for (Entry<Key,Value> entry : s) {
-      log.info("{}={}", entry.getKey().toStringNoTruncate(), entry.getValue());
+    try (Scanner s = conn.createScanner(MetadataTable.NAME, Authorizations.EMPTY)) {
+      for (Entry<Key,Value> entry : s) {
+        log.info("{}={}", entry.getKey().toStringNoTruncate(), entry.getValue());
+      }
     }
 
     // We expect no records in the metadata table after compaction. We have to poll
@@ -1354,19 +1374,20 @@ public void replicatedStatusEntriesAreDeleted() throws Exception {
     log.info("Checking metadata table for replication entries");
     Set<String> remaining = new HashSet<>();
     for (int i = 0; i < 10; i++) {
-      s = conn.createScanner(MetadataTable.NAME, Authorizations.EMPTY);
-      s.setRange(ReplicationSection.getRange());
-      remaining.clear();
-      for (Entry<Key,Value> e : s) {
-        remaining.add(e.getKey().getRow().toString());
-      }
-      remaining.retainAll(entries);
-      if (remaining.isEmpty()) {
-        break;
+      try (Scanner s = conn.createScanner(MetadataTable.NAME, Authorizations.EMPTY)) {
+        s.setRange(ReplicationSection.getRange());
+        remaining.clear();
+        for (Entry<Key,Value> e : s) {
+          remaining.add(e.getKey().getRow().toString());
+        }
+        remaining.retainAll(entries);
+        if (remaining.isEmpty()) {
+          break;
+        }
+        log.info("remaining {}", remaining);
+        Thread.sleep(2000);
+        log.info("");
       }
-      log.info("remaining {}", remaining);
-      Thread.sleep(2000);
-      log.info("");
     }
 
     Assert.assertTrue("Replication status messages were not cleaned up from metadata table", remaining.isEmpty());
@@ -1378,21 +1399,21 @@ public void replicatedStatusEntriesAreDeleted() throws Exception {
 
     int recordsFound = 0;
     for (int i = 0; i < 30; i++) {
-      s = ReplicationTable.getScanner(conn);
-      recordsFound = 0;
-      for (Entry<Key,Value> entry : s) {
-        recordsFound++;
-        log.info("{} {}", entry.getKey().toStringNoTruncate(), ProtobufUtil.toString(Status.parseFrom(entry.getValue().get())));
-      }
+      try (Scanner s = ReplicationTable.getScanner(conn)) {
+        recordsFound = 0;
+        for (Entry<Key,Value> entry : s) {
+          recordsFound++;
+          log.info("{} {}", entry.getKey().toStringNoTruncate(), ProtobufUtil.toString(Status.parseFrom(entry.getValue().get())));
+        }
 
-      if (recordsFound <= 2) {
-        break;
-      } else {
-        Thread.sleep(1000);
-        log.info("");
+        if (recordsFound <= 2) {
+          break;
+        } else {
+          Thread.sleep(1000);
+          log.info("");
+        }
       }
     }
-
     Assert.assertTrue("Found unexpected replication records in the replication table", recordsFound <= 2);
   }
 }
diff --git a/test/src/main/java/org/apache/accumulo/test/replication/StatusCombinerMacIT.java b/test/src/main/java/org/apache/accumulo/test/replication/StatusCombinerMacIT.java
index 8b8dceb7eb..05ae97ca21 100644
--- a/test/src/main/java/org/apache/accumulo/test/replication/StatusCombinerMacIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/replication/StatusCombinerMacIT.java
@@ -108,23 +108,26 @@ public void test() throws Exception {
       bw.close();
     }
 
-    Scanner s = ReplicationTable.getScanner(conn);
-    Entry<Key,Value> entry = Iterables.getOnlyElement(s);
-    Assert.assertEquals(StatusUtil.fileCreatedValue(createTime), entry.getValue());
-
-    bw = ReplicationTable.getBatchWriter(conn);
-    try {
-      Mutation m = new Mutation("file:/accumulo/wal/HW10447.local+56808/93cdc17e-7521-44fa-87b5-37f45bcb92d3");
-      StatusSection.add(m, Table.ID.of("1"), ProtobufUtil.toValue(StatusUtil.replicated(Long.MAX_VALUE)));
-      bw.addMutation(m);
-    } finally {
-      bw.close();
+    Entry<Key,Value> entry;
+    try (Scanner s = ReplicationTable.getScanner(conn)) {
+      entry = Iterables.getOnlyElement(s);
+      Assert.assertEquals(StatusUtil.fileCreatedValue(createTime), entry.getValue());
+
+      bw = ReplicationTable.getBatchWriter(conn);
+      try {
+        Mutation m = new Mutation("file:/accumulo/wal/HW10447.local+56808/93cdc17e-7521-44fa-87b5-37f45bcb92d3");
+        StatusSection.add(m, Table.ID.of("1"), ProtobufUtil.toValue(StatusUtil.replicated(Long.MAX_VALUE)));
+        bw.addMutation(m);
+      } finally {
+        bw.close();
+      }
     }
 
-    s = ReplicationTable.getScanner(conn);
-    entry = Iterables.getOnlyElement(s);
-    Status stat = Status.parseFrom(entry.getValue().get());
-    Assert.assertEquals(Long.MAX_VALUE, stat.getBegin());
+    try (Scanner s = ReplicationTable.getScanner(conn)) {
+      entry = Iterables.getOnlyElement(s);
+      Status stat = Status.parseFrom(entry.getValue().get());
+      Assert.assertEquals(Long.MAX_VALUE, stat.getBegin());
+    }
   }
 
 }
diff --git a/test/src/main/java/org/apache/accumulo/test/replication/StatusMakerIT.java b/test/src/main/java/org/apache/accumulo/test/replication/StatusMakerIT.java
index ad8d3a9059..ba6b951331 100644
--- a/test/src/main/java/org/apache/accumulo/test/replication/StatusMakerIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/replication/StatusMakerIT.java
@@ -97,18 +97,19 @@ public void statusRecordsCreated() throws Exception {
 
     statusMaker.run();
 
-    Scanner s = ReplicationTable.getScanner(conn);
-    StatusSection.limit(s);
-    Text file = new Text();
-    for (Entry<Key,Value> entry : s) {
-      StatusSection.getFile(entry.getKey(), file);
-      Table.ID tableId = StatusSection.getTableId(entry.getKey());
-
-      Assert.assertTrue("Found unexpected file: " + file, files.contains(file.toString()));
-      Assert.assertEquals(fileToTableId.get(file.toString()), new Integer(tableId.canonicalID()));
-      timeCreated = fileToTimeCreated.get(file.toString());
-      Assert.assertNotNull(timeCreated);
-      Assert.assertEquals(StatusUtil.fileCreated(timeCreated), Status.parseFrom(entry.getValue().get()));
+    try (Scanner s = ReplicationTable.getScanner(conn)) {
+      StatusSection.limit(s);
+      Text file = new Text();
+      for (Entry<Key,Value> entry : s) {
+        StatusSection.getFile(entry.getKey(), file);
+        Table.ID tableId = StatusSection.getTableId(entry.getKey());
+
+        Assert.assertTrue("Found unexpected file: " + file, files.contains(file.toString()));
+        Assert.assertEquals(fileToTableId.get(file.toString()), new Integer(tableId.canonicalID()));
+        timeCreated = fileToTimeCreated.get(file.toString());
+        Assert.assertNotNull(timeCreated);
+        Assert.assertEquals(StatusUtil.fileCreated(timeCreated), Status.parseFrom(entry.getValue().get()));
+      }
     }
   }
 
@@ -142,10 +143,11 @@ public void openMessagesAreNotDeleted() throws Exception {
 
     statusMaker.run();
 
-    Scanner s = conn.createScanner(sourceTable, Authorizations.EMPTY);
-    s.setRange(ReplicationSection.getRange());
-    s.fetchColumnFamily(ReplicationSection.COLF);
-    Assert.assertEquals(files.size(), Iterables.size(s));
+    try (Scanner s = conn.createScanner(sourceTable, Authorizations.EMPTY)) {
+      s.setRange(ReplicationSection.getRange());
+      s.fetchColumnFamily(ReplicationSection.COLF);
+      Assert.assertEquals(files.size(), Iterables.size(s));
+    }
   }
 
   @Test
@@ -178,17 +180,19 @@ public void closedMessagesAreDeleted() throws Exception {
 
     statusMaker.run();
 
-    Scanner s = conn.createScanner(sourceTable, Authorizations.EMPTY);
-    s.setRange(ReplicationSection.getRange());
-    s.fetchColumnFamily(ReplicationSection.COLF);
-    for (Entry<Key,Value> e : s) {
-      System.out.println(e.getKey().toStringNoTruncate() + " " + e.getValue());
+    try (Scanner s = conn.createScanner(sourceTable, Authorizations.EMPTY)) {
+      s.setRange(ReplicationSection.getRange());
+      s.fetchColumnFamily(ReplicationSection.COLF);
+      for (Entry<Key,Value> e : s) {
+        System.out.println(e.getKey().toStringNoTruncate() + " " + e.getValue());
+      }
     }
-    s = conn.createScanner(sourceTable, Authorizations.EMPTY);
-    s.setRange(ReplicationSection.getRange());
-    s.fetchColumnFamily(ReplicationSection.COLF);
-    Assert.assertEquals(0, Iterables.size(s));
 
+    try (Scanner s = conn.createScanner(sourceTable, Authorizations.EMPTY)) {
+      s.setRange(ReplicationSection.getRange());
+      s.fetchColumnFamily(ReplicationSection.COLF);
+      Assert.assertEquals(0, Iterables.size(s));
+    }
   }
 
   @Test
@@ -223,27 +227,30 @@ public void closedMessagesCreateOrderRecords() throws Exception {
 
     statusMaker.run();
 
-    Scanner s = conn.createScanner(sourceTable, Authorizations.EMPTY);
-    s.setRange(ReplicationSection.getRange());
-    s.fetchColumnFamily(ReplicationSection.COLF);
-    Assert.assertEquals(0, Iterables.size(s));
-
-    s = ReplicationTable.getScanner(conn);
-    OrderSection.limit(s);
-    Iterator<Entry<Key,Value>> iter = s.iterator();
-    Assert.assertTrue("Found no order records in replication table", iter.hasNext());
-
-    Iterator<String> expectedFiles = files.iterator();
-    Text buff = new Text();
-    while (expectedFiles.hasNext() && iter.hasNext()) {
-      String file = expectedFiles.next();
-      Entry<Key,Value> entry = iter.next();
-
-      Assert.assertEquals(file, OrderSection.getFile(entry.getKey(), buff));
-      OrderSection.getTableId(entry.getKey(), buff);
-      Assert.assertEquals(fileToTableId.get(file).intValue(), Integer.parseInt(buff.toString()));
+    Iterator<Entry<Key,Value>> iter;
+    Iterator<String> expectedFiles;
+    try (Scanner s = conn.createScanner(sourceTable, Authorizations.EMPTY)) {
+      s.setRange(ReplicationSection.getRange());
+      s.fetchColumnFamily(ReplicationSection.COLF);
+      Assert.assertEquals(0, Iterables.size(s));
     }
 
+    try (Scanner s = ReplicationTable.getScanner(conn)) {
+      OrderSection.limit(s);
+      iter = s.iterator();
+      Assert.assertTrue("Found no order records in replication table", iter.hasNext());
+
+      expectedFiles = files.iterator();
+      Text buff = new Text();
+      while (expectedFiles.hasNext() && iter.hasNext()) {
+        String file = expectedFiles.next();
+        Entry<Key,Value> entry = iter.next();
+
+        Assert.assertEquals(file, OrderSection.getFile(entry.getKey(), buff));
+        OrderSection.getTableId(entry.getKey(), buff);
+        Assert.assertEquals(fileToTableId.get(file).intValue(), Integer.parseInt(buff.toString()));
+      }
+    }
     Assert.assertFalse("Found more files unexpectedly", expectedFiles.hasNext());
     Assert.assertFalse("Found more entries in replication table unexpectedly", iter.hasNext());
   }
diff --git a/test/src/main/java/org/apache/accumulo/test/replication/UnorderedWorkAssignerReplicationIT.java b/test/src/main/java/org/apache/accumulo/test/replication/UnorderedWorkAssignerReplicationIT.java
index 3ee9f936fd..406ed30a0a 100644
--- a/test/src/main/java/org/apache/accumulo/test/replication/UnorderedWorkAssignerReplicationIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/replication/UnorderedWorkAssignerReplicationIT.java
@@ -286,22 +286,23 @@ public Boolean call() throws Exception {
         log.info("{} {}", kv.getKey().toStringNoTruncate(), ProtobufUtil.toString(Status.parseFrom(kv.getValue().get())));
       }
 
-      Scanner master = connMaster.createScanner(masterTable, Authorizations.EMPTY), peer = connPeer.createScanner(peerTable, Authorizations.EMPTY);
-      Iterator<Entry<Key,Value>> masterIter = master.iterator(), peerIter = peer.iterator();
-      Entry<Key,Value> masterEntry = null, peerEntry = null;
-      while (masterIter.hasNext() && peerIter.hasNext()) {
-        masterEntry = masterIter.next();
-        peerEntry = peerIter.next();
-        Assert.assertEquals(masterEntry.getKey() + " was not equal to " + peerEntry.getKey(), 0,
-            masterEntry.getKey().compareTo(peerEntry.getKey(), PartialKey.ROW_COLFAM_COLQUAL_COLVIS));
-        Assert.assertEquals(masterEntry.getValue(), peerEntry.getValue());
-      }
+      try (Scanner master = connMaster.createScanner(masterTable, Authorizations.EMPTY); Scanner peer = connPeer.createScanner(peerTable, Authorizations.EMPTY)) {
+        Iterator<Entry<Key,Value>> masterIter = master.iterator(), peerIter = peer.iterator();
+        Entry<Key,Value> masterEntry = null, peerEntry = null;
+        while (masterIter.hasNext() && peerIter.hasNext()) {
+          masterEntry = masterIter.next();
+          peerEntry = peerIter.next();
+          Assert.assertEquals(masterEntry.getKey() + " was not equal to " + peerEntry.getKey(), 0,
+              masterEntry.getKey().compareTo(peerEntry.getKey(), PartialKey.ROW_COLFAM_COLQUAL_COLVIS));
+          Assert.assertEquals(masterEntry.getValue(), peerEntry.getValue());
+        }
 
-      log.info("Last master entry: {}", masterEntry);
-      log.info("Last peer entry: {}", peerEntry);
+        log.info("Last master entry: {}", masterEntry);
+        log.info("Last peer entry: {}", peerEntry);
 
-      Assert.assertFalse("Had more data to read from the master", masterIter.hasNext());
-      Assert.assertFalse("Had more data to read from the peer", peerIter.hasNext());
+        Assert.assertFalse("Had more data to read from the master", masterIter.hasNext());
+        Assert.assertFalse("Had more data to read from the peer", peerIter.hasNext());
+      }
     } finally {
       peerCluster.stop();
     }
@@ -552,20 +553,20 @@ public void dataWasReplicatedToThePeerWithoutDrain() throws Exception {
 
     connMaster.replicationOperations().drain(masterTable, files);
 
-    Scanner master = connMaster.createScanner(masterTable, Authorizations.EMPTY), peer = connPeer.createScanner(peerTable, Authorizations.EMPTY);
-    Iterator<Entry<Key,Value>> masterIter = master.iterator(), peerIter = peer.iterator();
-    Assert.assertTrue("No data in master table", masterIter.hasNext());
-    Assert.assertTrue("No data in peer table", peerIter.hasNext());
-    while (masterIter.hasNext() && peerIter.hasNext()) {
-      Entry<Key,Value> masterEntry = masterIter.next(), peerEntry = peerIter.next();
-      Assert.assertEquals(peerEntry.getKey() + " was not equal to " + peerEntry.getKey(), 0,
-          masterEntry.getKey().compareTo(peerEntry.getKey(), PartialKey.ROW_COLFAM_COLQUAL_COLVIS));
-      Assert.assertEquals(masterEntry.getValue(), peerEntry.getValue());
-    }
-
-    Assert.assertFalse("Had more data to read from the master", masterIter.hasNext());
-    Assert.assertFalse("Had more data to read from the peer", peerIter.hasNext());
+    try (Scanner master = connMaster.createScanner(masterTable, Authorizations.EMPTY); Scanner peer = connPeer.createScanner(peerTable, Authorizations.EMPTY)) {
+      Iterator<Entry<Key,Value>> masterIter = master.iterator(), peerIter = peer.iterator();
+      Assert.assertTrue("No data in master table", masterIter.hasNext());
+      Assert.assertTrue("No data in peer table", peerIter.hasNext());
+      while (masterIter.hasNext() && peerIter.hasNext()) {
+        Entry<Key,Value> masterEntry = masterIter.next(), peerEntry = peerIter.next();
+        Assert.assertEquals(peerEntry.getKey() + " was not equal to " + peerEntry.getKey(), 0,
+            masterEntry.getKey().compareTo(peerEntry.getKey(), PartialKey.ROW_COLFAM_COLQUAL_COLVIS));
+        Assert.assertEquals(masterEntry.getValue(), peerEntry.getValue());
+      }
 
+      Assert.assertFalse("Had more data to read from the master", masterIter.hasNext());
+      Assert.assertFalse("Had more data to read from the peer", peerIter.hasNext());
+    }
     peerCluster.stop();
   }
 
@@ -678,12 +679,13 @@ public void dataReplicatedToCorrectTableWithoutDrain() throws Exception {
       for (int i = 0; i < 10 && !fullyReplicated; i++) {
         sleepUninterruptibly(timeoutFactor * 2, TimeUnit.SECONDS);
 
-        Scanner s = ReplicationTable.getScanner(connMaster);
-        WorkSection.limit(s);
-        for (Entry<Key,Value> entry : s) {
-          Status status = Status.parseFrom(entry.getValue().get());
-          if (StatusUtil.isFullyReplicated(status)) {
-            fullyReplicated |= true;
+        try (Scanner s = ReplicationTable.getScanner(connMaster)) {
+          WorkSection.limit(s);
+          for (Entry<Key,Value> entry : s) {
+            Status status = Status.parseFrom(entry.getValue().get());
+            if (StatusUtil.isFullyReplicated(status)) {
+              fullyReplicated |= true;
+            }
           }
         }
       }
diff --git a/test/src/main/java/org/apache/accumulo/test/replication/UnusedWalDoesntCloseReplicationStatusIT.java b/test/src/main/java/org/apache/accumulo/test/replication/UnusedWalDoesntCloseReplicationStatusIT.java
index 63961bd600..46a7a4109f 100644
--- a/test/src/main/java/org/apache/accumulo/test/replication/UnusedWalDoesntCloseReplicationStatusIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/replication/UnusedWalDoesntCloseReplicationStatusIT.java
@@ -152,69 +152,76 @@ public void test() throws Exception {
 
     log.info("State of metadata table after inserting a record");
 
-    Scanner s = conn.createScanner(MetadataTable.NAME, Authorizations.EMPTY);
-    s.setRange(MetadataSchema.TabletsSection.getRange(tableId));
-    for (Entry<Key,Value> entry : s) {
-      System.out.println(entry.getKey().toStringNoTruncate() + " " + entry.getValue());
-    }
+    try (Scanner s = conn.createScanner(MetadataTable.NAME, Authorizations.EMPTY)) {
 
-    s = conn.createScanner(MetadataTable.NAME, Authorizations.EMPTY);
-    s.setRange(MetadataSchema.ReplicationSection.getRange());
-    for (Entry<Key,Value> entry : s) {
-      System.out.println(entry.getKey().toStringNoTruncate() + " " + ProtobufUtil.toString(Status.parseFrom(entry.getValue().get())));
+      s.setRange(MetadataSchema.TabletsSection.getRange(tableId));
+      for (Entry<Key,Value> entry : s) {
+        System.out.println(entry.getKey().toStringNoTruncate() + " " + entry.getValue());
+      }
     }
 
-    log.info("Offline'ing table");
+    try (Scanner s = conn.createScanner(MetadataTable.NAME, Authorizations.EMPTY)) {
+      s.setRange(MetadataSchema.ReplicationSection.getRange());
+      for (Entry<Key,Value> entry : s) {
+        System.out.println(entry.getKey().toStringNoTruncate() + " " + ProtobufUtil.toString(Status.parseFrom(entry.getValue().get())));
+      }
 
-    conn.tableOperations().offline(tableName, true);
+      log.info("Offline'ing table");
 
-    // Add our fake WAL to the log column for this table
-    String walUri = tserverWal.toURI().toString();
-    KeyExtent extent = new KeyExtent(tableId, null, null);
-    bw = conn.createBatchWriter(MetadataTable.NAME, new BatchWriterConfig());
-    m = new Mutation(extent.getMetadataEntry());
-    m.put(MetadataSchema.TabletsSection.LogColumnFamily.NAME, new Text("localhost:12345/" + walUri), new Value((walUri + "|1").getBytes(UTF_8)));
-    bw.addMutation(m);
+      conn.tableOperations().offline(tableName, true);
 
-    // Add a replication entry for our fake WAL
-    m = new Mutation(MetadataSchema.ReplicationSection.getRowPrefix() + new Path(walUri).toString());
-    m.put(MetadataSchema.ReplicationSection.COLF, new Text(tableId.getUtf8()), new Value(StatusUtil.fileCreated(System.currentTimeMillis()).toByteArray()));
-    bw.addMutation(m);
-    bw.close();
+      // Add our fake WAL to the log column for this table
+      String walUri = tserverWal.toURI().toString();
+      KeyExtent extent = new KeyExtent(tableId, null, null);
+      bw = conn.createBatchWriter(MetadataTable.NAME, new BatchWriterConfig());
+      m = new Mutation(extent.getMetadataEntry());
+      m.put(MetadataSchema.TabletsSection.LogColumnFamily.NAME, new Text("localhost:12345/" + walUri), new Value((walUri + "|1").getBytes(UTF_8)));
+      bw.addMutation(m);
 
-    log.info("State of metadata after injecting WAL manually");
+      // Add a replication entry for our fake WAL
+      m = new Mutation(MetadataSchema.ReplicationSection.getRowPrefix() + new Path(walUri).toString());
+      m.put(MetadataSchema.ReplicationSection.COLF, new Text(tableId.getUtf8()), new Value(StatusUtil.fileCreated(System.currentTimeMillis()).toByteArray()));
+      bw.addMutation(m);
+      bw.close();
 
-    s = conn.createScanner(MetadataTable.NAME, Authorizations.EMPTY);
-    s.setRange(MetadataSchema.TabletsSection.getRange(tableId));
-    for (Entry<Key,Value> entry : s) {
-      log.info("{} {}", entry.getKey().toStringNoTruncate(), entry.getValue());
+      log.info("State of metadata after injecting WAL manually");
     }
 
-    s = conn.createScanner(MetadataTable.NAME, Authorizations.EMPTY);
-    s.setRange(MetadataSchema.ReplicationSection.getRange());
-    for (Entry<Key,Value> entry : s) {
-      log.info("{} {}", entry.getKey().toStringNoTruncate(), ProtobufUtil.toString(Status.parseFrom(entry.getValue().get())));
+    try (Scanner s = conn.createScanner(MetadataTable.NAME, Authorizations.EMPTY)) {
+      s.setRange(MetadataSchema.TabletsSection.getRange(tableId));
+      for (Entry<Key,Value> entry : s) {
+        log.info("{} {}", entry.getKey().toStringNoTruncate(), entry.getValue());
+      }
     }
 
-    log.info("Bringing table online");
-    conn.tableOperations().online(tableName, true);
+    try (Scanner s = conn.createScanner(MetadataTable.NAME, Authorizations.EMPTY)) {
+      s.setRange(MetadataSchema.ReplicationSection.getRange());
+      for (Entry<Key,Value> entry : s) {
+        log.info("{} {}", entry.getKey().toStringNoTruncate(), ProtobufUtil.toString(Status.parseFrom(entry.getValue().get())));
+      }
+
+      log.info("Bringing table online");
+      conn.tableOperations().online(tableName, true);
 
-    Assert.assertEquals(1, Iterables.size(conn.createScanner(tableName, Authorizations.EMPTY)));
+      Assert.assertEquals(1, Iterables.size(conn.createScanner(tableName, Authorizations.EMPTY)));
 
-    log.info("Table has performed recovery, state of metadata:");
+      log.info("Table has performed recovery, state of metadata:");
+    }
 
-    s = conn.createScanner(MetadataTable.NAME, Authorizations.EMPTY);
-    s.setRange(MetadataSchema.TabletsSection.getRange(tableId));
-    for (Entry<Key,Value> entry : s) {
-      log.info("{} {}", entry.getKey().toStringNoTruncate(), entry.getValue());
+    try (Scanner s = conn.createScanner(MetadataTable.NAME, Authorizations.EMPTY)) {
+      s.setRange(MetadataSchema.TabletsSection.getRange(tableId));
+      for (Entry<Key,Value> entry : s) {
+        log.info("{} {}", entry.getKey().toStringNoTruncate(), entry.getValue());
+      }
     }
 
-    s = conn.createScanner(MetadataTable.NAME, Authorizations.EMPTY);
-    s.setRange(MetadataSchema.ReplicationSection.getRange());
-    for (Entry<Key,Value> entry : s) {
-      Status status = Status.parseFrom(entry.getValue().get());
-      log.info("{} {}", entry.getKey().toStringNoTruncate(), ProtobufUtil.toString(status));
-      Assert.assertFalse("Status record was closed and it should not be", status.getClosed());
+    try (Scanner s = conn.createScanner(MetadataTable.NAME, Authorizations.EMPTY)) {
+      s.setRange(MetadataSchema.ReplicationSection.getRange());
+      for (Entry<Key,Value> entry : s) {
+        Status status = Status.parseFrom(entry.getValue().get());
+        log.info("{} {}", entry.getKey().toStringNoTruncate(), ProtobufUtil.toString(status));
+        Assert.assertFalse("Status record was closed and it should not be", status.getClosed());
+      }
     }
   }
 }
diff --git a/test/src/main/java/org/apache/accumulo/test/replication/WorkMakerIT.java b/test/src/main/java/org/apache/accumulo/test/replication/WorkMakerIT.java
index da9ebb2e67..b2eb777978 100644
--- a/test/src/main/java/org/apache/accumulo/test/replication/WorkMakerIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/replication/WorkMakerIT.java
@@ -98,29 +98,32 @@ public void singleUnitSingleTarget() throws Exception {
     bw.flush();
 
     // Assert that we have one record in the status section
-    Scanner s = ReplicationTable.getScanner(conn);
-    StatusSection.limit(s);
-    Assert.assertEquals(1, Iterables.size(s));
+    ReplicationTarget expected;
+    try (Scanner s = ReplicationTable.getScanner(conn)) {
+      StatusSection.limit(s);
+      Assert.assertEquals(1, Iterables.size(s));
 
-    MockWorkMaker workMaker = new MockWorkMaker(conn);
+      MockWorkMaker workMaker = new MockWorkMaker(conn);
 
-    // Invoke the addWorkRecord method to create a Work record from the Status record earlier
-    ReplicationTarget expected = new ReplicationTarget("remote_cluster_1", "4", tableId);
-    workMaker.setBatchWriter(bw);
-    workMaker.addWorkRecord(new Text(file), StatusUtil.fileCreatedValue(timeCreated), ImmutableMap.of("remote_cluster_1", "4"), tableId);
+      // Invoke the addWorkRecord method to create a Work record from the Status record earlier
+      expected = new ReplicationTarget("remote_cluster_1", "4", tableId);
+      workMaker.setBatchWriter(bw);
+      workMaker.addWorkRecord(new Text(file), StatusUtil.fileCreatedValue(timeCreated), ImmutableMap.of("remote_cluster_1", "4"), tableId);
+    }
 
     // Scan over just the WorkSection
-    s = ReplicationTable.getScanner(conn);
-    WorkSection.limit(s);
+    try (Scanner s = ReplicationTable.getScanner(conn)) {
+      WorkSection.limit(s);
 
-    Entry<Key,Value> workEntry = Iterables.getOnlyElement(s);
-    Key workKey = workEntry.getKey();
-    ReplicationTarget actual = ReplicationTarget.from(workKey.getColumnQualifier());
+      Entry<Key,Value> workEntry = Iterables.getOnlyElement(s);
+      Key workKey = workEntry.getKey();
+      ReplicationTarget actual = ReplicationTarget.from(workKey.getColumnQualifier());
 
-    Assert.assertEquals(file, workKey.getRow().toString());
-    Assert.assertEquals(WorkSection.NAME, workKey.getColumnFamily());
-    Assert.assertEquals(expected, actual);
-    Assert.assertEquals(workEntry.getValue(), StatusUtil.fileCreatedValue(timeCreated));
+      Assert.assertEquals(file, workKey.getRow().toString());
+      Assert.assertEquals(WorkSection.NAME, workKey.getColumnFamily());
+      Assert.assertEquals(expected, actual);
+      Assert.assertEquals(workEntry.getValue(), StatusUtil.fileCreatedValue(timeCreated));
+    }
   }
 
   @Test
@@ -139,38 +142,41 @@ public void singleUnitMultipleTargets() throws Exception {
     bw.flush();
 
     // Assert that we have one record in the status section
-    Scanner s = ReplicationTable.getScanner(conn);
-    StatusSection.limit(s);
-    Assert.assertEquals(1, Iterables.size(s));
+    Set<ReplicationTarget> expectedTargets = new HashSet<>();
+    try (Scanner s = ReplicationTable.getScanner(conn)) {
+      StatusSection.limit(s);
+      Assert.assertEquals(1, Iterables.size(s));
 
-    MockWorkMaker workMaker = new MockWorkMaker(conn);
+      MockWorkMaker workMaker = new MockWorkMaker(conn);
 
-    Map<String,String> targetClusters = ImmutableMap.of("remote_cluster_1", "4", "remote_cluster_2", "6", "remote_cluster_3", "8");
-    Set<ReplicationTarget> expectedTargets = new HashSet<>();
-    for (Entry<String,String> cluster : targetClusters.entrySet()) {
-      expectedTargets.add(new ReplicationTarget(cluster.getKey(), cluster.getValue(), tableId));
+      Map<String,String> targetClusters = ImmutableMap.of("remote_cluster_1", "4", "remote_cluster_2", "6", "remote_cluster_3", "8");
+
+      for (Entry<String,String> cluster : targetClusters.entrySet()) {
+        expectedTargets.add(new ReplicationTarget(cluster.getKey(), cluster.getValue(), tableId));
+      }
+      workMaker.setBatchWriter(bw);
+      workMaker.addWorkRecord(new Text(file), StatusUtil.fileCreatedValue(System.currentTimeMillis()), targetClusters, tableId);
     }
-    workMaker.setBatchWriter(bw);
-    workMaker.addWorkRecord(new Text(file), StatusUtil.fileCreatedValue(System.currentTimeMillis()), targetClusters, tableId);
 
-    s = ReplicationTable.getScanner(conn);
-    WorkSection.limit(s);
+    try (Scanner s = ReplicationTable.getScanner(conn)) {
+      WorkSection.limit(s);
 
-    Set<ReplicationTarget> actualTargets = new HashSet<>();
-    for (Entry<Key,Value> entry : s) {
-      Assert.assertEquals(file, entry.getKey().getRow().toString());
-      Assert.assertEquals(WorkSection.NAME, entry.getKey().getColumnFamily());
+      Set<ReplicationTarget> actualTargets = new HashSet<>();
+      for (Entry<Key,Value> entry : s) {
+        Assert.assertEquals(file, entry.getKey().getRow().toString());
+        Assert.assertEquals(WorkSection.NAME, entry.getKey().getColumnFamily());
 
-      ReplicationTarget target = ReplicationTarget.from(entry.getKey().getColumnQualifier());
-      actualTargets.add(target);
-    }
+        ReplicationTarget target = ReplicationTarget.from(entry.getKey().getColumnQualifier());
+        actualTargets.add(target);
+      }
 
-    for (ReplicationTarget expected : expectedTargets) {
-      Assert.assertTrue("Did not find expected target: " + expected, actualTargets.contains(expected));
-      actualTargets.remove(expected);
-    }
+      for (ReplicationTarget expected : expectedTargets) {
+        Assert.assertTrue("Did not find expected target: " + expected, actualTargets.contains(expected));
+        actualTargets.remove(expected);
+      }
 
-    Assert.assertTrue("Found extra replication work entries: " + actualTargets, actualTargets.isEmpty());
+      Assert.assertTrue("Found extra replication work entries: " + actualTargets, actualTargets.isEmpty());
+    }
   }
 
   @Test
@@ -187,24 +193,26 @@ public void dontCreateWorkForEntriesWithNothingToReplicate() throws Exception {
     bw.flush();
 
     // Assert that we have one record in the status section
-    Scanner s = ReplicationTable.getScanner(conn);
-    StatusSection.limit(s);
-    Assert.assertEquals(1, Iterables.size(s));
+    try (Scanner s = ReplicationTable.getScanner(conn)) {
+      StatusSection.limit(s);
+      Assert.assertEquals(1, Iterables.size(s));
 
-    MockWorkMaker workMaker = new MockWorkMaker(conn);
+      MockWorkMaker workMaker = new MockWorkMaker(conn);
 
-    conn.tableOperations().setProperty(ReplicationTable.NAME, Property.TABLE_REPLICATION_TARGET.getKey() + "remote_cluster_1", "4");
+      conn.tableOperations().setProperty(ReplicationTable.NAME, Property.TABLE_REPLICATION_TARGET.getKey() + "remote_cluster_1", "4");
 
-    workMaker.setBatchWriter(bw);
+      workMaker.setBatchWriter(bw);
 
-    // If we don't shortcircuit out, we should get an exception because ServerConfiguration.getTableConfiguration
-    // won't work with MockAccumulo
-    workMaker.run();
+      // If we don't shortcircuit out, we should get an exception because ServerConfiguration.getTableConfiguration
+      // won't work with MockAccumulo
+      workMaker.run();
+    }
 
-    s = ReplicationTable.getScanner(conn);
-    WorkSection.limit(s);
+    try (Scanner s = ReplicationTable.getScanner(conn)) {
+      WorkSection.limit(s);
 
-    Assert.assertEquals(0, Iterables.size(s));
+      Assert.assertEquals(0, Iterables.size(s));
+    }
   }
 
 }
diff --git a/test/src/main/java/org/apache/accumulo/test/server/security/SystemCredentialsIT.java b/test/src/main/java/org/apache/accumulo/test/server/security/SystemCredentialsIT.java
index 20f73906ec..ae1564a0b9 100644
--- a/test/src/main/java/org/apache/accumulo/test/server/security/SystemCredentialsIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/server/security/SystemCredentialsIT.java
@@ -191,8 +191,7 @@ public Connector getConnector(String user, byte[] pass) throws AccumuloException
       System.exit(BAD_PASSWD_FAIL_CODE);
       return;
     }
-    try {
-      Scanner scan = conn.createScanner(RootTable.NAME, Authorizations.EMPTY);
+    try (Scanner scan = conn.createScanner(RootTable.NAME, Authorizations.EMPTY)) {
       for (Entry<Key,Value> e : scan) {
         e.hashCode();
       }


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services