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/10/30 19:40:32 UTC

[GitHub] keith-turner closed pull request #718: Made AccumuloClient Closeable

keith-turner closed pull request #718: Made AccumuloClient Closeable
URL: https://github.com/apache/accumulo/pull/718
 
 
   

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/core/src/main/java/org/apache/accumulo/core/client/Accumulo.java b/core/src/main/java/org/apache/accumulo/core/client/Accumulo.java
index 645bd02232..b1bd13cd62 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/Accumulo.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/Accumulo.java
@@ -51,11 +51,12 @@ private Accumulo() {}
    *
    * <pre>
    * <code>
-   *    AccumuloClient client = Accumulo.newClient()
-   *      .forInstance(instanceName, zookeepers)
-   *      .usingPassword(user, password)
-   *      .withZkTimeout(1234)
-   *      .build();
+   * try (AccumuloClient client = Accumulo.newClient()
+   *        .forInstance(instanceName, zookeepers)
+   *        .usingPassword(user, password).build())
+   * {
+   *   // use the client
+   * }
    * </code>
    * </pre>
    *
diff --git a/core/src/main/java/org/apache/accumulo/core/client/AccumuloClient.java b/core/src/main/java/org/apache/accumulo/core/client/AccumuloClient.java
index 883cc2fc32..e7f6a4bd4c 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/AccumuloClient.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/AccumuloClient.java
@@ -31,15 +31,33 @@
  * writer for the instance as well as various objects that permit administrative operations.
  * Enforces security on the client side with by requiring user credentials.
  *
+ * <p>
  * Supports fluent API for creation. Various options can be provided to {@link Accumulo#newClient()}
  * and when finished a call to build() will return the AccumuloClient object. For example:
  *
- * {@code Accumulo.newClient().forInstance(instanceName, zookeepers)
- *         .usingPassword(user, password).withZkTimeout(1234).build();}
+ * <p>
+ *
+ * <pre>
+ * <code>
+ * try (AccumuloClient client = Accumulo.newClient()
+ *        .forInstance(instanceName, zookeepers)
+ *        .usingPassword(user, password).build())
+ * {
+ *   // use the client
+ * }
+ * </code>
+ * </pre>
+ *
+ * <p>
+ * If migrating code from Connector to AccumuloClient an important difference to consider is that
+ * AccumuloClient is closable and Connector is not. Connector uses static resources and therefore
+ * creating them is cheap. AccumuloClient attempts to clean up resources on close, so constantly
+ * creating them could perform worse than Connector. Therefore, it would be better to create an
+ * AccumuloClient and pass it around.
  *
  * @since 2.0.0
  */
-public interface AccumuloClient {
+public interface AccumuloClient extends AutoCloseable {
 
   /**
    * Factory method to create a BatchScanner connected to Accumulo.
@@ -276,6 +294,14 @@ ConditionalWriter createConditionalWriter(String tableName, ConditionalWriterCon
   AccumuloClient changeUser(String principal, AuthenticationToken token)
       throws AccumuloSecurityException, AccumuloException;
 
+  /**
+   * Cleans up any resources created by an AccumuloClient like threads and sockets. Anything created
+   * from this client will likely not work after calling this method. For example a Scanner created
+   * using this client will likely fail after close is called.
+   */
+  @Override
+  public void close();
+
   /**
    * Builds ClientInfo after all options have been specified
    */
diff --git a/core/src/main/java/org/apache/accumulo/core/client/Connector.java b/core/src/main/java/org/apache/accumulo/core/client/Connector.java
index 42d61ac91e..f4c370f793 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/Connector.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/Connector.java
@@ -272,7 +272,9 @@ public abstract ConditionalWriter createConditionalWriter(String tableName,
   public abstract ReplicationOperations replicationOperations();
 
   /**
-   * Creates a Connector from an AccumuloClient.
+   * Creates a Connector from an AccumuloClient. This Connector will no longer work after the
+   * AccumuloClient is closed. Also anything derived from the Connector (like a Scanner for example)
+   * is unlikely to work after the AccumuloClient is closed.
    *
    * @since 2.0
    */
diff --git a/core/src/main/java/org/apache/accumulo/core/client/ZooKeeperInstance.java b/core/src/main/java/org/apache/accumulo/core/client/ZooKeeperInstance.java
index 3799138635..70cb45c592 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/ZooKeeperInstance.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/ZooKeeperInstance.java
@@ -36,6 +36,9 @@
 import org.apache.accumulo.core.conf.ClientProperty;
 import org.apache.accumulo.core.conf.ConfigurationTypeHelper;
 import org.apache.accumulo.core.metadata.RootTable;
+import org.apache.accumulo.core.singletons.SingletonManager;
+import org.apache.accumulo.core.singletons.SingletonManager.Mode;
+import org.apache.accumulo.core.singletons.SingletonReservation;
 import org.apache.accumulo.core.util.OpTimer;
 import org.apache.accumulo.fate.zookeeper.ZooCache;
 import org.apache.accumulo.fate.zookeeper.ZooCacheFactory;
@@ -90,6 +93,8 @@ public ZooKeeperInstance(String instanceName, String zooKeepers) {
 
   ZooKeeperInstance(ClientConfiguration config, ZooCacheFactory zcf) {
     checkArgument(config != null, "config is null");
+    // Enable singletons before before getting a zoocache
+    SingletonManager.setMode(Mode.CONNECTOR);
     this.clientConf = config;
     this.instanceId = clientConf.get(ClientConfiguration.ClientProperty.INSTANCE_ID);
     this.instanceName = clientConf.get(ClientConfiguration.ClientProperty.INSTANCE_NAME);
@@ -223,8 +228,8 @@ public Connector getConnector(String principal, AuthenticationToken token)
     Properties properties = ClientConfConverter.toProperties(clientConf);
     properties.setProperty(ClientProperty.AUTH_PRINCIPAL.getKey(), principal);
     properties.setProperty(ClientProperty.INSTANCE_NAME.getKey(), getInstanceName());
-    return new ConnectorImpl(
-        new AccumuloClientImpl(new ClientContext(new ClientInfoImpl(properties, token))));
+    return new ConnectorImpl(new AccumuloClientImpl(SingletonReservation.noop(),
+        new ClientContext(new ClientInfoImpl(properties, token))));
   }
 
   @Override
diff --git a/core/src/main/java/org/apache/accumulo/core/client/impl/AccumuloClientImpl.java b/core/src/main/java/org/apache/accumulo/core/client/impl/AccumuloClientImpl.java
index 59849b0ece..8a6ce3e70a 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/impl/AccumuloClientImpl.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/impl/AccumuloClientImpl.java
@@ -47,6 +47,8 @@
 import org.apache.accumulo.core.conf.ClientProperty;
 import org.apache.accumulo.core.master.state.tables.TableState;
 import org.apache.accumulo.core.security.Authorizations;
+import org.apache.accumulo.core.singletons.SingletonManager;
+import org.apache.accumulo.core.singletons.SingletonReservation;
 import org.apache.accumulo.core.trace.Tracer;
 
 public class AccumuloClientImpl implements AccumuloClient {
@@ -59,8 +61,16 @@
   private NamespaceOperations namespaceops = null;
   private InstanceOperations instanceops = null;
   private ReplicationOperations replicationops = null;
+  private final SingletonReservation singletonReservation;
+  private volatile boolean closed = false;
 
-  public AccumuloClientImpl(final ClientContext context)
+  private void ensureOpen() {
+    if (closed) {
+      throw new IllegalStateException("This client was closed.");
+    }
+  }
+
+  public AccumuloClientImpl(SingletonReservation reservation, final ClientContext context)
       throws AccumuloSecurityException, AccumuloException {
     checkArgument(context != null, "Context is null");
     checkArgument(context.getCredentials() != null, "Credentials are null");
@@ -69,6 +79,7 @@ public AccumuloClientImpl(final ClientContext context)
       throw new AccumuloSecurityException(context.getCredentials().getPrincipal(),
           SecurityErrorCode.TOKEN_EXPIRED);
 
+    this.singletonReservation = Objects.requireNonNull(reservation);
     this.context = context;
     instanceID = context.getInstanceID();
 
@@ -99,6 +110,7 @@ public BatchScanner createBatchScanner(String tableName, Authorizations authoriz
       int numQueryThreads) throws TableNotFoundException {
     checkArgument(tableName != null, "tableName is null");
     checkArgument(authorizations != null, "authorizations is null");
+    ensureOpen();
     return new TabletServerBatchReader(context, getTableId(tableName), authorizations,
         numQueryThreads);
   }
@@ -109,6 +121,7 @@ public BatchScanner createBatchScanner(String tableName, Authorizations authoriz
     Integer numQueryThreads = ClientProperty.BATCH_SCANNER_NUM_QUERY_THREADS
         .getInteger(context.getClientInfo().getProperties());
     Objects.requireNonNull(numQueryThreads);
+    ensureOpen();
     return createBatchScanner(tableName, authorizations, numQueryThreads);
   }
 
@@ -117,6 +130,7 @@ public BatchDeleter createBatchDeleter(String tableName, Authorizations authoriz
       int numQueryThreads, BatchWriterConfig config) throws TableNotFoundException {
     checkArgument(tableName != null, "tableName is null");
     checkArgument(authorizations != null, "authorizations is null");
+    ensureOpen();
     return new TabletServerBatchDeleter(context, getTableId(tableName), authorizations,
         numQueryThreads, config.merge(context.getBatchWriterConfig()));
   }
@@ -124,6 +138,7 @@ public BatchDeleter createBatchDeleter(String tableName, Authorizations authoriz
   @Override
   public BatchDeleter createBatchDeleter(String tableName, Authorizations authorizations,
       int numQueryThreads) throws TableNotFoundException {
+    ensureOpen();
     return createBatchDeleter(tableName, authorizations, numQueryThreads, new BatchWriterConfig());
   }
 
@@ -131,6 +146,7 @@ public BatchDeleter createBatchDeleter(String tableName, Authorizations authoriz
   public BatchWriter createBatchWriter(String tableName, BatchWriterConfig config)
       throws TableNotFoundException {
     checkArgument(tableName != null, "tableName is null");
+    ensureOpen();
     // we used to allow null inputs for bw config
     if (config == null) {
       config = new BatchWriterConfig();
@@ -146,6 +162,7 @@ public BatchWriter createBatchWriter(String tableName) throws TableNotFoundExcep
 
   @Override
   public MultiTableBatchWriter createMultiTableBatchWriter(BatchWriterConfig config) {
+    ensureOpen();
     return new MultiTableBatchWriterImpl(context, config.merge(context.getBatchWriterConfig()));
   }
 
@@ -157,6 +174,7 @@ public MultiTableBatchWriter createMultiTableBatchWriter() {
   @Override
   public ConditionalWriter createConditionalWriter(String tableName, ConditionalWriterConfig config)
       throws TableNotFoundException {
+    ensureOpen();
     return new ConditionalWriterImpl(context, getTableId(tableName), config);
   }
 
@@ -165,6 +183,7 @@ public Scanner createScanner(String tableName, Authorizations authorizations)
       throws TableNotFoundException {
     checkArgument(tableName != null, "tableName is null");
     checkArgument(authorizations != null, "authorizations is null");
+    ensureOpen();
     Scanner scanner = new ScannerImpl(context, getTableId(tableName), authorizations);
     Integer batchSize = ClientProperty.SCANNER_BATCH_SIZE
         .getInteger(context.getClientInfo().getProperties());
@@ -176,26 +195,31 @@ public Scanner createScanner(String tableName, Authorizations authorizations)
 
   @Override
   public String whoami() {
+    ensureOpen();
     return context.getCredentials().getPrincipal();
   }
 
   @Override
   public String getInstanceID() {
+    ensureOpen();
     return instanceID;
   }
 
   @Override
   public synchronized TableOperations tableOperations() {
+    ensureOpen();
     return tableops;
   }
 
   @Override
   public synchronized NamespaceOperations namespaceOperations() {
+    ensureOpen();
     return namespaceops;
   }
 
   @Override
   public synchronized SecurityOperations securityOperations() {
+    ensureOpen();
     if (secops == null)
       secops = new SecurityOperationsImpl(context);
 
@@ -204,6 +228,7 @@ public synchronized SecurityOperations securityOperations() {
 
   @Override
   public synchronized InstanceOperations instanceOperations() {
+    ensureOpen();
     if (instanceops == null)
       instanceops = new InstanceOperationsImpl(context);
 
@@ -212,6 +237,7 @@ public synchronized InstanceOperations instanceOperations() {
 
   @Override
   public synchronized ReplicationOperations replicationOperations() {
+    ensureOpen();
     if (null == replicationops) {
       replicationops = new ReplicationOperationsImpl(context);
     }
@@ -221,15 +247,27 @@ public synchronized ReplicationOperations replicationOperations() {
 
   @Override
   public ClientInfo info() {
+    ensureOpen();
     return this.context.getClientInfo();
   }
 
   @Override
   public AccumuloClient changeUser(String principal, AuthenticationToken token)
       throws AccumuloSecurityException, AccumuloException {
+    ensureOpen();
     return Accumulo.newClient().usingClientInfo(info()).usingToken(principal, token).build();
   }
 
+  @Override
+  public void close() {
+    closed = true;
+    try {
+      context.close();
+    } finally {
+      singletonReservation.close();
+    }
+  }
+
   public static class AccumuloClientBuilderImpl
       implements InstanceArgs, PropertyOptions, ClientInfoOptions, AuthenticationArgs,
       ConnectionOptions, SslOptions, SaslOptions, AccumuloClientFactory, FromOptions {
@@ -246,7 +284,13 @@ private ClientInfo getClientInfo() {
 
     @Override
     public AccumuloClient build() throws AccumuloException, AccumuloSecurityException {
-      return org.apache.accumulo.core.client.impl.ClientInfoFactory.getClient(getClientInfo());
+      SingletonReservation reservation = SingletonManager.getClientReservation();
+      try {
+        return new AccumuloClientImpl(reservation, new ClientContext(getClientInfo()));
+      } catch (AccumuloException | AccumuloSecurityException | RuntimeException e) {
+        reservation.close();
+        throw e;
+      }
     }
 
     @Override
diff --git a/core/src/main/java/org/apache/accumulo/core/client/impl/ClientContext.java b/core/src/main/java/org/apache/accumulo/core/client/impl/ClientContext.java
index f82c9b8e0f..cd18f50c2f 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/impl/ClientContext.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/impl/ClientContext.java
@@ -38,6 +38,7 @@
 import org.apache.accumulo.core.rpc.SaslConnectionParams;
 import org.apache.accumulo.core.rpc.SslConnectionParams;
 import org.apache.accumulo.core.security.thrift.TCredentials;
+import org.apache.accumulo.core.singletons.SingletonReservation;
 import org.apache.accumulo.core.util.OpTimer;
 import org.apache.accumulo.fate.zookeeper.ZooCache;
 import org.apache.accumulo.fate.zookeeper.ZooCacheFactory;
@@ -76,6 +77,14 @@
   private Supplier<SslConnectionParams> sslSupplier;
   private TCredentials rpcCreds;
 
+  private volatile boolean closed = false;
+
+  private void ensureOpen() {
+    if (closed) {
+      throw new IllegalStateException("This client was closed.");
+    }
+  }
+
   private static <T> Supplier<T> memoizeWithExpiration(Supplier<T> s) {
     // This insanity exists to make modernizer plugin happy. We are living in the future now.
     return () -> Suppliers.memoizeWithExpiration(s::get, 100, TimeUnit.MILLISECONDS).get();
@@ -146,6 +155,7 @@ public int getZooKeepersSessionTimeOut() {
   }
 
   public ClientInfo getClientInfo() {
+    ensureOpen();
     return info;
   }
 
@@ -153,6 +163,7 @@ public ClientInfo getClientInfo() {
    * Retrieve the credentials used to construct this context
    */
   public synchronized Credentials getCredentials() {
+    ensureOpen();
     if (creds == null) {
       creds = new Credentials(info.getPrincipal(), info.getAuthenticationToken());
     }
@@ -160,14 +171,17 @@ public synchronized Credentials getCredentials() {
   }
 
   public String getPrincipal() {
+    ensureOpen();
     return getCredentials().getPrincipal();
   }
 
   public AuthenticationToken getAuthenticationToken() {
+    ensureOpen();
     return getCredentials().getToken();
   }
 
   public Properties getProperties() {
+    ensureOpen();
     return info.getProperties();
   }
 
@@ -177,6 +191,7 @@ public Properties getProperties() {
    */
   public synchronized void setCredentials(Credentials newCredentials) {
     checkArgument(newCredentials != null, "newCredentials is null");
+    ensureOpen();
     creds = newCredentials;
     rpcCreds = null;
   }
@@ -185,6 +200,7 @@ public synchronized void setCredentials(Credentials newCredentials) {
    * Retrieve the configuration used to construct this context
    */
   public AccumuloConfiguration getConfiguration() {
+    ensureOpen();
     return serverConf;
   }
 
@@ -192,6 +208,7 @@ public AccumuloConfiguration getConfiguration() {
    * Retrieve the universal RPC client timeout from the configuration
    */
   public long getClientTimeoutInMillis() {
+    ensureOpen();
     return timeoutSupplier.get();
   }
 
@@ -199,6 +216,7 @@ public long getClientTimeoutInMillis() {
    * Retrieve SSL/TLS configuration to initiate an RPC connection to a server
    */
   public SslConnectionParams getClientSslParams() {
+    ensureOpen();
     return sslSupplier.get();
   }
 
@@ -206,6 +224,7 @@ public SslConnectionParams getClientSslParams() {
    * Retrieve SASL configuration to initiate an RPC connection to a server
    */
   public SaslConnectionParams getSaslParams() {
+    ensureOpen();
     return saslSupplier.get();
   }
 
@@ -214,13 +233,15 @@ public SaslConnectionParams getSaslParams() {
    */
   public synchronized AccumuloClient getClient()
       throws AccumuloException, AccumuloSecurityException {
+    ensureOpen();
     if (client == null) {
-      client = new AccumuloClientImpl(this);
+      client = new AccumuloClientImpl(SingletonReservation.noop(), this);
     }
     return client;
   }
 
   public BatchWriterConfig getBatchWriterConfig() {
+    ensureOpen();
     if (batchWriterConfig == null) {
       batchWriterConfig = ClientInfoFactory.getBatchWriterConfig(getClientInfo());
     }
@@ -231,6 +252,7 @@ public BatchWriterConfig getBatchWriterConfig() {
    * Serialize the credentials just before initiating the RPC call
    */
   public synchronized TCredentials rpcCreds() {
+    ensureOpen();
     if (getCredentials().getToken().isDestroyed()) {
       rpcCreds = null;
     }
@@ -248,6 +270,7 @@ public synchronized TCredentials rpcCreds() {
    * @return location in "hostname:port" form
    */
   public String getRootTabletLocation() {
+    ensureOpen();
     String zRootLocPath = getZooKeeperRoot() + RootTable.ZROOT_TABLET_LOCATION;
 
     OpTimer timer = null;
@@ -280,6 +303,7 @@ public String getRootTabletLocation() {
    * @return a list of locations in "hostname:port" form
    */
   public List<String> getMasterLocations() {
+    ensureOpen();
     String masterLocPath = getZooKeeperRoot() + Constants.ZMASTER_LOCK;
 
     OpTimer timer = null;
@@ -311,6 +335,7 @@ public String getRootTabletLocation() {
    * @return a UUID
    */
   public String getInstanceID() {
+    ensureOpen();
     final String instanceName = info.getInstanceName();
     if (instanceId == null) {
       // want the instance id to be stable for the life of this instance object,
@@ -336,6 +361,7 @@ public String getInstanceID() {
   }
 
   public String getZooKeeperRoot() {
+    ensureOpen();
     return ZooUtil.getRoot(getInstanceID());
   }
 
@@ -345,6 +371,7 @@ public String getZooKeeperRoot() {
    * @return current instance name
    */
   public String getInstanceName() {
+    ensureOpen();
     return info.getInstanceName();
   }
 
@@ -354,6 +381,7 @@ public String getInstanceName() {
    * @return the zookeeper servers this instance is using in "hostname:port" form
    */
   public String getZooKeepers() {
+    ensureOpen();
     return info.getZooKeepers();
   }
 
@@ -363,10 +391,16 @@ public String getZooKeepers() {
    * @return the configured timeout to connect to zookeeper
    */
   public int getZooKeepersSessionTimeOut() {
+    ensureOpen();
     return info.getZooKeepersSessionTimeOut();
   }
 
   public ZooCache getZooCache() {
+    ensureOpen();
     return zooCache;
   }
+
+  public void close() {
+    closed = true;
+  }
 }
diff --git a/core/src/main/java/org/apache/accumulo/core/client/impl/ClientInfoFactory.java b/core/src/main/java/org/apache/accumulo/core/client/impl/ClientInfoFactory.java
index 5e406af065..9c40b03d99 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/impl/ClientInfoFactory.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/impl/ClientInfoFactory.java
@@ -18,9 +18,6 @@
 
 import java.util.concurrent.TimeUnit;
 
-import org.apache.accumulo.core.client.AccumuloClient;
-import org.apache.accumulo.core.client.AccumuloException;
-import org.apache.accumulo.core.client.AccumuloSecurityException;
 import org.apache.accumulo.core.client.BatchWriterConfig;
 import org.apache.accumulo.core.client.ClientInfo;
 import org.apache.accumulo.core.client.Durability;
@@ -39,15 +36,6 @@ public static Long getLong(ClientInfo info, ClientProperty property) {
     return property.getLong(info.getProperties());
   }
 
-  public static AccumuloClient getClient(ClientInfo info)
-      throws AccumuloSecurityException, AccumuloException {
-    return new AccumuloClientImpl(new ClientContext(info));
-  }
-
-  public static Credentials getCredentials(ClientInfo info) {
-    return new Credentials(info.getPrincipal(), info.getAuthenticationToken());
-  }
-
   public static BatchWriterConfig getBatchWriterConfig(ClientInfo info) {
     BatchWriterConfig batchWriterConfig = new BatchWriterConfig();
     Long maxMemory = getLong(info, ClientProperty.BATCH_WRITER_MAX_MEMORY_BYTES);
diff --git a/core/src/main/java/org/apache/accumulo/core/client/impl/ClientInfoImpl.java b/core/src/main/java/org/apache/accumulo/core/client/impl/ClientInfoImpl.java
index 266c967521..ad9b001625 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/impl/ClientInfoImpl.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/impl/ClientInfoImpl.java
@@ -21,12 +21,13 @@
 import java.io.InputStream;
 import java.util.Properties;
 
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 import org.apache.accumulo.core.client.ClientInfo;
 import org.apache.accumulo.core.client.security.tokens.AuthenticationToken;
 import org.apache.accumulo.core.conf.ClientProperty;
 import org.apache.accumulo.core.conf.ConfigurationTypeHelper;
 
+import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
+
 public class ClientInfoImpl implements ClientInfo {
 
   private Properties properties;
diff --git a/core/src/main/java/org/apache/accumulo/core/client/impl/ConnectorImpl.java b/core/src/main/java/org/apache/accumulo/core/client/impl/ConnectorImpl.java
index c48eab61ae..e91542fe0a 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/impl/ConnectorImpl.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/impl/ConnectorImpl.java
@@ -36,6 +36,8 @@
 import org.apache.accumulo.core.client.admin.SecurityOperations;
 import org.apache.accumulo.core.client.admin.TableOperations;
 import org.apache.accumulo.core.security.Authorizations;
+import org.apache.accumulo.core.singletons.SingletonManager;
+import org.apache.accumulo.core.singletons.SingletonManager.Mode;
 
 /**
  * This class now delegates to {@link AccumuloClientImpl}, except for the methods which were not
@@ -48,6 +50,7 @@
 
   public ConnectorImpl(AccumuloClientImpl impl) {
     this.impl = impl;
+    SingletonManager.setMode(Mode.CONNECTOR);
   }
 
   public AccumuloClientImpl getAccumuloClient() {
diff --git a/core/src/main/java/org/apache/accumulo/core/client/impl/Tables.java b/core/src/main/java/org/apache/accumulo/core/client/impl/Tables.java
index 8297df0a23..6260837cdb 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/impl/Tables.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/impl/Tables.java
@@ -30,6 +30,8 @@
 import org.apache.accumulo.core.client.TableNotFoundException;
 import org.apache.accumulo.core.master.state.tables.TableState;
 import org.apache.accumulo.core.metadata.MetadataTable;
+import org.apache.accumulo.core.singletons.SingletonManager;
+import org.apache.accumulo.core.singletons.SingletonService;
 import org.apache.accumulo.core.util.Pair;
 import org.apache.accumulo.fate.zookeeper.ZooCache;
 import org.apache.accumulo.fate.zookeeper.ZooCacheFactory;
@@ -50,6 +52,33 @@
   private static Cache<String,ZooCache> instanceToZooCache = CacheBuilder.newBuilder()
       .expireAfterAccess(10, TimeUnit.MINUTES).build();
 
+  static {
+    SingletonManager.register(new SingletonService() {
+
+      boolean enabled = false;
+
+      @Override
+      public synchronized boolean isEnabled() {
+        return enabled;
+      }
+
+      @Override
+      public synchronized void enable() {
+        enabled = true;
+      }
+
+      @Override
+      public synchronized void disable() {
+        try {
+          instanceToMapCache.invalidateAll();
+          instanceToZooCache.invalidateAll();
+        } finally {
+          enabled = false;
+        }
+      }
+    });
+  }
+
   /**
    * Lookup table ID in ZK. Throw TableNotFoundException if not found. Also wraps
    * NamespaceNotFoundException in TableNotFoundException if namespace is not found.
diff --git a/core/src/main/java/org/apache/accumulo/core/client/impl/TabletLocator.java b/core/src/main/java/org/apache/accumulo/core/client/impl/TabletLocator.java
index 7c075f3109..f9d57ac30e 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/impl/TabletLocator.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/impl/TabletLocator.java
@@ -35,8 +35,12 @@
 import org.apache.accumulo.core.metadata.MetadataLocationObtainer;
 import org.apache.accumulo.core.metadata.MetadataTable;
 import org.apache.accumulo.core.metadata.RootTable;
+import org.apache.accumulo.core.singletons.SingletonManager;
+import org.apache.accumulo.core.singletons.SingletonService;
 import org.apache.hadoop.io.Text;
 
+import com.google.common.base.Preconditions;
+
 public abstract class TabletLocator {
 
   /**
@@ -102,6 +106,7 @@ public boolean equals(LocatorKey lk) {
   }
 
   private static HashMap<LocatorKey,TabletLocator> locators = new HashMap<>();
+  private static boolean enabled = true;
 
   public static synchronized void clearLocators() {
     for (TabletLocator locator : locators.values()) {
@@ -110,7 +115,23 @@ public static synchronized void clearLocators() {
     locators.clear();
   }
 
+  static synchronized boolean isEnabled() {
+    return enabled;
+  }
+
+  static synchronized void disable() {
+    clearLocators();
+    enabled = false;
+  }
+
+  static synchronized void enable() {
+    enabled = true;
+  }
+
   public static synchronized TabletLocator getLocator(ClientContext context, Table.ID tableId) {
+    Preconditions.checkState(enabled, "The Accumulo singleton that that tracks tablet locations is "
+        + "disabled. This is likely caused by all AccumuloClients being closed or garbage collected"
+        + ".");
     LocatorKey key = new LocatorKey(context.getInstanceID(), tableId);
     TabletLocator tl = locators.get(key);
     if (tl == null) {
@@ -131,6 +152,26 @@ public static synchronized TabletLocator getLocator(ClientContext context, Table
     return tl;
   }
 
+  static {
+    SingletonManager.register(new SingletonService() {
+
+      @Override
+      public boolean isEnabled() {
+        return TabletLocator.isEnabled();
+      }
+
+      @Override
+      public void enable() {
+        TabletLocator.enable();
+      }
+
+      @Override
+      public void disable() {
+        TabletLocator.disable();
+      }
+    });
+  }
+
   public static class TabletLocations {
 
     private final List<TabletLocation> locations;
diff --git a/core/src/main/java/org/apache/accumulo/core/client/impl/ThriftTransportPool.java b/core/src/main/java/org/apache/accumulo/core/client/impl/ThriftTransportPool.java
index 8b340c2718..93d9a40aa5 100644
--- a/core/src/main/java/org/apache/accumulo/core/client/impl/ThriftTransportPool.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/impl/ThriftTransportPool.java
@@ -27,10 +27,10 @@
 import java.util.Map;
 import java.util.Map.Entry;
 import java.util.Set;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.atomic.AtomicBoolean;
 
 import org.apache.accumulo.core.rpc.ThriftUtil;
+import org.apache.accumulo.core.singletons.SingletonManager;
+import org.apache.accumulo.core.singletons.SingletonService;
 import org.apache.accumulo.core.util.Daemon;
 import org.apache.accumulo.core.util.HostAndPort;
 import org.apache.accumulo.core.util.Pair;
@@ -72,7 +72,7 @@ public CachedConnection reserveAny() {
   private Map<ThriftTransportKey,Long> errorTime = new HashMap<>();
   private Set<ThriftTransportKey> serversWarnedAbout = new HashSet<>();
 
-  private CountDownLatch closerExitLatch;
+  private Thread checkThread;
 
   private static final Logger log = LoggerFactory.getLogger(ThriftTransportPool.class);
 
@@ -101,19 +101,21 @@ void unreserve() {
   }
 
   public static class TransportPoolShutdownException extends RuntimeException {
+    public TransportPoolShutdownException(String msg) {
+      super(msg);
+    }
+
     private static final long serialVersionUID = 1L;
   }
 
   private static class Closer implements Runnable {
     final ThriftTransportPool pool;
-    private CountDownLatch closerExitLatch;
 
-    public Closer(ThriftTransportPool pool, CountDownLatch closerExitLatch) {
+    public Closer(ThriftTransportPool pool) {
       this.pool = pool;
-      this.closerExitLatch = closerExitLatch;
     }
 
-    private void closeConnections() {
+    private void closeConnections() throws InterruptedException {
       while (true) {
 
         ArrayList<CachedConnection> connectionsToClose = new ArrayList<>();
@@ -151,11 +153,7 @@ private void closeConnections() {
           cachedConnection.transport.close();
         }
 
-        try {
-          Thread.sleep(500);
-        } catch (InterruptedException e) {
-          log.debug("Sleep interrupted in closeConnections()", e);
-        }
+        Thread.sleep(500);
       }
     }
 
@@ -163,9 +161,9 @@ private void closeConnections() {
     public void run() {
       try {
         closeConnections();
-      } catch (TransportPoolShutdownException e) {} finally {
-        closerExitLatch.countDown();
-      }
+      } catch (InterruptedException e) {
+        Thread.currentThread().interrupt();
+      } catch (TransportPoolShutdownException e) {}
     }
   }
 
@@ -610,23 +608,67 @@ public synchronized void setIdleTime(long time) {
     log.debug("Set thrift transport pool idle time to {}", time);
   }
 
-  private static ThriftTransportPool instance = new ThriftTransportPool();
-  private static final AtomicBoolean daemonStarted = new AtomicBoolean(false);
+  private static ThriftTransportPool instance = null;
 
-  public static ThriftTransportPool getInstance() {
-    if (daemonStarted.compareAndSet(false, true)) {
-      CountDownLatch closerExitLatch = new CountDownLatch(1);
-      new Daemon(new Closer(instance, closerExitLatch), "Thrift Connection Pool Checker").start();
-      instance.setCloserExitLatch(closerExitLatch);
-    }
+  static {
+    SingletonManager.register(new SingletonService() {
+
+      @Override
+      public boolean isEnabled() {
+        return ThriftTransportPool.isEnabled();
+      }
+
+      @Override
+      public void enable() {
+        ThriftTransportPool.enable();
+      }
+
+      @Override
+      public void disable() {
+        ThriftTransportPool.disable();
+      }
+    });
+  }
+
+  public static synchronized ThriftTransportPool getInstance() {
+    Preconditions.checkState(instance != null,
+        "The Accumulo singleton for connection pooling is disabled.  This is likely caused by all "
+            + "AccumuloClients being closed or garbage collected.");
+    instance.startCheckerThread();
     return instance;
   }
 
-  private synchronized void setCloserExitLatch(CountDownLatch closerExitLatch) {
-    this.closerExitLatch = closerExitLatch;
+  private static synchronized boolean isEnabled() {
+    return instance != null;
   }
 
-  public void shutdown() {
+  private static synchronized void enable() {
+    if (instance == null) {
+      // this code intentionally does not start the thread that closes idle connections. That thread
+      // is created the first time something attempts to use this service.
+      instance = new ThriftTransportPool();
+    }
+  }
+
+  private static synchronized void disable() {
+    if (instance != null) {
+      try {
+        instance.shutdown();
+      } finally {
+        instance = null;
+      }
+    }
+  }
+
+  public synchronized void startCheckerThread() {
+    if (cache != null && checkThread == null) {
+      checkThread = new Daemon(new Closer(instance), "Thrift Connection Pool Checker");
+      checkThread.start();
+    }
+  }
+
+  private void shutdown() {
+    Thread ctl;
     synchronized (this) {
       if (cache == null)
         return;
@@ -645,18 +687,25 @@ public void shutdown() {
 
       // this will render the pool unusable and cause the background thread to exit
       this.cache = null;
+
+      ctl = checkThread;
     }
 
-    try {
-      closerExitLatch.await();
-    } catch (InterruptedException e) {
-      throw new RuntimeException(e);
+    if (ctl != null) {
+      try {
+        ctl.interrupt();
+        ctl.join();
+      } catch (InterruptedException e) {
+        throw new RuntimeException(e);
+      }
     }
   }
 
   private Map<ThriftTransportKey,CachedConnections> getCache() {
     if (cache == null)
-      throw new TransportPoolShutdownException();
+      throw new TransportPoolShutdownException(
+          "The Accumulo singleton for connection pooling is disabled.  This is likely caused by "
+              + "all AccumuloClients being closed or garbage collected.");
     return cache;
   }
 }
diff --git a/core/src/main/java/org/apache/accumulo/core/singletons/SingletonManager.java b/core/src/main/java/org/apache/accumulo/core/singletons/SingletonManager.java
new file mode 100644
index 0000000000..ecdad27e42
--- /dev/null
+++ b/core/src/main/java/org/apache/accumulo/core/singletons/SingletonManager.java
@@ -0,0 +1,194 @@
+/*
+ * 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.core.singletons;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.annotations.VisibleForTesting;
+import com.google.common.base.Preconditions;
+
+/**
+ * This class automates management of static singletons that maintain state for Accumulo clients.
+ * Historically, Accumulo client code that used Connector had no control over these singletons. The
+ * new AccumuloClient API that replaces Connector is closeable. When all AccumuloClients are closed
+ * then resources used by the singletons are released. This class coordinates releasing those
+ * resources. For compatibility purposes this class will not release resources when the user has
+ * created Connectors.
+ *
+ * <p>
+ * This class is intermediate solution to resource management. Ideally there would be no static
+ * state and AccumuloClients would own all of their state and clean it up on close. If
+ * AccumuloClient is not closable at inception, then it is harder to make it closable later. If
+ * AccumuloClient is not closable, then its hard to remove the static state. This class enables
+ * making AccumuloClient closable at inception so that static state can be removed later.
+ *
+ * @see org.apache.accumulo.core.util.CleanUp
+ */
+
+public class SingletonManager {
+
+  private static final Logger log = LoggerFactory.getLogger(SingletonManager.class);
+
+  /**
+   * These enums determine the behavior of the SingletonManager.
+   *
+   */
+  public enum Mode {
+    /**
+     * In this mode singletons are disabled when the number of active client reservations goes to
+     * zero.
+     */
+    CLIENT,
+    /**
+     * In this mode singletons are never disabled.
+     */
+    SERVER,
+    /**
+     * In this mode singletons are never disabled unless the mode is set back to CLIENT. The user
+     * can do this by using util.CleanUp (an old API created for users).
+     */
+    CONNECTOR
+  }
+
+  private static long reservations;
+  private static Mode mode;
+  private static boolean enabled;
+  private static boolean transitionedFromClientToConnector;
+  private static List<SingletonService> services;
+
+  @VisibleForTesting
+  static void reset() {
+    reservations = 0;
+    mode = Mode.CLIENT;
+    enabled = true;
+    transitionedFromClientToConnector = false;
+    services = new ArrayList<>();
+  }
+
+  static {
+    reset();
+  }
+
+  private static void enable(SingletonService service) {
+    try {
+      service.enable();
+    } catch (RuntimeException e) {
+      log.error("Failed to enable singleton service ", e);
+    }
+  }
+
+  private static void disable(SingletonService service) {
+    try {
+      service.disable();
+    } catch (RuntimeException e) {
+      log.error("Failed to disable singleton service", e);
+    }
+  }
+
+  /**
+   * Register a static singleton that should be disabled and enabled as needed.
+   */
+  public static synchronized void register(SingletonService service) {
+    if (enabled && !service.isEnabled()) {
+      enable(service);
+    }
+
+    if (!enabled && service.isEnabled()) {
+      disable(service);
+    }
+
+    services.add(service);
+  }
+
+  /**
+   * This method should be called when creating Accumulo clients using the public API. Accumulo
+   * clients created internally within Accumulo code should probably call
+   * {@link SingletonReservation#noop()} instead. While a client holds a reservation, singleton
+   * services are enabled.
+   *
+   * @return A reservation that must be closed when the AccumuloClient is closed.
+   */
+  public static synchronized SingletonReservation getClientReservation() {
+    Preconditions.checkState(reservations >= 0);
+    reservations++;
+    transition();
+    return new SingletonReservation();
+  }
+
+  static synchronized void releaseRerservation() {
+    Preconditions.checkState(reservations > 0);
+    reservations--;
+    transition();
+  }
+
+  @VisibleForTesting
+  public static long getReservationCount() {
+    return reservations;
+  }
+
+  /**
+   * Change how singletons are managed. The default mode is {@link Mode#CLIENT}
+   */
+  public static synchronized void setMode(Mode mode) {
+    if (SingletonManager.mode == Mode.CLIENT && mode == Mode.CONNECTOR) {
+      if (transitionedFromClientToConnector) {
+        throw new IllegalStateException("Can only transition from " + Mode.CLIENT + " to "
+            + Mode.CONNECTOR + " once.  This error indicates that "
+            + "org.apache.accumulo.core.util.CleanUp.shutdownNow() was called and then later a "
+            + "Connector was created.  Connectors can not be created after CleanUp.shutdownNow()"
+            + " is called.");
+      }
+
+      transitionedFromClientToConnector = true;
+    }
+
+    // do not change from server mode, its a terminal mode that can not be left once entered
+    if (SingletonManager.mode != Mode.SERVER) {
+      SingletonManager.mode = mode;
+    }
+    transition();
+  }
+
+  @VisibleForTesting
+  public static synchronized Mode getMode() {
+    return mode;
+  }
+
+  private static void transition() {
+    if (enabled && reservations == 0 && mode == Mode.CLIENT) {
+      for (SingletonService service : services) {
+        disable(service);
+      }
+      enabled = false;
+    }
+
+    if (!enabled && (mode == Mode.CONNECTOR || mode == Mode.SERVER
+        || (mode == Mode.CLIENT && reservations > 0))) {
+      for (SingletonService service : services) {
+        enable(service);
+      }
+
+      enabled = true;
+    }
+  }
+
+}
diff --git a/core/src/main/java/org/apache/accumulo/core/singletons/SingletonReservation.java b/core/src/main/java/org/apache/accumulo/core/singletons/SingletonReservation.java
new file mode 100644
index 0000000000..4edd469b91
--- /dev/null
+++ b/core/src/main/java/org/apache/accumulo/core/singletons/SingletonReservation.java
@@ -0,0 +1,67 @@
+/*
+ * 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.core.singletons;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * @see SingletonManager#getClientReservation()
+ */
+public class SingletonReservation implements AutoCloseable {
+
+  // volatile so finalize does not need to synchronize to reliably read
+  protected volatile boolean closed = false;
+
+  private static Logger log = LoggerFactory.getLogger(SingletonReservation.class);
+
+  @Override
+  public synchronized void close() {
+    if (closed) {
+      return;
+    }
+    closed = true;
+    SingletonManager.releaseRerservation();
+  }
+
+  @Override
+  protected void finalize() throws Throwable {
+    try {
+      if (!closed) {
+        log.warn("An Accumulo Client was garbage collected without being closed.");
+      }
+    } finally {
+      super.finalize();
+    }
+  }
+
+  private static class NoopSingletonReservation extends SingletonReservation {
+    NoopSingletonReservation() {
+      closed = true;
+    }
+  }
+
+  private static final SingletonReservation NOOP = new NoopSingletonReservation();
+
+  /**
+   * @return A reservation where the close method is a no-op.
+   */
+  public static SingletonReservation noop() {
+    return NOOP;
+  }
+}
diff --git a/core/src/main/java/org/apache/accumulo/core/singletons/SingletonService.java b/core/src/main/java/org/apache/accumulo/core/singletons/SingletonService.java
new file mode 100644
index 0000000000..8cb79b9dac
--- /dev/null
+++ b/core/src/main/java/org/apache/accumulo/core/singletons/SingletonService.java
@@ -0,0 +1,32 @@
+/*
+ * 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.core.singletons;
+
+/**
+ * The {@link SingletonManager} uses this interface to enable and disable singleton services.
+ *
+ * @see SingletonManager#register(SingletonService)
+ */
+public interface SingletonService {
+
+  public boolean isEnabled();
+
+  public void enable();
+
+  public void disable();
+}
diff --git a/core/src/main/java/org/apache/accumulo/core/util/CleanUp.java b/core/src/main/java/org/apache/accumulo/core/util/CleanUp.java
index def3520313..3d44161cd7 100644
--- a/core/src/main/java/org/apache/accumulo/core/util/CleanUp.java
+++ b/core/src/main/java/org/apache/accumulo/core/util/CleanUp.java
@@ -18,22 +18,36 @@
 
 import java.util.Set;
 
-import org.apache.accumulo.core.client.impl.ThriftTransportPool;
-import org.apache.accumulo.fate.zookeeper.ZooSession;
+import org.apache.accumulo.core.client.AccumuloClient;
+import org.apache.accumulo.core.singletons.SingletonManager;
+import org.apache.accumulo.core.singletons.SingletonManager.Mode;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+/**
+ * Connector uses static resource that create threads and use memory. The only way to clean up these
+ * static resource related to Connectors created using ZookeeperInstance is to use this class.
+ *
+ * <p>
+ * This class is not needed when only using {@link AccumuloClient}. The new AccumuloClient API that
+ * replaces Connector is closable. For code that only uses AccumuloClient, when all AccumuloClients
+ * are closed resources are cleaned up. Connectors that are derived from an AccumuloClient do not
+ * necessitate the use of this code.
+ *
+ * @deprecated since 2.0.0 Use only {@link AccumuloClient} instead. Also, make sure you close the
+ *             AccumuloClient instances.
+ */
+@Deprecated
 public class CleanUp {
 
   private static final Logger log = LoggerFactory.getLogger(CleanUp.class);
 
   /**
    * kills all threads created by internal Accumulo singleton resources. After this method is
-   * called, no accumulo client will work in the current classloader.
+   * called, no Connector will work in the current classloader.
    */
   public static void shutdownNow() {
-    ThriftTransportPool.getInstance().shutdown();
-    ZooSession.shutdown();
+    SingletonManager.setMode(Mode.CLIENT);
     waitForZooKeeperClientThreads();
   }
 
diff --git a/core/src/main/java/org/apache/accumulo/fate/zookeeper/ZooCache.java b/core/src/main/java/org/apache/accumulo/fate/zookeeper/ZooCache.java
index ca523bd540..499a9dc0e7 100644
--- a/core/src/main/java/org/apache/accumulo/fate/zookeeper/ZooCache.java
+++ b/core/src/main/java/org/apache/accumulo/fate/zookeeper/ZooCache.java
@@ -40,6 +40,7 @@
 import org.slf4j.LoggerFactory;
 
 import com.google.common.annotations.VisibleForTesting;
+import com.google.common.base.Preconditions;
 import com.google.common.collect.ImmutableList;
 
 /**
@@ -62,6 +63,8 @@
   private final ZooReader zReader;
   private final SecureRandom secureRandom = new SecureRandom();
 
+  private volatile boolean closed = false;
+
   public static class ZcStat {
     private long ephemeralOwner;
     private long mzxid;
@@ -149,7 +152,6 @@ private ZooKeeper getZooKeeper() {
   private class ZCacheWatcher implements Watcher {
     @Override
     public void process(WatchedEvent event) {
-
       if (log.isTraceEnabled()) {
         log.trace("{}", event);
       }
@@ -308,6 +310,7 @@ public T retry() {
    * @return children list, or null if node has no children or does not exist
    */
   public List<String> getChildren(final String zPath) {
+    Preconditions.checkState(!closed);
 
     ZooRunnable<List<String>> zr = new ZooRunnable<List<String>>() {
 
@@ -373,6 +376,7 @@ public T retry() {
    * @return path data, or null if non-existent
    */
   public byte[] get(final String zPath, final ZcStat status) {
+    Preconditions.checkState(!closed);
     ZooRunnable<byte[]> zr = new ZooRunnable<byte[]>() {
 
       @Override
@@ -440,6 +444,7 @@ public T retry() {
    *          cached statistic, that is or will be cached
    */
   protected void copyStats(ZcStat userStat, ZcStat cachedStat) {
+    Preconditions.checkState(!closed);
     if (userStat != null && cachedStat != null) {
       userStat.set(cachedStat);
     }
@@ -474,6 +479,7 @@ private void remove(String zPath) {
    * Clears this cache.
    */
   public void clear() {
+    Preconditions.checkState(!closed);
     cacheWriteLock.lock();
     try {
       cache.clear();
@@ -486,11 +492,16 @@ public void clear() {
     }
   }
 
+  public void close() {
+    closed = true;
+  }
+
   /**
    * Returns a monotonically increasing count of the number of time the cache was updated. If the
    * count is the same, then it means cache did not change.
    */
   public long getUpdateCount() {
+    Preconditions.checkState(!closed);
     return immutableCache.updateCount;
   }
 
@@ -536,6 +547,7 @@ boolean childrenCached(String zPath) {
    *          path of top node
    */
   public void clear(String zPath) {
+    Preconditions.checkState(!closed);
     cacheWriteLock.lock();
     try {
       for (Iterator<String> i = cache.keySet().iterator(); i.hasNext();) {
diff --git a/core/src/main/java/org/apache/accumulo/fate/zookeeper/ZooCacheFactory.java b/core/src/main/java/org/apache/accumulo/fate/zookeeper/ZooCacheFactory.java
index f71346a5e7..8e6bc12240 100644
--- a/core/src/main/java/org/apache/accumulo/fate/zookeeper/ZooCacheFactory.java
+++ b/core/src/main/java/org/apache/accumulo/fate/zookeeper/ZooCacheFactory.java
@@ -19,6 +19,8 @@
 import java.util.HashMap;
 import java.util.Map;
 
+import org.apache.accumulo.core.singletons.SingletonManager;
+import org.apache.accumulo.core.singletons.SingletonService;
 import org.apache.zookeeper.Watcher;
 
 /**
@@ -27,6 +29,53 @@
 public class ZooCacheFactory {
   // TODO: make this better - LRU, soft references, ...
   private static Map<String,ZooCache> instances = new HashMap<>();
+  private static boolean enabled = true;
+
+  private static boolean isEnabled() {
+    synchronized (instances) {
+      return enabled;
+    }
+  }
+
+  private static void enable() {
+    synchronized (instances) {
+      enabled = true;
+    }
+  }
+
+  private static void disable() {
+    synchronized (instances) {
+      try {
+        instances.values().forEach(zc -> zc.close());
+      } finally {
+        instances.clear();
+        enabled = false;
+      }
+    }
+  }
+
+  static {
+    // important because of ZOOKEEPER-2368.. when zookeeper client is closed it does not generate an
+    // event!
+    SingletonManager.register(new SingletonService() {
+
+      @Override
+      public synchronized boolean isEnabled() {
+        return ZooCacheFactory.isEnabled();
+      }
+
+      @Override
+      public synchronized void enable() {
+        ZooCacheFactory.enable();
+      }
+
+      @Override
+      public synchronized void disable() {
+        ZooCacheFactory.disable();
+      }
+    });
+
+  }
 
   /**
    * Gets a {@link ZooCache}. The same object may be returned for multiple calls with the same
@@ -41,6 +90,10 @@
   public ZooCache getZooCache(String zooKeepers, int sessionTimeout) {
     String key = zooKeepers + ":" + sessionTimeout;
     synchronized (instances) {
+      if (!isEnabled()) {
+        throw new IllegalStateException("\"The Accumulo singleton for zookeeper caching is "
+            + "disabled. This is likely caused by all AccumuloClients being closed");
+      }
       ZooCache zc = instances.get(key);
       if (zc == null) {
         zc = new ZooCache(zooKeepers, sessionTimeout);
@@ -78,5 +131,4 @@ void reset() {
       instances.clear();
     }
   }
-
 }
diff --git a/core/src/main/java/org/apache/accumulo/fate/zookeeper/ZooSession.java b/core/src/main/java/org/apache/accumulo/fate/zookeeper/ZooSession.java
index 774ad439b9..ef4a9874dd 100644
--- a/core/src/main/java/org/apache/accumulo/fate/zookeeper/ZooSession.java
+++ b/core/src/main/java/org/apache/accumulo/fate/zookeeper/ZooSession.java
@@ -24,6 +24,8 @@
 import java.util.HashMap;
 import java.util.Map;
 
+import org.apache.accumulo.core.singletons.SingletonManager;
+import org.apache.accumulo.core.singletons.SingletonService;
 import org.apache.accumulo.core.util.AddressUtil;
 import org.apache.accumulo.fate.util.UtilWaitThread;
 import org.apache.zookeeper.WatchedEvent;
@@ -38,6 +40,10 @@
 
   public static class ZooSessionShutdownException extends RuntimeException {
 
+    public ZooSessionShutdownException(String msg) {
+      super(msg);
+    }
+
     private static final long serialVersionUID = 1L;
 
   }
@@ -56,6 +62,26 @@ public ZooSessionInfo(ZooKeeper zooKeeper, ZooWatcher watcher) {
 
   private static final SecureRandom secureRandom = new SecureRandom();
 
+  static {
+    SingletonManager.register(new SingletonService() {
+
+      @Override
+      public boolean isEnabled() {
+        return ZooSession.isEnabled();
+      }
+
+      @Override
+      public void enable() {
+        ZooSession.enable();
+      }
+
+      @Override
+      public void disable() {
+        ZooSession.disable();
+      }
+    });
+  }
+
   private static String sessionKey(String keepers, int timeout, String scheme, byte[] auth) {
     return keepers + ":" + timeout + ":" + (scheme == null ? "" : scheme) + ":"
         + (auth == null ? "" : new String(auth, UTF_8));
@@ -152,7 +178,9 @@ public static synchronized ZooKeeper getSession(String zooKeepers, int timeout,
       byte[] auth) {
 
     if (sessions == null)
-      throw new ZooSessionShutdownException();
+      throw new ZooSessionShutdownException(
+          "The Accumulo singleton that that tracks zookeeper session is disabled.  This is likely "
+              + "caused by all AccumuloClients being closed or garbage collected.");
 
     String sessionKey = sessionKey(zooKeepers, timeout, scheme, auth);
 
@@ -178,7 +206,18 @@ public static synchronized ZooKeeper getSession(String zooKeepers, int timeout,
     return zsi.zooKeeper;
   }
 
-  public static synchronized void shutdown() {
+  private static synchronized boolean isEnabled() {
+    return sessions != null;
+  }
+
+  private static synchronized void enable() {
+    if (sessions != null)
+      return;
+
+    sessions = new HashMap<>();
+  }
+
+  private static synchronized void disable() {
     if (sessions == null)
       return;
 
diff --git a/core/src/test/java/org/apache/accumulo/core/singletons/SingletonManagerTest.java b/core/src/test/java/org/apache/accumulo/core/singletons/SingletonManagerTest.java
new file mode 100644
index 0000000000..a6bd431a3d
--- /dev/null
+++ b/core/src/test/java/org/apache/accumulo/core/singletons/SingletonManagerTest.java
@@ -0,0 +1,254 @@
+/*
+ * 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.core.singletons;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import org.apache.accumulo.core.singletons.SingletonManager.Mode;
+import org.junit.Before;
+import org.junit.Test;
+
+public class SingletonManagerTest {
+
+  TestService service1;
+  TestService service2;
+
+  @Before
+  public void setup() {
+    SingletonManager.reset();
+    assertEquals(0, SingletonManager.getReservationCount());
+
+    service1 = new TestService(true);
+    service2 = new TestService(false);
+
+    SingletonManager.register(service1);
+    SingletonManager.register(service2);
+
+    assertEquals(new TestService(true, 0, 0), service1);
+    assertEquals(new TestService(true, 1, 0), service2);
+
+    assertEquals(Mode.CLIENT, SingletonManager.getMode());
+  }
+
+  @Test
+  public void testClient() {
+    SingletonReservation resv1 = SingletonManager.getClientReservation();
+
+    assertEquals(1, SingletonManager.getReservationCount());
+
+    SingletonReservation resv2 = SingletonManager.getClientReservation();
+
+    assertEquals(2, SingletonManager.getReservationCount());
+    assertEquals(new TestService(true, 0, 0), service1);
+    assertEquals(new TestService(true, 1, 0), service2);
+
+    resv1.close();
+
+    assertEquals(1, SingletonManager.getReservationCount());
+    assertEquals(new TestService(true, 0, 0), service1);
+    assertEquals(new TestService(true, 1, 0), service2);
+
+    // calling close again should have no effect
+    resv1.close();
+
+    assertEquals(1, SingletonManager.getReservationCount());
+    assertEquals(new TestService(true, 0, 0), service1);
+    assertEquals(new TestService(true, 1, 0), service2);
+
+    resv2.close();
+
+    assertEquals(0, SingletonManager.getReservationCount());
+    assertEquals(new TestService(false, 0, 1), service1);
+    assertEquals(new TestService(false, 1, 1), service2);
+
+    SingletonReservation resv3 = SingletonManager.getClientReservation();
+
+    assertEquals(1, SingletonManager.getReservationCount());
+    assertEquals(new TestService(true, 1, 1), service1);
+    assertEquals(new TestService(true, 2, 1), service2);
+
+    resv3.close();
+
+    assertEquals(0, SingletonManager.getReservationCount());
+    assertEquals(new TestService(false, 1, 2), service1);
+    assertEquals(new TestService(false, 2, 2), service2);
+  }
+
+  @Test
+  public void testConnectorPreventsDisable() {
+
+    SingletonManager.setMode(Mode.CONNECTOR);
+    assertEquals(Mode.CONNECTOR, SingletonManager.getMode());
+
+    SingletonReservation resv1 = SingletonManager.getClientReservation();
+
+    assertEquals(1, SingletonManager.getReservationCount());
+
+    SingletonReservation resv2 = SingletonManager.getClientReservation();
+
+    assertEquals(2, SingletonManager.getReservationCount());
+
+    resv1.close();
+    resv2.close();
+
+    assertEquals(0, SingletonManager.getReservationCount());
+
+    assertEquals(new TestService(true, 0, 0), service1);
+    assertEquals(new TestService(true, 1, 0), service2);
+
+    SingletonManager.setMode(Mode.CLIENT);
+    assertEquals(Mode.CLIENT, SingletonManager.getMode());
+
+    assertEquals(new TestService(false, 0, 1), service1);
+    assertEquals(new TestService(false, 1, 1), service2);
+
+    try {
+      SingletonManager.setMode(Mode.CONNECTOR);
+      fail("Should only be able to set mode to CONNECTOR once");
+    } catch (IllegalStateException e) {}
+
+    assertEquals(Mode.CLIENT, SingletonManager.getMode());
+  }
+
+  @Test
+  public void testConnectorEnables() {
+    SingletonReservation resv1 = SingletonManager.getClientReservation();
+    resv1.close();
+
+    assertEquals(new TestService(false, 0, 1), service1);
+    assertEquals(new TestService(false, 1, 1), service2);
+
+    // this should enable services
+    SingletonManager.setMode(Mode.CONNECTOR);
+
+    assertEquals(new TestService(true, 1, 1), service1);
+    assertEquals(new TestService(true, 2, 1), service2);
+  }
+
+  @Test
+  public void testServerPreventsDisable() {
+
+    SingletonManager.setMode(Mode.SERVER);
+    assertEquals(Mode.SERVER, SingletonManager.getMode());
+
+    SingletonReservation resv1 = SingletonManager.getClientReservation();
+
+    assertEquals(1, SingletonManager.getReservationCount());
+
+    SingletonReservation resv2 = SingletonManager.getClientReservation();
+
+    assertEquals(2, SingletonManager.getReservationCount());
+
+    resv1.close();
+    resv2.close();
+
+    assertEquals(0, SingletonManager.getReservationCount());
+
+    assertEquals(new TestService(true, 0, 0), service1);
+    assertEquals(new TestService(true, 1, 0), service2);
+
+    // can not leave server mode, so this should have no effect
+    SingletonManager.setMode(Mode.CLIENT);
+    assertEquals(Mode.SERVER, SingletonManager.getMode());
+
+    assertEquals(new TestService(true, 0, 0), service1);
+    assertEquals(new TestService(true, 1, 0), service2);
+  }
+
+  @Test
+  public void testServerEnables() {
+    SingletonReservation resv1 = SingletonManager.getClientReservation();
+    resv1.close();
+
+    assertEquals(new TestService(false, 0, 1), service1);
+    assertEquals(new TestService(false, 1, 1), service2);
+
+    // this should enable services
+    SingletonManager.setMode(Mode.SERVER);
+    assertEquals(Mode.SERVER, SingletonManager.getMode());
+
+    assertEquals(new TestService(true, 1, 1), service1);
+    assertEquals(new TestService(true, 2, 1), service2);
+
+    // can not leave server mode, so this should have no effect
+    SingletonManager.setMode(Mode.CLIENT);
+    assertEquals(Mode.SERVER, SingletonManager.getMode());
+
+    assertEquals(new TestService(true, 1, 1), service1);
+    assertEquals(new TestService(true, 2, 1), service2);
+  }
+
+  private static class TestService implements SingletonService {
+
+    boolean enabled;
+    int enables = 0;
+    int disables = 0;
+
+    TestService(boolean enabled) {
+      this.enabled = enabled;
+    }
+
+    TestService(boolean enabled, int enables, int disables) {
+      this.enabled = enabled;
+      this.enables = enables;
+      this.disables = disables;
+    }
+
+    @Override
+    public boolean isEnabled() {
+      return enabled;
+    }
+
+    @Override
+    public void enable() {
+      assertFalse(enabled);
+      enabled = true;
+      enables++;
+
+    }
+
+    @Override
+    public void disable() {
+      assertTrue(enabled);
+      enabled = false;
+      disables++;
+    }
+
+    @Override
+    public boolean equals(Object o) {
+      if (o instanceof TestService) {
+        TestService ots = (TestService) o;
+        return enabled == ots.enabled && enables == ots.enables && disables == ots.disables;
+      }
+      return false;
+    }
+
+    @Override
+    public int hashCode() {
+      throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public String toString() {
+      return "enabled:" + enabled + " enables:" + enables + " disables:" + disables;
+    }
+  }
+}
diff --git a/minicluster/src/main/java/org/apache/accumulo/minicluster/impl/MiniAccumuloClusterImpl.java b/minicluster/src/main/java/org/apache/accumulo/minicluster/impl/MiniAccumuloClusterImpl.java
index 8eda2bb11b..63d3c49d48 100644
--- a/minicluster/src/main/java/org/apache/accumulo/minicluster/impl/MiniAccumuloClusterImpl.java
+++ b/minicluster/src/main/java/org/apache/accumulo/minicluster/impl/MiniAccumuloClusterImpl.java
@@ -59,7 +59,6 @@
 import org.apache.accumulo.core.client.AccumuloException;
 import org.apache.accumulo.core.client.AccumuloSecurityException;
 import org.apache.accumulo.core.client.ClientInfo;
-import org.apache.accumulo.core.client.impl.AccumuloClientImpl;
 import org.apache.accumulo.core.client.impl.ClientContext;
 import org.apache.accumulo.core.client.impl.MasterClient;
 import org.apache.accumulo.core.client.impl.thrift.ThriftNotActiveServiceException;
@@ -83,8 +82,8 @@
 import org.apache.accumulo.master.state.SetGoalState;
 import org.apache.accumulo.minicluster.MiniAccumuloCluster;
 import org.apache.accumulo.minicluster.ServerType;
-import org.apache.accumulo.server.ServerUtil;
 import org.apache.accumulo.server.ServerContext;
+import org.apache.accumulo.server.ServerUtil;
 import org.apache.accumulo.server.fs.VolumeManager;
 import org.apache.accumulo.server.fs.VolumeManagerImpl;
 import org.apache.accumulo.server.init.Initialize;
diff --git a/server/base/src/main/java/org/apache/accumulo/server/ServerContext.java b/server/base/src/main/java/org/apache/accumulo/server/ServerContext.java
index 9670a70ffb..3c7e847ba1 100644
--- a/server/base/src/main/java/org/apache/accumulo/server/ServerContext.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/ServerContext.java
@@ -35,6 +35,7 @@
 import org.apache.accumulo.core.conf.SiteConfiguration;
 import org.apache.accumulo.core.rpc.SslConnectionParams;
 import org.apache.accumulo.core.security.crypto.CryptoServiceFactory;
+import org.apache.accumulo.core.singletons.SingletonReservation;
 import org.apache.accumulo.core.spi.crypto.CryptoService;
 import org.apache.accumulo.core.trace.DistributedTrace;
 import org.apache.accumulo.fate.zookeeper.ZooReaderWriter;
@@ -238,7 +239,7 @@ public AuthenticationTokenSecretManager getSecretManager() {
   public synchronized AccumuloClient getClient()
       throws AccumuloException, AccumuloSecurityException {
     if (client == null) {
-      client = new AccumuloClientImpl(this);
+      client = new AccumuloClientImpl(SingletonReservation.noop(), this);
     }
     return client;
   }
diff --git a/server/base/src/main/java/org/apache/accumulo/server/ServerInfo.java b/server/base/src/main/java/org/apache/accumulo/server/ServerInfo.java
index e15cacef92..e182beb9a3 100644
--- a/server/base/src/main/java/org/apache/accumulo/server/ServerInfo.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/ServerInfo.java
@@ -31,6 +31,8 @@
 import org.apache.accumulo.core.conf.ClientProperty;
 import org.apache.accumulo.core.conf.Property;
 import org.apache.accumulo.core.conf.SiteConfiguration;
+import org.apache.accumulo.core.singletons.SingletonManager;
+import org.apache.accumulo.core.singletons.SingletonManager.Mode;
 import org.apache.accumulo.fate.zookeeper.ZooCache;
 import org.apache.accumulo.fate.zookeeper.ZooCacheFactory;
 import org.apache.accumulo.fate.zookeeper.ZooUtil;
@@ -52,6 +54,7 @@
 
   ServerInfo(SiteConfiguration siteConfig, String instanceName, String zooKeepers,
       int zooKeepersSessionTimeOut) {
+    SingletonManager.setMode(Mode.SERVER);
     this.siteConfig = siteConfig;
     this.instanceName = instanceName;
     this.zooKeepers = zooKeepers;
@@ -80,6 +83,7 @@
   }
 
   ServerInfo(SiteConfiguration config) {
+    SingletonManager.setMode(Mode.SERVER);
     siteConfig = config;
     try {
       volumeManager = VolumeManagerImpl.get(siteConfig);
diff --git a/server/base/src/main/java/org/apache/accumulo/server/init/Initialize.java b/server/base/src/main/java/org/apache/accumulo/server/init/Initialize.java
index ac74a25bfe..632438277f 100644
--- a/server/base/src/main/java/org/apache/accumulo/server/init/Initialize.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/init/Initialize.java
@@ -81,9 +81,9 @@
 import org.apache.accumulo.fate.zookeeper.ZooUtil;
 import org.apache.accumulo.fate.zookeeper.ZooUtil.NodeExistsPolicy;
 import org.apache.accumulo.fate.zookeeper.ZooUtil.NodeMissingPolicy;
-import org.apache.accumulo.server.ServerUtil;
 import org.apache.accumulo.server.ServerConstants;
 import org.apache.accumulo.server.ServerContext;
+import org.apache.accumulo.server.ServerUtil;
 import org.apache.accumulo.server.constraints.MetadataConstraints;
 import org.apache.accumulo.server.fs.VolumeChooserEnvironment;
 import org.apache.accumulo.server.fs.VolumeChooserEnvironment.ChooserScope;
diff --git a/server/base/src/main/java/org/apache/accumulo/server/master/balancer/HostRegexTableLoadBalancer.java b/server/base/src/main/java/org/apache/accumulo/server/master/balancer/HostRegexTableLoadBalancer.java
index a8d5f8978a..3bd12f2836 100644
--- a/server/base/src/main/java/org/apache/accumulo/server/master/balancer/HostRegexTableLoadBalancer.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/master/balancer/HostRegexTableLoadBalancer.java
@@ -146,7 +146,7 @@
 
     if (newPools.get(DEFAULT_POOL) == null) {
       LOG.warn("Default pool is empty; assigning all tablet servers to the default pool");
-      SortedMap<TServerInstance, TabletServerStatus> dp = new TreeMap<>(current.comparator());
+      SortedMap<TServerInstance,TabletServerStatus> dp = new TreeMap<>(current.comparator());
       dp.putAll(current);
       newPools.put(DEFAULT_POOL, dp);
     }
diff --git a/server/master/src/main/java/org/apache/accumulo/master/Master.java b/server/master/src/main/java/org/apache/accumulo/master/Master.java
index 2732abf4be..1af85e7e88 100644
--- a/server/master/src/main/java/org/apache/accumulo/master/Master.java
+++ b/server/master/src/main/java/org/apache/accumulo/master/Master.java
@@ -96,11 +96,11 @@
 import org.apache.accumulo.master.replication.ReplicationDriver;
 import org.apache.accumulo.master.replication.WorkDriver;
 import org.apache.accumulo.master.state.TableCounts;
-import org.apache.accumulo.server.ServerUtil;
 import org.apache.accumulo.server.HighlyAvailableService;
 import org.apache.accumulo.server.ServerConstants;
 import org.apache.accumulo.server.ServerContext;
 import org.apache.accumulo.server.ServerOpts;
+import org.apache.accumulo.server.ServerUtil;
 import org.apache.accumulo.server.conf.ServerConfigurationFactory;
 import org.apache.accumulo.server.fs.VolumeChooserEnvironment;
 import org.apache.accumulo.server.fs.VolumeManager;
diff --git a/server/master/src/main/java/org/apache/accumulo/master/state/SetGoalState.java b/server/master/src/main/java/org/apache/accumulo/master/state/SetGoalState.java
index a6cd28fb7f..ca764faab0 100644
--- a/server/master/src/main/java/org/apache/accumulo/master/state/SetGoalState.java
+++ b/server/master/src/main/java/org/apache/accumulo/master/state/SetGoalState.java
@@ -22,8 +22,8 @@
 import org.apache.accumulo.core.conf.SiteConfiguration;
 import org.apache.accumulo.core.master.thrift.MasterGoalState;
 import org.apache.accumulo.fate.zookeeper.ZooUtil.NodeExistsPolicy;
-import org.apache.accumulo.server.ServerUtil;
 import org.apache.accumulo.server.ServerContext;
+import org.apache.accumulo.server.ServerUtil;
 import org.apache.accumulo.server.security.SecurityUtil;
 
 public class SetGoalState {
diff --git a/server/tracer/src/main/java/org/apache/accumulo/tracer/TraceServer.java b/server/tracer/src/main/java/org/apache/accumulo/tracer/TraceServer.java
index 6e3b5e11b4..27ea5345e5 100644
--- a/server/tracer/src/main/java/org/apache/accumulo/tracer/TraceServer.java
+++ b/server/tracer/src/main/java/org/apache/accumulo/tracer/TraceServer.java
@@ -40,7 +40,6 @@
 import org.apache.accumulo.core.client.MutationsRejectedException;
 import org.apache.accumulo.core.client.TableExistsException;
 import org.apache.accumulo.core.client.TableNotFoundException;
-import org.apache.accumulo.core.client.impl.AccumuloClientImpl;
 import org.apache.accumulo.core.client.security.tokens.AuthenticationToken;
 import org.apache.accumulo.core.client.security.tokens.AuthenticationToken.Properties;
 import org.apache.accumulo.core.client.security.tokens.KerberosToken;
@@ -52,9 +51,9 @@
 import org.apache.accumulo.core.iterators.user.AgeOffFilter;
 import org.apache.accumulo.fate.zookeeper.IZooReaderWriter;
 import org.apache.accumulo.fate.zookeeper.ZooUtil.NodeExistsPolicy;
-import org.apache.accumulo.server.ServerUtil;
 import org.apache.accumulo.server.ServerContext;
 import org.apache.accumulo.server.ServerOpts;
+import org.apache.accumulo.server.ServerUtil;
 import org.apache.accumulo.server.conf.ServerConfigurationFactory;
 import org.apache.accumulo.server.metrics.MetricsSystemHelper;
 import org.apache.accumulo.server.security.SecurityUtil;
diff --git a/test/src/main/java/org/apache/accumulo/test/ArbitraryTablePropertiesIT.java b/test/src/main/java/org/apache/accumulo/test/ArbitraryTablePropertiesIT.java
index 5a5d8b6a6e..49aaf429de 100644
--- a/test/src/main/java/org/apache/accumulo/test/ArbitraryTablePropertiesIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/ArbitraryTablePropertiesIT.java
@@ -61,48 +61,49 @@ public void setGetRemoveTablePropertyRoot() throws Exception {
 
     // make a table
     final String tableName = getUniqueNames(1)[0];
-    final AccumuloClient client = getClient();
-    client.tableOperations().create(tableName);
-
-    // Set variables for the property name to use and the initial value
-    String propertyName = "table.custom.description";
-    String description1 = "Description";
-
-    // Make sure the property name is valid
-    assertTrue(Property.isValidPropertyKey(propertyName));
-    // Set the property to the desired value
-    client.tableOperations().setProperty(tableName, propertyName, description1);
-
-    // Loop through properties to make sure the new property is added to the list
-    int count = 0;
-    for (Entry<String,String> property : client.tableOperations().getProperties(tableName)) {
-      if (property.getKey().equals(propertyName) && property.getValue().equals(description1))
-        count++;
+    try (AccumuloClient client = getClient()) {
+      client.tableOperations().create(tableName);
+
+      // Set variables for the property name to use and the initial value
+      String propertyName = "table.custom.description";
+      String description1 = "Description";
+
+      // Make sure the property name is valid
+      assertTrue(Property.isValidPropertyKey(propertyName));
+      // Set the property to the desired value
+      client.tableOperations().setProperty(tableName, propertyName, description1);
+
+      // Loop through properties to make sure the new property is added to the list
+      int count = 0;
+      for (Entry<String,String> property : client.tableOperations().getProperties(tableName)) {
+        if (property.getKey().equals(propertyName) && property.getValue().equals(description1))
+          count++;
+      }
+      assertEquals(count, 1);
+
+      // Set the property as something different
+      String description2 = "set second";
+      client.tableOperations().setProperty(tableName, propertyName, description2);
+
+      // / Loop through properties to make sure the new property is added to the list
+      count = 0;
+      for (Entry<String,String> property : client.tableOperations().getProperties(tableName)) {
+        if (property.getKey().equals(propertyName) && property.getValue().equals(description2))
+          count++;
+      }
+      assertEquals(count, 1);
+
+      // Remove the property and make sure there is no longer a value associated with it
+      client.tableOperations().removeProperty(tableName, propertyName);
+
+      // / Loop through properties to make sure the new property is added to the list
+      count = 0;
+      for (Entry<String,String> property : client.tableOperations().getProperties(tableName)) {
+        if (property.getKey().equals(propertyName))
+          count++;
+      }
+      assertEquals(count, 0);
     }
-    assertEquals(count, 1);
-
-    // Set the property as something different
-    String description2 = "set second";
-    client.tableOperations().setProperty(tableName, propertyName, description2);
-
-    // / Loop through properties to make sure the new property is added to the list
-    count = 0;
-    for (Entry<String,String> property : client.tableOperations().getProperties(tableName)) {
-      if (property.getKey().equals(propertyName) && property.getValue().equals(description2))
-        count++;
-    }
-    assertEquals(count, 1);
-
-    // Remove the property and make sure there is no longer a value associated with it
-    client.tableOperations().removeProperty(tableName, propertyName);
-
-    // / Loop through properties to make sure the new property is added to the list
-    count = 0;
-    for (Entry<String,String> property : client.tableOperations().getProperties(tableName)) {
-      if (property.getKey().equals(propertyName))
-        count++;
-    }
-    assertEquals(count, 0);
   }
 
   // Tests set, get, and remove of user added arbitrary properties using a non-root account with
@@ -119,54 +120,59 @@ public void userSetGetRemoveTablePropertyWithPermission() throws Exception {
     // Create a root user and create the table
     // Create a test user and grant that user permission to alter the table
     final String tableName = getUniqueNames(1)[0];
-    final AccumuloClient c = getClient();
-    c.securityOperations().createLocalUser(testUser,
-        (testToken instanceof PasswordToken ? (PasswordToken) testToken : null));
-    c.tableOperations().create(tableName);
-    c.securityOperations().grantTablePermission(testUser, tableName, TablePermission.ALTER_TABLE);
-
-    // Set variables for the property name to use and the initial value
-    String propertyName = "table.custom.description";
-    String description1 = "Description";
-
-    // Make sure the property name is valid
-    assertTrue(Property.isValidPropertyKey(propertyName));
-
-    // Getting a fresh token will ensure we're logged in as this user (if necessary)
-    AccumuloClient testclient = c.changeUser(testUser, user.getToken());
-    // Set the property to the desired value
-    testclient.tableOperations().setProperty(tableName, propertyName, description1);
-
-    // Loop through properties to make sure the new property is added to the list
-    int count = 0;
-    for (Entry<String,String> property : testclient.tableOperations().getProperties(tableName)) {
-      if (property.getKey().equals(propertyName) && property.getValue().equals(description1))
-        count++;
-    }
-    assertEquals(count, 1);
-
-    // Set the property as something different
-    String description2 = "set second";
-    testclient.tableOperations().setProperty(tableName, propertyName, description2);
-
-    // / Loop through properties to make sure the new property is added to the list
-    count = 0;
-    for (Entry<String,String> property : testclient.tableOperations().getProperties(tableName)) {
-      if (property.getKey().equals(propertyName) && property.getValue().equals(description2))
-        count++;
-    }
-    assertEquals(count, 1);
-
-    // Remove the property and make sure there is no longer a value associated with it
-    testclient.tableOperations().removeProperty(tableName, propertyName);
-
-    // / Loop through properties to make sure the new property is added to the list
-    count = 0;
-    for (Entry<String,String> property : testclient.tableOperations().getProperties(tableName)) {
-      if (property.getKey().equals(propertyName))
-        count++;
+    try (AccumuloClient c = getClient()) {
+      c.securityOperations().createLocalUser(testUser,
+          (testToken instanceof PasswordToken ? (PasswordToken) testToken : null));
+      c.tableOperations().create(tableName);
+      c.securityOperations().grantTablePermission(testUser, tableName, TablePermission.ALTER_TABLE);
+
+      // Set variables for the property name to use and the initial value
+      String propertyName = "table.custom.description";
+      String description1 = "Description";
+
+      // Make sure the property name is valid
+      assertTrue(Property.isValidPropertyKey(propertyName));
+
+      // Getting a fresh token will ensure we're logged in as this user (if necessary)
+      try (AccumuloClient testclient = c.changeUser(testUser, user.getToken())) {
+        // Set the property to the desired value
+        testclient.tableOperations().setProperty(tableName, propertyName, description1);
+
+        // Loop through properties to make sure the new property is added to the list
+        int count = 0;
+        for (Entry<String,String> property : testclient.tableOperations()
+            .getProperties(tableName)) {
+          if (property.getKey().equals(propertyName) && property.getValue().equals(description1))
+            count++;
+        }
+        assertEquals(count, 1);
+
+        // Set the property as something different
+        String description2 = "set second";
+        testclient.tableOperations().setProperty(tableName, propertyName, description2);
+
+        // / Loop through properties to make sure the new property is added to the list
+        count = 0;
+        for (Entry<String,String> property : testclient.tableOperations()
+            .getProperties(tableName)) {
+          if (property.getKey().equals(propertyName) && property.getValue().equals(description2))
+            count++;
+        }
+        assertEquals(count, 1);
+
+        // Remove the property and make sure there is no longer a value associated with it
+        testclient.tableOperations().removeProperty(tableName, propertyName);
+
+        // / Loop through properties to make sure the new property is added to the list
+        count = 0;
+        for (Entry<String,String> property : testclient.tableOperations()
+            .getProperties(tableName)) {
+          if (property.getKey().equals(propertyName))
+            count++;
+        }
+        assertEquals(count, 0);
+      }
     }
-    assertEquals(count, 0);
 
   }
 
@@ -184,34 +190,37 @@ public void userSetGetTablePropertyWithoutPermission() throws Exception {
     // Create a root user and create the table
     // Create a test user and grant that user permission to alter the table
     final String tableName = getUniqueNames(1)[0];
-    final AccumuloClient c = getClient();
-    c.securityOperations().createLocalUser(testUser,
-        (testToken instanceof PasswordToken ? (PasswordToken) testToken : null));
-    c.tableOperations().create(tableName);
-
-    // Set variables for the property name to use and the initial value
-    String propertyName = "table.custom.description";
-    String description1 = "Description";
-
-    // Make sure the property name is valid
-    assertTrue(Property.isValidPropertyKey(propertyName));
-
-    // Getting a fresh token will ensure we're logged in as this user (if necessary)
-    AccumuloClient testclient = c.changeUser(testUser, user.getToken());
-
-    // Try to set the property to the desired value.
-    // If able to set it, the test fails, since permission was never granted
-    try {
-      testclient.tableOperations().setProperty(tableName, propertyName, description1);
-      fail("Was able to set property without permissions");
-    } catch (AccumuloSecurityException e) {}
-
-    // Loop through properties to make sure the new property is not added to the list
-    int count = 0;
-    for (Entry<String,String> property : testclient.tableOperations().getProperties(tableName)) {
-      if (property.getKey().equals(propertyName))
-        count++;
+    try (AccumuloClient c = getClient()) {
+      c.securityOperations().createLocalUser(testUser,
+          (testToken instanceof PasswordToken ? (PasswordToken) testToken : null));
+      c.tableOperations().create(tableName);
+
+      // Set variables for the property name to use and the initial value
+      String propertyName = "table.custom.description";
+      String description1 = "Description";
+
+      // Make sure the property name is valid
+      assertTrue(Property.isValidPropertyKey(propertyName));
+
+      // Getting a fresh token will ensure we're logged in as this user (if necessary)
+      try (AccumuloClient testclient = c.changeUser(testUser, user.getToken())) {
+
+        // Try to set the property to the desired value.
+        // If able to set it, the test fails, since permission was never granted
+        try {
+          testclient.tableOperations().setProperty(tableName, propertyName, description1);
+          fail("Was able to set property without permissions");
+        } catch (AccumuloSecurityException e) {}
+
+        // Loop through properties to make sure the new property is not added to the list
+        int count = 0;
+        for (Entry<String,String> property : testclient.tableOperations()
+            .getProperties(tableName)) {
+          if (property.getKey().equals(propertyName))
+            count++;
+        }
+        assertEquals(count, 0);
+      }
     }
-    assertEquals(count, 0);
   }
 }
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 18c7037e68..30fd6240cb 100644
--- a/test/src/main/java/org/apache/accumulo/test/AuditMessageIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/AuditMessageIT.java
@@ -176,7 +176,12 @@ public void resetInstance() throws Exception {
   }
 
   @After
-  public void removeUsersAndTables() throws Exception {
+  public void cleanUp() throws Exception {
+    removeUsersAndTables();
+    client.close();
+  }
+
+  private void removeUsersAndTables() throws Exception {
     for (String user : Arrays.asList(AUDIT_USER_1, AUDIT_USER_2)) {
       if (client.securityOperations().listLocalUsers().contains(user)) {
         client.securityOperations().dropLocalUser(user);
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 480f1ea5f4..846b555fc8 100644
--- a/test/src/main/java/org/apache/accumulo/test/BadDeleteMarkersCreatedIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/BadDeleteMarkersCreatedIT.java
@@ -85,97 +85,102 @@ public void getTimeoutFactor() {
 
   @Before
   public void alterConfig() throws Exception {
-    InstanceOperations iops = getAccumuloClient().instanceOperations();
-    Map<String,String> config = iops.getSystemConfiguration();
-    gcCycleDelay = config.get(Property.GC_CYCLE_DELAY.getKey());
-    gcCycleStart = config.get(Property.GC_CYCLE_START.getKey());
-    iops.setProperty(Property.GC_CYCLE_DELAY.getKey(), "1s");
-    iops.setProperty(Property.GC_CYCLE_START.getKey(), "0s");
-    log.info("Restarting garbage collector");
-
+    try (AccumuloClient client = getAccumuloClient()) {
+      InstanceOperations iops = client.instanceOperations();
+      Map<String,String> config = iops.getSystemConfiguration();
+      gcCycleDelay = config.get(Property.GC_CYCLE_DELAY.getKey());
+      gcCycleStart = config.get(Property.GC_CYCLE_START.getKey());
+      iops.setProperty(Property.GC_CYCLE_DELAY.getKey(), "1s");
+      iops.setProperty(Property.GC_CYCLE_START.getKey(), "0s");
+      log.info("Restarting garbage collector");
+    }
     getCluster().getClusterControl().stopAllServers(ServerType.GARBAGE_COLLECTOR);
 
-    AccumuloClient client = getAccumuloClient();
-    ClientInfo info = client.info();
-    ZooCache zcache = new ZooCache(info.getZooKeepers(), info.getZooKeepersSessionTimeOut());
-    zcache.clear();
-    String path = ZooUtil.getRoot(client.getInstanceID()) + Constants.ZGC_LOCK;
-    byte[] gcLockData;
-    do {
-      gcLockData = ZooLock.getLockData(zcache, path, null);
-      if (null != gcLockData) {
-        log.info("Waiting for GC ZooKeeper lock to expire");
-        Thread.sleep(2000);
-      }
-    } while (null != gcLockData);
+    try (AccumuloClient client = getAccumuloClient()) {
+      ClientInfo info = client.info();
+      ZooCache zcache = new ZooCache(info.getZooKeepers(), info.getZooKeepersSessionTimeOut());
+      zcache.clear();
+      String path = ZooUtil.getRoot(client.getInstanceID()) + Constants.ZGC_LOCK;
+      byte[] gcLockData;
+      do {
+        gcLockData = ZooLock.getLockData(zcache, path, null);
+        if (null != gcLockData) {
+          log.info("Waiting for GC ZooKeeper lock to expire");
+          Thread.sleep(2000);
+        }
+      } while (null != gcLockData);
 
-    log.info("GC lock was lost");
+      log.info("GC lock was lost");
 
-    getCluster().getClusterControl().startAllServers(ServerType.GARBAGE_COLLECTOR);
-    log.info("Garbage collector was restarted");
+      getCluster().getClusterControl().startAllServers(ServerType.GARBAGE_COLLECTOR);
+      log.info("Garbage collector was restarted");
 
-    gcLockData = null;
-    do {
-      gcLockData = ZooLock.getLockData(zcache, path, null);
-      if (null == gcLockData) {
-        log.info("Waiting for GC ZooKeeper lock to be acquired");
-        Thread.sleep(2000);
-      }
-    } while (null == gcLockData);
+      gcLockData = null;
+      do {
+        gcLockData = ZooLock.getLockData(zcache, path, null);
+        if (null == gcLockData) {
+          log.info("Waiting for GC ZooKeeper lock to be acquired");
+          Thread.sleep(2000);
+        }
+      } while (null == gcLockData);
 
-    log.info("GC lock was acquired");
+      log.info("GC lock was acquired");
+    }
   }
 
   @After
   public void restoreConfig() throws Exception {
-    InstanceOperations iops = getAccumuloClient().instanceOperations();
-    if (null != gcCycleDelay) {
-      iops.setProperty(Property.GC_CYCLE_DELAY.getKey(), gcCycleDelay);
-    }
-    if (null != gcCycleStart) {
-      iops.setProperty(Property.GC_CYCLE_START.getKey(), gcCycleStart);
+    try (AccumuloClient c = getAccumuloClient()) {
+      InstanceOperations iops = c.instanceOperations();
+      if (null != gcCycleDelay) {
+        iops.setProperty(Property.GC_CYCLE_DELAY.getKey(), gcCycleDelay);
+      }
+      if (null != gcCycleStart) {
+        iops.setProperty(Property.GC_CYCLE_START.getKey(), gcCycleStart);
+      }
+      log.info("Restarting garbage collector");
+      getCluster().getClusterControl().stopAllServers(ServerType.GARBAGE_COLLECTOR);
+      getCluster().getClusterControl().startAllServers(ServerType.GARBAGE_COLLECTOR);
+      log.info("Garbage collector was restarted");
     }
-    log.info("Restarting garbage collector");
-    getCluster().getClusterControl().stopAllServers(ServerType.GARBAGE_COLLECTOR);
-    getCluster().getClusterControl().startAllServers(ServerType.GARBAGE_COLLECTOR);
-    log.info("Garbage collector was restarted");
   }
 
   @Test
   public void test() throws Exception {
     // make a table
     String tableName = getUniqueNames(1)[0];
-    AccumuloClient c = getAccumuloClient();
-    log.info("Creating table to be deleted");
-    c.tableOperations().create(tableName);
-    final String tableId = c.tableOperations().tableIdMap().get(tableName);
-    assertNotNull("Expected to find a tableId", tableId);
-
-    // add some splits
-    SortedSet<Text> splits = new TreeSet<>();
-    for (int i = 0; i < 10; i++) {
-      splits.add(new Text("" + i));
-    }
-    c.tableOperations().addSplits(tableName, splits);
-    // get rid of all the splits
-    c.tableOperations().deleteRows(tableName, null, null);
-    // get rid of the table
-    c.tableOperations().delete(tableName);
-    log.info("Sleeping to let garbage collector run");
-    // let gc run
-    sleepUninterruptibly(timeoutFactor * 15, TimeUnit.SECONDS);
-    log.info("Verifying that delete markers were deleted");
-    // look for delete markers
-    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;
+    try (AccumuloClient c = getAccumuloClient()) {
+      log.info("Creating table to be deleted");
+      c.tableOperations().create(tableName);
+      final String tableId = c.tableOperations().tableIdMap().get(tableName);
+      assertNotNull("Expected to find a tableId", tableId);
+
+      // add some splits
+      SortedSet<Text> splits = new TreeSet<>();
+      for (int i = 0; i < 10; i++) {
+        splits.add(new Text("" + i));
+      }
+      c.tableOperations().addSplits(tableName, splits);
+      // get rid of all the splits
+      c.tableOperations().deleteRows(tableName, null, null);
+      // get rid of the table
+      c.tableOperations().delete(tableName);
+      log.info("Sleeping to let garbage collector run");
+      // let gc run
+      sleepUninterruptibly(timeoutFactor * 15, TimeUnit.SECONDS);
+      log.info("Verifying that delete markers were deleted");
+      // look for delete markers
+      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;
+          }
+          fail("Delete entry should have been deleted by the garbage collector: "
+              + entry.getKey().getRow());
         }
-        fail("Delete entry should have been deleted by the garbage collector: "
-            + entry.getKey().getRow());
       }
     }
   }
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 e4b792ec5f..df25f9572c 100644
--- a/test/src/main/java/org/apache/accumulo/test/BalanceFasterIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/BalanceFasterIT.java
@@ -65,47 +65,48 @@ public static void checkMR() {
   public void test() throws Exception {
     // create a table, add a bunch of splits
     String tableName = getUniqueNames(1)[0];
-    AccumuloClient client = getClient();
-    client.tableOperations().create(tableName);
-    SortedSet<Text> splits = new TreeSet<>();
-    for (int i = 0; i < 1000; i++) {
-      splits.add(new Text("" + i));
-    }
-    client.tableOperations().addSplits(tableName, splits);
-    // give a short wait for balancing
-    sleepUninterruptibly(10, TimeUnit.SECONDS);
-    // find out where the tablets are
-    Iterator<Integer> i;
-    try (Scanner s = client.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++;
+    try (AccumuloClient client = getClient()) {
+      client.tableOperations().create(tableName);
+      SortedSet<Text> splits = new TreeSet<>();
+      for (int i = 0; i < 1000; i++) {
+        splits.add(new Text("" + i));
+      }
+      client.tableOperations().addSplits(tableName, splits);
+      // give a short wait for balancing
+      sleepUninterruptibly(10, TimeUnit.SECONDS);
+      // find out where the tablets are
+      Iterator<Integer> i;
+      try (Scanner s = client.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
+        assertEquals(3, counts.size());
+        // and distributed evenly
+        i = counts.values().iterator();
       }
 
-      // should be on all three servers
-      assertEquals(3, counts.size());
-      // and distributed evenly
-      i = counts.values().iterator();
+      int a = i.next();
+      int b = i.next();
+      int c = i.next();
+      assertTrue(Math.abs(a - b) < 3);
+      assertTrue(Math.abs(a - c) < 3);
+      assertTrue(a > 330);
     }
-
-    int a = i.next();
-    int b = i.next();
-    int c = i.next();
-    assertTrue(Math.abs(a - b) < 3);
-    assertTrue(Math.abs(a - c) < 3);
-    assertTrue(a > 330);
   }
 }
diff --git a/test/src/main/java/org/apache/accumulo/test/BalanceIT.java b/test/src/main/java/org/apache/accumulo/test/BalanceIT.java
index 01ae578511..765b0584b4 100644
--- a/test/src/main/java/org/apache/accumulo/test/BalanceIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/BalanceIT.java
@@ -37,16 +37,17 @@ public int defaultTimeoutSeconds() {
   @Test
   public void testBalance() throws Exception {
     String tableName = getUniqueNames(1)[0];
-    AccumuloClient c = getAccumuloClient();
-    log.info("Creating table");
-    c.tableOperations().create(tableName);
-    SortedSet<Text> splits = new TreeSet<>();
-    for (int i = 0; i < 10; i++) {
-      splits.add(new Text("" + i));
+    try (AccumuloClient c = getAccumuloClient()) {
+      log.info("Creating table");
+      c.tableOperations().create(tableName);
+      SortedSet<Text> splits = new TreeSet<>();
+      for (int i = 0; i < 10; i++) {
+        splits.add(new Text("" + i));
+      }
+      log.info("Adding splits");
+      c.tableOperations().addSplits(tableName, splits);
+      log.info("Waiting for balance");
+      c.instanceOperations().waitForBalance();
     }
-    log.info("Adding splits");
-    c.tableOperations().addSplits(tableName, splits);
-    log.info("Waiting for balance");
-    c.instanceOperations().waitForBalance();
   }
 }
diff --git a/test/src/main/java/org/apache/accumulo/test/BalanceWithOfflineTableIT.java b/test/src/main/java/org/apache/accumulo/test/BalanceWithOfflineTableIT.java
index f29c49b679..6130beedaf 100644
--- a/test/src/main/java/org/apache/accumulo/test/BalanceWithOfflineTableIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/BalanceWithOfflineTableIT.java
@@ -46,40 +46,41 @@ public void test() throws Exception {
     final String tableName = tableNames[0];
     // create a table with a bunch of splits
 
-    final AccumuloClient c = getClient();
-    log.info("Creating table {}", tableName);
-    c.tableOperations().create(tableName);
-    final SortedSet<Text> splits = new TreeSet<>();
-    for (String split : "a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z".split(",")) {
-      splits.add(new Text(split));
-    }
-    log.info("Splitting table {}", tableName);
-    c.tableOperations().addSplits(tableName, splits);
-    log.info("Balancing");
-    c.instanceOperations().waitForBalance();
-    log.info("Balanced");
+    try (AccumuloClient c = getClient()) {
+      log.info("Creating table {}", tableName);
+      c.tableOperations().create(tableName);
+      final SortedSet<Text> splits = new TreeSet<>();
+      for (String split : "a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z".split(",")) {
+        splits.add(new Text(split));
+      }
+      log.info("Splitting table {}", tableName);
+      c.tableOperations().addSplits(tableName, splits);
+      log.info("Balancing");
+      c.instanceOperations().waitForBalance();
+      log.info("Balanced");
 
-    // create a new table which will unbalance the cluster
-    final String table2 = tableNames[1];
-    log.info("Creating table {}", table2);
-    c.tableOperations().create(table2);
-    log.info("Creating splits {}", table2);
-    c.tableOperations().addSplits(table2, splits);
+      // create a new table which will unbalance the cluster
+      final String table2 = tableNames[1];
+      log.info("Creating table {}", table2);
+      c.tableOperations().create(table2);
+      log.info("Creating splits {}", table2);
+      c.tableOperations().addSplits(table2, splits);
 
-    // offline the table, hopefully while there are some migrations going on
-    log.info("Offlining {}", table2);
-    c.tableOperations().offline(table2, true);
-    log.info("Offlined {}", table2);
+      // offline the table, hopefully while there are some migrations going on
+      log.info("Offlining {}", table2);
+      c.tableOperations().offline(table2, true);
+      log.info("Offlined {}", table2);
 
-    log.info("Waiting for balance");
+      log.info("Waiting for balance");
 
-    SimpleThreadPool pool = new SimpleThreadPool(1, "waitForBalance");
-    Future<Boolean> wait = pool.submit(() -> {
-      c.instanceOperations().waitForBalance();
-      return true;
-    });
-    wait.get(20, TimeUnit.SECONDS);
-    log.info("Balance succeeded with an offline table");
+      SimpleThreadPool pool = new SimpleThreadPool(1, "waitForBalance");
+      Future<Boolean> wait = pool.submit(() -> {
+        c.instanceOperations().waitForBalance();
+        return true;
+      });
+      wait.get(20, TimeUnit.SECONDS);
+      log.info("Balance succeeded with an offline table");
+    }
   }
 
 }
diff --git a/test/src/main/java/org/apache/accumulo/test/BatchWriterIT.java b/test/src/main/java/org/apache/accumulo/test/BatchWriterIT.java
index 75fd9398bb..d89d734dac 100644
--- a/test/src/main/java/org/apache/accumulo/test/BatchWriterIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/BatchWriterIT.java
@@ -35,15 +35,16 @@ public int defaultTimeoutSeconds() {
   public void test() throws Exception {
     // call the batchwriter with buffer of size zero
     String table = getUniqueNames(1)[0];
-    AccumuloClient c = getAccumuloClient();
-    c.tableOperations().create(table);
-    BatchWriterConfig config = new BatchWriterConfig();
-    config.setMaxMemory(0);
-    BatchWriter writer = c.createBatchWriter(table, config);
-    Mutation m = new Mutation("row");
-    m.put("cf", "cq", new Value("value".getBytes()));
-    writer.addMutation(m);
-    writer.close();
+    try (AccumuloClient c = getAccumuloClient()) {
+      c.tableOperations().create(table);
+      BatchWriterConfig config = new BatchWriterConfig();
+      config.setMaxMemory(0);
+      try (BatchWriter writer = c.createBatchWriter(table, config)) {
+        Mutation m = new Mutation("row");
+        m.put("cf", "cq", new Value("value".getBytes()));
+        writer.addMutation(m);
+      }
+    }
   }
 
 }
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 c7bebf9bde..7b01bff2bb 100644
--- a/test/src/main/java/org/apache/accumulo/test/BatchWriterInTabletServerIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/BatchWriterInTabletServerIT.java
@@ -60,11 +60,12 @@ public boolean canRunTest(ClusterType type) {
   public void testNormalWrite() throws Exception {
     String[] uniqueNames = getUniqueNames(2);
     String t1 = uniqueNames[0], t2 = uniqueNames[1];
-    AccumuloClient c = getAccumuloClient();
-    int numEntriesToWritePerEntry = 50;
-    IteratorSetting itset = BatchWriterIterator.iteratorSetting(6, 0, 15, 1000,
-        numEntriesToWritePerEntry, t2, c, getAdminToken(), false, false);
-    test(t1, t2, c, itset, numEntriesToWritePerEntry);
+    try (AccumuloClient c = getAccumuloClient()) {
+      int numEntriesToWritePerEntry = 50;
+      IteratorSetting itset = BatchWriterIterator.iteratorSetting(6, 0, 15, 1000,
+          numEntriesToWritePerEntry, t2, c, getAdminToken(), false, false);
+      test(t1, t2, c, itset, numEntriesToWritePerEntry);
+    }
   }
 
   /**
@@ -79,11 +80,12 @@ public void testNormalWrite() throws Exception {
   public void testClearLocatorAndSplitWrite() throws Exception {
     String[] uniqueNames = getUniqueNames(2);
     String t1 = uniqueNames[0], t2 = uniqueNames[1];
-    AccumuloClient c = getAccumuloClient();
-    int numEntriesToWritePerEntry = 50;
-    IteratorSetting itset = BatchWriterIterator.iteratorSetting(6, 0, 15, 1000,
-        numEntriesToWritePerEntry, t2, c, getAdminToken(), true, true);
-    test(t1, t2, c, itset, numEntriesToWritePerEntry);
+    try (AccumuloClient c = getAccumuloClient()) {
+      int numEntriesToWritePerEntry = 50;
+      IteratorSetting itset = BatchWriterIterator.iteratorSetting(6, 0, 15, 1000,
+          numEntriesToWritePerEntry, t2, c, getAdminToken(), true, true);
+      test(t1, t2, c, itset, numEntriesToWritePerEntry);
+    }
   }
 
   private void test(String t1, String t2, AccumuloClient c, IteratorSetting itset,
diff --git a/test/src/main/java/org/apache/accumulo/test/BulkImportMonitoringIT.java b/test/src/main/java/org/apache/accumulo/test/BulkImportMonitoringIT.java
index 77677c570f..beda0a3e4a 100644
--- a/test/src/main/java/org/apache/accumulo/test/BulkImportMonitoringIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/BulkImportMonitoringIT.java
@@ -61,83 +61,84 @@ protected void configure(MiniAccumuloConfigImpl cfg, Configuration hadoopCoreSit
   @Test
   public void test() throws Exception {
     getCluster().getClusterControl().start(ServerType.MONITOR);
-    final AccumuloClient c = getClient();
-    final String tableName = getUniqueNames(1)[0];
-    c.tableOperations().create(tableName);
-    c.tableOperations().setProperty(tableName, Property.TABLE_MAJC_RATIO.getKey(), "1");
-    // splits to slow down bulk import
-    SortedSet<Text> splits = new TreeSet<>();
-    for (int i = 1; i < 0xf; i++) {
-      splits.add(new Text(Integer.toHexString(i)));
-    }
-    c.tableOperations().addSplits(tableName, splits);
+    try (AccumuloClient c = getClient()) {
+      final String tableName = getUniqueNames(1)[0];
+      c.tableOperations().create(tableName);
+      c.tableOperations().setProperty(tableName, Property.TABLE_MAJC_RATIO.getKey(), "1");
+      // splits to slow down bulk import
+      SortedSet<Text> splits = new TreeSet<>();
+      for (int i = 1; i < 0xf; i++) {
+        splits.add(new Text(Integer.toHexString(i)));
+      }
+      c.tableOperations().addSplits(tableName, splits);
 
-    MasterMonitorInfo stats = getCluster().getMasterMonitorInfo();
-    assertEquals(1, stats.tServerInfo.size());
-    assertEquals(0, stats.bulkImports.size());
-    assertEquals(0, stats.tServerInfo.get(0).bulkImports.size());
+      MasterMonitorInfo stats = getCluster().getMasterMonitorInfo();
+      assertEquals(1, stats.tServerInfo.size());
+      assertEquals(0, stats.bulkImports.size());
+      assertEquals(0, stats.tServerInfo.get(0).bulkImports.size());
 
-    log.info("Creating lots of bulk import files");
-    final FileSystem fs = getCluster().getFileSystem();
-    final Path basePath = getCluster().getTemporaryPath();
-    CachedConfiguration.setInstance(fs.getConf());
+      log.info("Creating lots of bulk import files");
+      final FileSystem fs = getCluster().getFileSystem();
+      final Path basePath = getCluster().getTemporaryPath();
+      CachedConfiguration.setInstance(fs.getConf());
 
-    final Path base = new Path(basePath, "testBulkLoad" + tableName);
-    fs.delete(base, true);
-    fs.mkdirs(base);
+      final Path base = new Path(basePath, "testBulkLoad" + tableName);
+      fs.delete(base, true);
+      fs.mkdirs(base);
 
-    ExecutorService es = Executors.newFixedThreadPool(5);
-    List<Future<Pair<String,String>>> futures = new ArrayList<>();
-    for (int i = 0; i < 10; i++) {
-      final int which = i;
-      futures.add(es.submit(() -> {
-        Path bulkFailures = new Path(base, "failures" + which);
-        Path files = new Path(base, "files" + which);
-        fs.mkdirs(bulkFailures);
-        fs.mkdirs(files);
-        for (int i1 = 0; i1 < 10; i1++) {
-          FileSKVWriter writer = FileOperations.getInstance().newWriterBuilder()
-              .forFile(files + "/bulk_" + i1 + "." + RFile.EXTENSION, fs, fs.getConf())
-              .withTableConfiguration(DefaultConfiguration.getInstance()).build();
-          writer.startDefaultLocalityGroup();
-          for (int j = 0x100; j < 0xfff; j += 3) {
-            writer.append(new Key(Integer.toHexString(j)), new Value(new byte[0]));
+      ExecutorService es = Executors.newFixedThreadPool(5);
+      List<Future<Pair<String,String>>> futures = new ArrayList<>();
+      for (int i = 0; i < 10; i++) {
+        final int which = i;
+        futures.add(es.submit(() -> {
+          Path bulkFailures = new Path(base, "failures" + which);
+          Path files = new Path(base, "files" + which);
+          fs.mkdirs(bulkFailures);
+          fs.mkdirs(files);
+          for (int i1 = 0; i1 < 10; i1++) {
+            FileSKVWriter writer = FileOperations.getInstance().newWriterBuilder()
+                .forFile(files + "/bulk_" + i1 + "." + RFile.EXTENSION, fs, fs.getConf())
+                .withTableConfiguration(DefaultConfiguration.getInstance()).build();
+            writer.startDefaultLocalityGroup();
+            for (int j = 0x100; j < 0xfff; j += 3) {
+              writer.append(new Key(Integer.toHexString(j)), new Value(new byte[0]));
+            }
+            writer.close();
           }
-          writer.close();
-        }
-        return new Pair<>(files.toString(), bulkFailures.toString());
-      }));
-    }
-    List<Pair<String,String>> dirs = new ArrayList<>();
-    for (Future<Pair<String,String>> f : futures) {
-      dirs.add(f.get());
-    }
-    log.info("Importing");
-    long now = System.currentTimeMillis();
-    List<Future<Object>> errs = new ArrayList<>();
-    for (Pair<String,String> entry : dirs) {
-      final String dir = entry.getFirst();
-      final String err = entry.getSecond();
-      errs.add(es.submit(() -> {
-        c.tableOperations().importDirectory(tableName, dir, err, false);
-        return null;
-      }));
-    }
-    es.shutdown();
-    while (!es.isTerminated()
-        && stats.bulkImports.size() + stats.tServerInfo.get(0).bulkImports.size() == 0) {
-      es.awaitTermination(10, TimeUnit.MILLISECONDS);
-      stats = getCluster().getMasterMonitorInfo();
-    }
-    log.info(stats.bulkImports.toString());
-    assertTrue(stats.bulkImports.size() > 0);
-    // look for exception
-    for (Future<Object> err : errs) {
-      err.get();
+          return new Pair<>(files.toString(), bulkFailures.toString());
+        }));
+      }
+      List<Pair<String,String>> dirs = new ArrayList<>();
+      for (Future<Pair<String,String>> f : futures) {
+        dirs.add(f.get());
+      }
+      log.info("Importing");
+      long now = System.currentTimeMillis();
+      List<Future<Object>> errs = new ArrayList<>();
+      for (Pair<String,String> entry : dirs) {
+        final String dir = entry.getFirst();
+        final String err = entry.getSecond();
+        errs.add(es.submit(() -> {
+          c.tableOperations().importDirectory(tableName, dir, err, false);
+          return null;
+        }));
+      }
+      es.shutdown();
+      while (!es.isTerminated()
+          && stats.bulkImports.size() + stats.tServerInfo.get(0).bulkImports.size() == 0) {
+        es.awaitTermination(10, TimeUnit.MILLISECONDS);
+        stats = getCluster().getMasterMonitorInfo();
+      }
+      log.info(stats.bulkImports.toString());
+      assertTrue(stats.bulkImports.size() > 0);
+      // look for exception
+      for (Future<Object> err : errs) {
+        err.get();
+      }
+      es.awaitTermination(2, TimeUnit.MINUTES);
+      assertTrue(es.isTerminated());
+      log.info(
+          String.format("Completed in %.2f seconds", (System.currentTimeMillis() - now) / 1000.));
     }
-    es.awaitTermination(2, TimeUnit.MINUTES);
-    assertTrue(es.isTerminated());
-    log.info(
-        String.format("Completed in %.2f seconds", (System.currentTimeMillis() - now) / 1000.));
   }
 }
diff --git a/test/src/main/java/org/apache/accumulo/test/BulkImportSequentialRowsIT.java b/test/src/main/java/org/apache/accumulo/test/BulkImportSequentialRowsIT.java
index 377e89a76d..4d01ad8d99 100644
--- a/test/src/main/java/org/apache/accumulo/test/BulkImportSequentialRowsIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/BulkImportSequentialRowsIT.java
@@ -21,6 +21,7 @@
 
 import java.util.TreeSet;
 
+import org.apache.accumulo.core.client.AccumuloClient;
 import org.apache.accumulo.core.client.admin.TableOperations;
 import org.apache.accumulo.core.security.Authorizations;
 import org.apache.accumulo.harness.AccumuloClusterHarness;
@@ -61,46 +62,48 @@ public void configureMiniCluster(MiniAccumuloConfigImpl cfg, Configuration hadoo
   @Test
   public void testBulkImportFailure() throws Exception {
     String tableName = getUniqueNames(1)[0];
-    TableOperations to = getAccumuloClient().tableOperations();
-    to.create(tableName);
-    FileSystem fs = getFileSystem();
-    Path rootPath = new Path(fs.makeQualified(getUsableDir()), getClass().getSimpleName());
-    log.info("Writing to {}", rootPath);
-    if (fs.exists(rootPath)) {
-      assertTrue(fs.delete(rootPath, true));
-    }
-    assertTrue(fs.mkdirs(rootPath));
+    try (AccumuloClient client = getAccumuloClient()) {
+      TableOperations to = client.tableOperations();
+      to.create(tableName);
+      FileSystem fs = getFileSystem();
+      Path rootPath = new Path(fs.makeQualified(getUsableDir()), getClass().getSimpleName());
+      log.info("Writing to {}", rootPath);
+      if (fs.exists(rootPath)) {
+        assertTrue(fs.delete(rootPath, true));
+      }
+      assertTrue(fs.mkdirs(rootPath));
 
-    Path bulk = new Path(rootPath, "bulk");
-    log.info("bulk: {}", bulk);
-    assertTrue(fs.mkdirs(bulk));
+      Path bulk = new Path(rootPath, "bulk");
+      log.info("bulk: {}", bulk);
+      assertTrue(fs.mkdirs(bulk));
 
-    assertTrue(fs.mkdirs(bulk));
+      assertTrue(fs.mkdirs(bulk));
 
-    Path rfile = new Path(bulk, "file.rf");
+      Path rfile = new Path(bulk, "file.rf");
 
-    log.info("Generating RFile {}", rfile.toUri());
+      log.info("Generating RFile {}", rfile.toUri());
 
-    GenerateSequentialRFile.main(new String[] {"-f", rfile.toUri().toString(), "-nr",
-        Long.toString(NR), "-nv", Long.toString(NV)});
+      GenerateSequentialRFile.main(new String[] {"-f", rfile.toUri().toString(), "-nr",
+          Long.toString(NR), "-nv", Long.toString(NV)});
 
-    assertTrue("Expected that " + rfile + " exists, but it does not", fs.exists(rfile));
+      assertTrue("Expected that " + rfile + " exists, but it does not", fs.exists(rfile));
 
-    FsShell fsShell = new FsShell(fs.getConf());
-    assertEquals("Failed to chmod " + rootPath, 0,
-        fsShell.run(new String[] {"-chmod", "-R", "777", rootPath.toString()}));
+      FsShell fsShell = new FsShell(fs.getConf());
+      assertEquals("Failed to chmod " + rootPath, 0,
+          fsShell.run(new String[] {"-chmod", "-R", "777", rootPath.toString()}));
 
-    // Add some splits
-    to.addSplits(tableName, getSplits());
+      // Add some splits
+      to.addSplits(tableName, getSplits());
 
-    // Then import a single rfile to all the tablets, hoping that we get a failure to import because
-    // of the balancer moving tablets around
-    // and then we get to verify that the bug is actually fixed.
-    to.importDirectory(bulk.toString()).to(tableName).load();
+      // Then import a single rfile to all the tablets, hoping that we get a failure to import
+      // because
+      // of the balancer moving tablets around
+      // and then we get to verify that the bug is actually fixed.
+      to.importDirectory(bulk.toString()).to(tableName).load();
 
-    // The bug is that some tablets don't get imported into.
-    assertEquals(NR * NV,
-        Iterables.size(getAccumuloClient().createScanner(tableName, Authorizations.EMPTY)));
+      // The bug is that some tablets don't get imported into.
+      assertEquals(NR * NV, Iterables.size(client.createScanner(tableName, Authorizations.EMPTY)));
+    }
   }
 
   private TreeSet<Text> getSplits() {
diff --git a/test/src/main/java/org/apache/accumulo/test/BulkImportVolumeIT.java b/test/src/main/java/org/apache/accumulo/test/BulkImportVolumeIT.java
index e1fec0874a..70e0f542df 100644
--- a/test/src/main/java/org/apache/accumulo/test/BulkImportVolumeIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/BulkImportVolumeIT.java
@@ -21,7 +21,7 @@
 
 import java.io.File;
 
-import org.apache.accumulo.core.client.admin.TableOperations;
+import org.apache.accumulo.core.client.AccumuloClient;
 import org.apache.accumulo.core.conf.Property;
 import org.apache.accumulo.harness.AccumuloClusterHarness;
 import org.apache.accumulo.minicluster.impl.MiniAccumuloConfigImpl;
@@ -66,29 +66,30 @@ public void configureMiniCluster(MiniAccumuloConfigImpl cfg, Configuration hadoo
   @Test
   public void testBulkImportFailure() throws Exception {
     String tableName = getUniqueNames(1)[0];
-    TableOperations to = getAccumuloClient().tableOperations();
-    to.create(tableName);
-    FileSystem fs = getFileSystem();
-    Path rootPath = new Path(cluster.getTemporaryPath(), getClass().getName());
-    Path bulk = new Path(rootPath, "bulk");
-    log.info("bulk: {}", bulk);
-    if (fs.exists(bulk)) {
-      fs.delete(bulk, true);
+    try (AccumuloClient client = getAccumuloClient()) {
+      client.tableOperations().create(tableName);
+      FileSystem fs = getFileSystem();
+      Path rootPath = new Path(cluster.getTemporaryPath(), getClass().getName());
+      Path bulk = new Path(rootPath, "bulk");
+      log.info("bulk: {}", bulk);
+      if (fs.exists(bulk)) {
+        fs.delete(bulk, true);
+      }
+      assertTrue(fs.mkdirs(bulk));
+      Path err = new Path(rootPath, "err");
+      log.info("err: {}", err);
+      if (fs.exists(err)) {
+        fs.delete(err, true);
+      }
+      assertTrue(fs.mkdirs(err));
+      Path bogus = new Path(bulk, "bogus.rf");
+      fs.create(bogus).close();
+      log.info("bogus: {}", bogus);
+      assertTrue(fs.exists(bogus));
+      log.info("Importing {} into {} with failures directory {}", bulk, tableName, err);
+      client.tableOperations().importDirectory(tableName, bulk.toString(), err.toString(), false);
+      assertEquals(1, fs.listStatus(err).length);
     }
-    assertTrue(fs.mkdirs(bulk));
-    Path err = new Path(rootPath, "err");
-    log.info("err: {}", err);
-    if (fs.exists(err)) {
-      fs.delete(err, true);
-    }
-    assertTrue(fs.mkdirs(err));
-    Path bogus = new Path(bulk, "bogus.rf");
-    fs.create(bogus).close();
-    log.info("bogus: {}", bogus);
-    assertTrue(fs.exists(bogus));
-    log.info("Importing {} into {} with failures directory {}", bulk, tableName, err);
-    to.importDirectory(tableName, bulk.toString(), err.toString(), false);
-    assertEquals(1, fs.listStatus(err).length);
   }
 
 }
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 81b5325bb6..bfdc8ed45b 100644
--- a/test/src/main/java/org/apache/accumulo/test/CleanWalIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/CleanWalIT.java
@@ -68,22 +68,24 @@ public void configureMiniCluster(MiniAccumuloConfigImpl cfg, Configuration hadoo
 
   @Before
   public void offlineTraceTable() throws Exception {
-    AccumuloClient client = getAccumuloClient();
-    String traceTable = client.instanceOperations().getSystemConfiguration()
-        .get(Property.TRACE_TABLE.getKey());
-    if (client.tableOperations().exists(traceTable)) {
-      client.tableOperations().offline(traceTable, true);
+    try (AccumuloClient client = getAccumuloClient()) {
+      String traceTable = client.instanceOperations().getSystemConfiguration()
+          .get(Property.TRACE_TABLE.getKey());
+      if (client.tableOperations().exists(traceTable)) {
+        client.tableOperations().offline(traceTable, true);
+      }
     }
   }
 
   @After
   public void onlineTraceTable() throws Exception {
     if (null != cluster) {
-      AccumuloClient client = getAccumuloClient();
-      String traceTable = client.instanceOperations().getSystemConfiguration()
-          .get(Property.TRACE_TABLE.getKey());
-      if (client.tableOperations().exists(traceTable)) {
-        client.tableOperations().online(traceTable, true);
+      try (AccumuloClient client = getAccumuloClient()) {
+        String traceTable = client.instanceOperations().getSystemConfiguration()
+            .get(Property.TRACE_TABLE.getKey());
+        if (client.tableOperations().exists(traceTable)) {
+          client.tableOperations().online(traceTable, true);
+        }
       }
     }
   }
@@ -91,44 +93,45 @@ public void onlineTraceTable() throws Exception {
   // test for ACCUMULO-1830
   @Test
   public void test() throws Exception {
-    AccumuloClient client = getAccumuloClient();
-    String tableName = getUniqueNames(1)[0];
-    client.tableOperations().create(tableName);
-    BatchWriter bw = client.createBatchWriter(tableName, new BatchWriterConfig());
-    Mutation m = new Mutation("row");
-    m.put("cf", "cq", "value");
-    bw.addMutation(m);
-    bw.close();
-    getCluster().getClusterControl().stopAllServers(ServerType.TABLET_SERVER);
-    // all 3 tables should do recovery, but the bug doesn't really remove the log file references
+    try (AccumuloClient client = getAccumuloClient()) {
+      String tableName = getUniqueNames(1)[0];
+      client.tableOperations().create(tableName);
+      BatchWriter bw = client.createBatchWriter(tableName, new BatchWriterConfig());
+      Mutation m = new Mutation("row");
+      m.put("cf", "cq", "value");
+      bw.addMutation(m);
+      bw.close();
+      getCluster().getClusterControl().stopAllServers(ServerType.TABLET_SERVER);
+      // all 3 tables should do recovery, but the bug doesn't really remove the log file references
 
-    getCluster().getClusterControl().startAllServers(ServerType.TABLET_SERVER);
+      getCluster().getClusterControl().startAllServers(ServerType.TABLET_SERVER);
 
-    for (String table : new String[] {MetadataTable.NAME, RootTable.NAME})
-      client.tableOperations().flush(table, null, null, true);
-    log.debug("Checking entries for {}", tableName);
-    assertEquals(1, count(tableName, client));
-    for (String table : new String[] {MetadataTable.NAME, RootTable.NAME}) {
-      log.debug("Checking logs for {}", table);
-      assertEquals("Found logs for " + table, 0, countLogs(table, client));
-    }
+      for (String table : new String[] {MetadataTable.NAME, RootTable.NAME})
+        client.tableOperations().flush(table, null, null, true);
+      log.debug("Checking entries for {}", tableName);
+      assertEquals(1, count(tableName, client));
+      for (String table : new String[] {MetadataTable.NAME, RootTable.NAME}) {
+        log.debug("Checking logs for {}", table);
+        assertEquals("Found logs for " + table, 0, countLogs(table, client));
+      }
 
-    bw = client.createBatchWriter(tableName, new BatchWriterConfig());
-    m = new Mutation("row");
-    m.putDelete("cf", "cq");
-    bw.addMutation(m);
-    bw.close();
-    assertEquals(0, count(tableName, client));
-    client.tableOperations().flush(tableName, null, null, true);
-    client.tableOperations().flush(MetadataTable.NAME, null, null, true);
-    client.tableOperations().flush(RootTable.NAME, null, null, true);
-    try {
-      getCluster().getClusterControl().stopAllServers(ServerType.TABLET_SERVER);
-      sleepUninterruptibly(3, TimeUnit.SECONDS);
-    } finally {
-      getCluster().getClusterControl().startAllServers(ServerType.TABLET_SERVER);
+      bw = client.createBatchWriter(tableName, new BatchWriterConfig());
+      m = new Mutation("row");
+      m.putDelete("cf", "cq");
+      bw.addMutation(m);
+      bw.close();
+      assertEquals(0, count(tableName, client));
+      client.tableOperations().flush(tableName, null, null, true);
+      client.tableOperations().flush(MetadataTable.NAME, null, null, true);
+      client.tableOperations().flush(RootTable.NAME, null, null, true);
+      try {
+        getCluster().getClusterControl().stopAllServers(ServerType.TABLET_SERVER);
+        sleepUninterruptibly(3, TimeUnit.SECONDS);
+      } finally {
+        getCluster().getClusterControl().startAllServers(ServerType.TABLET_SERVER);
+      }
+      assertEquals(0, count(tableName, client));
     }
-    assertEquals(0, count(tableName, client));
   }
 
   private int countLogs(String tableName, AccumuloClient client) throws TableNotFoundException {
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 413a9cd960..d4dd5d5c5a 100644
--- a/test/src/main/java/org/apache/accumulo/test/ClientSideIteratorIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/ClientSideIteratorIT.java
@@ -39,6 +39,7 @@
 import org.apache.accumulo.core.security.Authorizations;
 import org.apache.accumulo.harness.AccumuloClusterHarness;
 import org.apache.hadoop.io.Text;
+import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 
@@ -80,25 +81,31 @@ public void setupInstance() throws Exception {
     tableName = getUniqueNames(1)[0];
   }
 
+  @After
+  public void closeClient() {
+    client.close();
+  }
+
   @Test
   public void testIntersect() throws Exception {
     client.tableOperations().create(tableName);
-    BatchWriter bw = client.createBatchWriter(tableName, new BatchWriterConfig());
-    Mutation m = new Mutation("part1");
-    m.put("bar", "doc1", "value");
-    m.put("bar", "doc2", "value");
-    m.put("dog", "doc3", "value");
-    m.put("foo", "doc2", "value");
-    m.put("foo", "doc3", "value");
-    bw.addMutation(m);
-    m = new Mutation("part2");
-    m.put("bar", "DOC1", "value");
-    m.put("bar", "DOC2", "value");
-    m.put("dog", "DOC3", "value");
-    m.put("foo", "DOC2", "value");
-    m.put("foo", "DOC3", "value");
-    bw.addMutation(m);
-    bw.flush();
+    try (BatchWriter bw = client.createBatchWriter(tableName, new BatchWriterConfig())) {
+      Mutation m = new Mutation("part1");
+      m.put("bar", "doc1", "value");
+      m.put("bar", "doc2", "value");
+      m.put("dog", "doc3", "value");
+      m.put("foo", "doc2", "value");
+      m.put("foo", "doc3", "value");
+      bw.addMutation(m);
+      m = new Mutation("part2");
+      m.put("bar", "DOC1", "value");
+      m.put("bar", "DOC2", "value");
+      m.put("dog", "DOC3", "value");
+      m.put("foo", "DOC2", "value");
+      m.put("foo", "DOC3", "value");
+      bw.addMutation(m);
+      bw.flush();
+    }
 
     final IteratorSetting si = new IteratorSetting(10, tableName, IntersectingIterator.class);
     try (ClientSideIteratorScanner csis = new ClientSideIteratorScanner(
@@ -115,17 +122,18 @@ public void testVersioning() throws Exception {
     client.tableOperations().removeProperty(tableName, "table.iterator.scan.vers");
     client.tableOperations().removeProperty(tableName, "table.iterator.majc.vers");
     client.tableOperations().removeProperty(tableName, "table.iterator.minc.vers");
-    final BatchWriter bw = client.createBatchWriter(tableName, new BatchWriterConfig());
-    Mutation m = new Mutation("row1");
-    m.put("colf", "colq", 1L, "value");
-    m.put("colf", "colq", 2L, "value");
-    bw.addMutation(m);
-    bw.flush();
-    m = new Mutation("row1");
-    m.put("colf", "colq", 3L, "value");
-    m.put("colf", "colq", 4L, "value");
-    bw.addMutation(m);
-    bw.flush();
+    try (BatchWriter bw = client.createBatchWriter(tableName, new BatchWriterConfig())) {
+      Mutation m = new Mutation("row1");
+      m.put("colf", "colq", 1L, "value");
+      m.put("colf", "colq", 2L, "value");
+      bw.addMutation(m);
+      bw.flush();
+      m = new Mutation("row1");
+      m.put("colf", "colq", 3L, "value");
+      m.put("colf", "colq", 4L, "value");
+      bw.addMutation(m);
+      bw.flush();
+    }
 
     try (Scanner scanner = client.createScanner(tableName, new Authorizations());
         ClientSideIteratorScanner csis = new ClientSideIteratorScanner(scanner)) {
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 d845cb377e..c5b682609c 100644
--- a/test/src/main/java/org/apache/accumulo/test/CloneIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/CloneIT.java
@@ -46,183 +46,183 @@
 
   @Test
   public void testNoFiles() throws Exception {
-    AccumuloClient client = getAccumuloClient();
-    String tableName = getUniqueNames(1)[0];
-    client.tableOperations().create(tableName);
+    try (AccumuloClient client = getAccumuloClient()) {
+      String tableName = getUniqueNames(1)[0];
+      client.tableOperations().create(tableName);
 
-    KeyExtent ke = new KeyExtent(Table.ID.of("0"), null, null);
-    Mutation mut = ke.getPrevRowUpdateMutation();
-
-    TabletsSection.ServerColumnFamily.TIME_COLUMN.put(mut, new Value("M0".getBytes()));
-    TabletsSection.ServerColumnFamily.DIRECTORY_COLUMN.put(mut,
-        new Value("/default_tablet".getBytes()));
-
-    BatchWriter bw1 = client.createBatchWriter(tableName, new BatchWriterConfig());
-
-    bw1.addMutation(mut);
+      KeyExtent ke = new KeyExtent(Table.ID.of("0"), null, null);
+      Mutation mut = ke.getPrevRowUpdateMutation();
 
-    bw1.close();
+      TabletsSection.ServerColumnFamily.TIME_COLUMN.put(mut, new Value("M0".getBytes()));
+      TabletsSection.ServerColumnFamily.DIRECTORY_COLUMN.put(mut,
+          new Value("/default_tablet".getBytes()));
 
-    BatchWriter bw2 = client.createBatchWriter(tableName, new BatchWriterConfig());
-
-    MetadataTableUtil.initializeClone(tableName, Table.ID.of("0"), Table.ID.of("1"), client, bw2);
-
-    int rc = MetadataTableUtil.checkClone(tableName, Table.ID.of("0"), Table.ID.of("1"), client,
-        bw2);
-
-    assertEquals(0, rc);
+      try (BatchWriter bw1 = client.createBatchWriter(tableName, new BatchWriterConfig())) {
+        bw1.addMutation(mut);
+      }
 
-    // scan tables metadata entries and confirm the same
+      try (BatchWriter bw2 = client.createBatchWriter(tableName, new BatchWriterConfig())) {
+        MetadataTableUtil.initializeClone(tableName, Table.ID.of("0"), Table.ID.of("1"), client,
+            bw2);
+        int rc = MetadataTableUtil.checkClone(tableName, Table.ID.of("0"), Table.ID.of("1"), client,
+            bw2);
+        assertEquals(0, rc);
+      }
 
+      // scan tables metadata entries and confirm the same
+    }
   }
 
   @Test
   public void testFilesChange() throws Exception {
-    AccumuloClient client = getAccumuloClient();
-    String tableName = getUniqueNames(1)[0];
-    client.tableOperations().create(tableName);
-
-    KeyExtent ke = new KeyExtent(Table.ID.of("0"), null, null);
-    Mutation mut = ke.getPrevRowUpdateMutation();
-
-    TabletsSection.ServerColumnFamily.TIME_COLUMN.put(mut, new Value("M0".getBytes()));
-    TabletsSection.ServerColumnFamily.DIRECTORY_COLUMN.put(mut,
-        new Value("/default_tablet".getBytes()));
-    mut.put(DataFileColumnFamily.NAME.toString(), "/default_tablet/0_0.rf",
-        new DataFileValue(1, 200).encodeAsString());
+    try (AccumuloClient client = getAccumuloClient()) {
+      String tableName = getUniqueNames(1)[0];
+      client.tableOperations().create(tableName);
 
-    BatchWriter bw1 = client.createBatchWriter(tableName, new BatchWriterConfig());
+      KeyExtent ke = new KeyExtent(Table.ID.of("0"), null, null);
+      Mutation mut = ke.getPrevRowUpdateMutation();
 
-    bw1.addMutation(mut);
+      TabletsSection.ServerColumnFamily.TIME_COLUMN.put(mut, new Value("M0".getBytes()));
+      TabletsSection.ServerColumnFamily.DIRECTORY_COLUMN.put(mut,
+          new Value("/default_tablet".getBytes()));
+      mut.put(DataFileColumnFamily.NAME.toString(), "/default_tablet/0_0.rf",
+          new DataFileValue(1, 200).encodeAsString());
 
-    bw1.flush();
+      try (BatchWriter bw1 = client.createBatchWriter(tableName);
+          BatchWriter bw2 = client.createBatchWriter(tableName)) {
+        bw1.addMutation(mut);
 
-    BatchWriter bw2 = client.createBatchWriter(tableName, new BatchWriterConfig());
+        bw1.flush();
 
-    MetadataTableUtil.initializeClone(tableName, Table.ID.of("0"), Table.ID.of("1"), client, bw2);
+        MetadataTableUtil.initializeClone(tableName, Table.ID.of("0"), Table.ID.of("1"), client,
+            bw2);
 
-    Mutation mut2 = new Mutation(ke.getMetadataEntry());
-    mut2.putDelete(DataFileColumnFamily.NAME.toString(), "/default_tablet/0_0.rf");
-    mut2.put(DataFileColumnFamily.NAME.toString(), "/default_tablet/1_0.rf",
-        new DataFileValue(2, 300).encodeAsString());
+        Mutation mut2 = new Mutation(ke.getMetadataEntry());
+        mut2.putDelete(DataFileColumnFamily.NAME.toString(), "/default_tablet/0_0.rf");
+        mut2.put(DataFileColumnFamily.NAME.toString(), "/default_tablet/1_0.rf",
+            new DataFileValue(2, 300).encodeAsString());
 
-    bw1.addMutation(mut2);
-    bw1.flush();
+        bw1.addMutation(mut2);
+        bw1.flush();
 
-    int rc = MetadataTableUtil.checkClone(tableName, Table.ID.of("0"), Table.ID.of("1"), client,
-        bw2);
+        int rc = MetadataTableUtil.checkClone(tableName, Table.ID.of("0"), Table.ID.of("1"), client,
+            bw2);
 
-    assertEquals(1, rc);
+        assertEquals(1, rc);
 
-    rc = MetadataTableUtil.checkClone(tableName, Table.ID.of("0"), Table.ID.of("1"), client, bw2);
+        rc = MetadataTableUtil.checkClone(tableName, Table.ID.of("0"), Table.ID.of("1"), client,
+            bw2);
 
-    assertEquals(0, rc);
+        assertEquals(0, rc);
+      }
 
-    HashSet<String> files = new HashSet<>();
+      HashSet<String> files = new HashSet<>();
 
-    try (Scanner scanner = client.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());
+      try (Scanner scanner = client.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"));
     }
-    assertEquals(1, files.size());
-    assertTrue(files.contains("../0/default_tablet/1_0.rf"));
   }
 
   // test split where files of children are the same
   @Test
   public void testSplit1() throws Exception {
-    AccumuloClient client = getAccumuloClient();
-    String tableName = getUniqueNames(1)[0];
-    client.tableOperations().create(tableName);
-
-    BatchWriter bw1 = client.createBatchWriter(tableName, new BatchWriterConfig());
-
-    bw1.addMutation(createTablet("0", null, null, "/default_tablet", "/default_tablet/0_0.rf"));
-
-    bw1.flush();
+    try (AccumuloClient client = getAccumuloClient()) {
+      String tableName = getUniqueNames(1)[0];
+      client.tableOperations().create(tableName);
 
-    BatchWriter bw2 = client.createBatchWriter(tableName, new BatchWriterConfig());
+      try (BatchWriter bw1 = client.createBatchWriter(tableName);
+          BatchWriter bw2 = client.createBatchWriter(tableName)) {
+        bw1.addMutation(createTablet("0", null, null, "/default_tablet", "/default_tablet/0_0.rf"));
 
-    MetadataTableUtil.initializeClone(tableName, Table.ID.of("0"), Table.ID.of("1"), client, bw2);
+        bw1.flush();
 
-    bw1.addMutation(createTablet("0", "m", null, "/default_tablet", "/default_tablet/0_0.rf"));
-    bw1.addMutation(createTablet("0", null, "m", "/t-1", "/default_tablet/0_0.rf"));
+        MetadataTableUtil.initializeClone(tableName, Table.ID.of("0"), Table.ID.of("1"), client,
+            bw2);
 
-    bw1.flush();
+        bw1.addMutation(createTablet("0", "m", null, "/default_tablet", "/default_tablet/0_0.rf"));
+        bw1.addMutation(createTablet("0", null, "m", "/t-1", "/default_tablet/0_0.rf"));
 
-    int rc = MetadataTableUtil.checkClone(tableName, Table.ID.of("0"), Table.ID.of("1"), client,
-        bw2);
+        bw1.flush();
 
-    assertEquals(0, rc);
+        int rc = MetadataTableUtil.checkClone(tableName, Table.ID.of("0"), Table.ID.of("1"), client,
+            bw2);
 
-    HashSet<String> files = new HashSet<>();
-    int count = 0;
-
-    try (Scanner scanner = client.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(0, rc);
+      }
+      HashSet<String> files = new HashSet<>();
+      int count = 0;
+
+      try (Scanner scanner = client.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"));
     }
-    assertEquals(1, count);
-    assertEquals(1, files.size());
-    assertTrue(files.contains("../0/default_tablet/0_0.rf"));
   }
 
   // test split where files of children differ... like majc and split occurred
   @Test
   public void testSplit2() throws Exception {
-    AccumuloClient client = getAccumuloClient();
-    String tableName = getUniqueNames(1)[0];
-    client.tableOperations().create(tableName);
-
-    BatchWriter bw1 = client.createBatchWriter(tableName, new BatchWriterConfig());
-
-    bw1.addMutation(createTablet("0", null, null, "/default_tablet", "/default_tablet/0_0.rf"));
-
-    bw1.flush();
+    try (AccumuloClient client = getAccumuloClient()) {
+      String tableName = getUniqueNames(1)[0];
+      client.tableOperations().create(tableName);
 
-    BatchWriter bw2 = client.createBatchWriter(tableName, new BatchWriterConfig());
+      try (BatchWriter bw1 = client.createBatchWriter(tableName);
+          BatchWriter bw2 = client.createBatchWriter(tableName)) {
+        bw1.addMutation(createTablet("0", null, null, "/default_tablet", "/default_tablet/0_0.rf"));
 
-    MetadataTableUtil.initializeClone(tableName, Table.ID.of("0"), Table.ID.of("1"), client, bw2);
+        bw1.flush();
 
-    bw1.addMutation(createTablet("0", "m", null, "/default_tablet", "/default_tablet/1_0.rf"));
-    Mutation mut3 = createTablet("0", null, "m", "/t-1", "/default_tablet/1_0.rf");
-    mut3.putDelete(DataFileColumnFamily.NAME.toString(), "/default_tablet/0_0.rf");
-    bw1.addMutation(mut3);
+        MetadataTableUtil.initializeClone(tableName, Table.ID.of("0"), Table.ID.of("1"), client,
+            bw2);
 
-    bw1.flush();
+        bw1.addMutation(createTablet("0", "m", null, "/default_tablet", "/default_tablet/1_0.rf"));
+        Mutation mut3 = createTablet("0", null, "m", "/t-1", "/default_tablet/1_0.rf");
+        mut3.putDelete(DataFileColumnFamily.NAME.toString(), "/default_tablet/0_0.rf");
+        bw1.addMutation(mut3);
 
-    int rc = MetadataTableUtil.checkClone(tableName, Table.ID.of("0"), Table.ID.of("1"), client,
-        bw2);
+        bw1.flush();
 
-    assertEquals(1, rc);
+        int rc = MetadataTableUtil.checkClone(tableName, Table.ID.of("0"), Table.ID.of("1"), client,
+            bw2);
 
-    rc = MetadataTableUtil.checkClone(tableName, Table.ID.of("0"), Table.ID.of("1"), client, bw2);
+        assertEquals(1, rc);
 
-    assertEquals(0, rc);
+        rc = MetadataTableUtil.checkClone(tableName, Table.ID.of("0"), Table.ID.of("1"), client,
+            bw2);
 
-    HashSet<String> files = new HashSet<>();
-    int count = 0;
-
-    try (Scanner scanner = client.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(0, rc);
+      }
+      HashSet<String> files = new HashSet<>();
+      int count = 0;
+
+      try (Scanner scanner = client.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"));
     }
-    assertEquals(1, files.size());
-    assertEquals(2, count);
-    assertTrue(files.contains("../0/default_tablet/1_0.rf"));
   }
 
   private static Mutation deleteTablet(String tid, String endRow, String prevRow, String dir,
@@ -255,146 +255,149 @@ private static Mutation createTablet(String tid, String endRow, String prevRow,
   // test two tablets splitting into four
   @Test
   public void testSplit3() throws Exception {
-    AccumuloClient client = getAccumuloClient();
-    String tableName = getUniqueNames(1)[0];
-    client.tableOperations().create(tableName);
-
-    BatchWriter bw1 = client.createBatchWriter(tableName, new BatchWriterConfig());
+    try (AccumuloClient client = getAccumuloClient()) {
+      String tableName = getUniqueNames(1)[0];
+      client.tableOperations().create(tableName);
 
-    bw1.addMutation(createTablet("0", "m", null, "/d1", "/d1/file1"));
-    bw1.addMutation(createTablet("0", null, "m", "/d2", "/d2/file2"));
+      try (BatchWriter bw1 = client.createBatchWriter(tableName);
+          BatchWriter bw2 = client.createBatchWriter(tableName)) {
+        bw1.addMutation(createTablet("0", "m", null, "/d1", "/d1/file1"));
+        bw1.addMutation(createTablet("0", null, "m", "/d2", "/d2/file2"));
 
-    bw1.flush();
+        bw1.flush();
 
-    BatchWriter bw2 = client.createBatchWriter(tableName, new BatchWriterConfig());
+        MetadataTableUtil.initializeClone(tableName, Table.ID.of("0"), Table.ID.of("1"), client,
+            bw2);
 
-    MetadataTableUtil.initializeClone(tableName, Table.ID.of("0"), Table.ID.of("1"), client, bw2);
+        bw1.addMutation(createTablet("0", "f", null, "/d1", "/d1/file3"));
+        bw1.addMutation(createTablet("0", "m", "f", "/d3", "/d1/file1"));
+        bw1.addMutation(createTablet("0", "s", "m", "/d2", "/d2/file2"));
+        bw1.addMutation(createTablet("0", null, "s", "/d4", "/d2/file2"));
 
-    bw1.addMutation(createTablet("0", "f", null, "/d1", "/d1/file3"));
-    bw1.addMutation(createTablet("0", "m", "f", "/d3", "/d1/file1"));
-    bw1.addMutation(createTablet("0", "s", "m", "/d2", "/d2/file2"));
-    bw1.addMutation(createTablet("0", null, "s", "/d4", "/d2/file2"));
+        bw1.flush();
 
-    bw1.flush();
+        int rc = MetadataTableUtil.checkClone(tableName, Table.ID.of("0"), Table.ID.of("1"), client,
+            bw2);
 
-    int rc = MetadataTableUtil.checkClone(tableName, Table.ID.of("0"), Table.ID.of("1"), client,
-        bw2);
-
-    assertEquals(0, rc);
+        assertEquals(0, rc);
+      }
 
-    HashSet<String> files = new HashSet<>();
-    int count = 0;
+      HashSet<String> files = new HashSet<>();
+      int count = 0;
 
-    try (Scanner scanner = client.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++;
+      try (Scanner scanner = client.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"));
+      assertTrue(files.contains("../0/d2/file2"));
     }
-    assertEquals(2, count);
-    assertEquals(2, files.size());
-    assertTrue(files.contains("../0/d1/file1"));
-    assertTrue(files.contains("../0/d2/file2"));
   }
 
   // test cloned marker
   @Test
   public void testClonedMarker() throws Exception {
-    AccumuloClient client = getAccumuloClient();
-    String tableName = getUniqueNames(1)[0];
-    client.tableOperations().create(tableName);
+    try (AccumuloClient client = getAccumuloClient()) {
+      String tableName = getUniqueNames(1)[0];
+      client.tableOperations().create(tableName);
 
-    BatchWriter bw1 = client.createBatchWriter(tableName, new BatchWriterConfig());
+      try (BatchWriter bw1 = client.createBatchWriter(tableName);
+          BatchWriter bw2 = client.createBatchWriter(tableName)) {
+        bw1.addMutation(createTablet("0", "m", null, "/d1", "/d1/file1"));
+        bw1.addMutation(createTablet("0", null, "m", "/d2", "/d2/file2"));
 
-    bw1.addMutation(createTablet("0", "m", null, "/d1", "/d1/file1"));
-    bw1.addMutation(createTablet("0", null, "m", "/d2", "/d2/file2"));
+        bw1.flush();
 
-    bw1.flush();
+        MetadataTableUtil.initializeClone(tableName, Table.ID.of("0"), Table.ID.of("1"), client,
+            bw2);
 
-    BatchWriter bw2 = client.createBatchWriter(tableName, new BatchWriterConfig());
+        bw1.addMutation(deleteTablet("0", "m", null, "/d1", "/d1/file1"));
+        bw1.addMutation(deleteTablet("0", null, "m", "/d2", "/d2/file2"));
 
-    MetadataTableUtil.initializeClone(tableName, Table.ID.of("0"), Table.ID.of("1"), client, bw2);
+        bw1.flush();
 
-    bw1.addMutation(deleteTablet("0", "m", null, "/d1", "/d1/file1"));
-    bw1.addMutation(deleteTablet("0", null, "m", "/d2", "/d2/file2"));
+        bw1.addMutation(createTablet("0", "f", null, "/d1", "/d1/file3"));
+        bw1.addMutation(createTablet("0", "m", "f", "/d3", "/d1/file1"));
+        bw1.addMutation(createTablet("0", "s", "m", "/d2", "/d2/file3"));
+        bw1.addMutation(createTablet("0", null, "s", "/d4", "/d4/file3"));
 
-    bw1.flush();
+        bw1.flush();
 
-    bw1.addMutation(createTablet("0", "f", null, "/d1", "/d1/file3"));
-    bw1.addMutation(createTablet("0", "m", "f", "/d3", "/d1/file1"));
-    bw1.addMutation(createTablet("0", "s", "m", "/d2", "/d2/file3"));
-    bw1.addMutation(createTablet("0", null, "s", "/d4", "/d4/file3"));
+        int rc = MetadataTableUtil.checkClone(tableName, Table.ID.of("0"), Table.ID.of("1"), client,
+            bw2);
 
-    bw1.flush();
+        assertEquals(1, rc);
 
-    int rc = MetadataTableUtil.checkClone(tableName, Table.ID.of("0"), Table.ID.of("1"), client,
-        bw2);
+        bw1.addMutation(deleteTablet("0", "m", "f", "/d3", "/d1/file1"));
 
-    assertEquals(1, rc);
+        bw1.flush();
 
-    bw1.addMutation(deleteTablet("0", "m", "f", "/d3", "/d1/file1"));
+        bw1.addMutation(createTablet("0", "m", "f", "/d3", "/d1/file3"));
 
-    bw1.flush();
+        bw1.flush();
 
-    bw1.addMutation(createTablet("0", "m", "f", "/d3", "/d1/file3"));
+        rc = MetadataTableUtil.checkClone(tableName, Table.ID.of("0"), Table.ID.of("1"), client,
+            bw2);
 
-    bw1.flush();
-
-    rc = MetadataTableUtil.checkClone(tableName, Table.ID.of("0"), Table.ID.of("1"), client, bw2);
-
-    assertEquals(0, rc);
-
-    HashSet<String> files = new HashSet<>();
-    int count = 0;
-
-    try (Scanner scanner = client.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(0, rc);
+      }
+      HashSet<String> files = new HashSet<>();
+      int count = 0;
+
+      try (Scanner scanner = client.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"));
+      assertTrue(files.contains("../0/d2/file3"));
+      assertTrue(files.contains("../0/d4/file3"));
     }
-    assertEquals(3, count);
-    assertEquals(3, files.size());
-    assertTrue(files.contains("../0/d1/file1"));
-    assertTrue(files.contains("../0/d2/file3"));
-    assertTrue(files.contains("../0/d4/file3"));
   }
 
   // test two tablets splitting into four
   @Test
   public void testMerge() throws Exception {
-    AccumuloClient client = getAccumuloClient();
-    String tableName = getUniqueNames(1)[0];
-    client.tableOperations().create(tableName);
+    try (AccumuloClient client = getAccumuloClient()) {
+      String tableName = getUniqueNames(1)[0];
+      client.tableOperations().create(tableName);
 
-    BatchWriter bw1 = client.createBatchWriter(tableName, new BatchWriterConfig());
+      try (BatchWriter bw1 = client.createBatchWriter(tableName);
+          BatchWriter bw2 = client.createBatchWriter(tableName)) {
+        bw1.addMutation(createTablet("0", "m", null, "/d1", "/d1/file1"));
+        bw1.addMutation(createTablet("0", null, "m", "/d2", "/d2/file2"));
 
-    bw1.addMutation(createTablet("0", "m", null, "/d1", "/d1/file1"));
-    bw1.addMutation(createTablet("0", null, "m", "/d2", "/d2/file2"));
+        bw1.flush();
 
-    bw1.flush();
+        MetadataTableUtil.initializeClone(tableName, Table.ID.of("0"), Table.ID.of("1"), client,
+            bw2);
 
-    BatchWriter bw2 = client.createBatchWriter(tableName, new BatchWriterConfig());
+        bw1.addMutation(deleteTablet("0", "m", null, "/d1", "/d1/file1"));
+        Mutation mut = createTablet("0", null, null, "/d2", "/d2/file2");
+        mut.put(DataFileColumnFamily.NAME.toString(), "/d1/file1",
+            new DataFileValue(10, 200).encodeAsString());
+        bw1.addMutation(mut);
 
-    MetadataTableUtil.initializeClone(tableName, Table.ID.of("0"), Table.ID.of("1"), client, bw2);
+        bw1.flush();
 
-    bw1.addMutation(deleteTablet("0", "m", null, "/d1", "/d1/file1"));
-    Mutation mut = createTablet("0", null, null, "/d2", "/d2/file2");
-    mut.put(DataFileColumnFamily.NAME.toString(), "/d1/file1",
-        new DataFileValue(10, 200).encodeAsString());
-    bw1.addMutation(mut);
-
-    bw1.flush();
-
-    try {
-      MetadataTableUtil.checkClone(tableName, Table.ID.of("0"), Table.ID.of("1"), client, bw2);
-      fail();
-    } catch (TabletDeletedException tde) {}
+        try {
+          MetadataTableUtil.checkClone(tableName, Table.ID.of("0"), Table.ID.of("1"), client, bw2);
+          fail();
+        } catch (TabletDeletedException tde) {}
+      }
+    }
   }
 }
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 b889a3c4f0..ac7da5492d 100644
--- a/test/src/main/java/org/apache/accumulo/test/ConditionalWriterIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/ConditionalWriterIT.java
@@ -135,316 +135,325 @@ public static long abs(long l) {
 
   @Before
   public void deleteUsers() throws Exception {
-    AccumuloClient client = getAccumuloClient();
-    Set<String> users = client.securityOperations().listLocalUsers();
-    ClusterUser user = getUser(0);
-    if (users.contains(user.getPrincipal())) {
-      client.securityOperations().dropLocalUser(user.getPrincipal());
+    try (AccumuloClient client = getAccumuloClient()) {
+      Set<String> users = client.securityOperations().listLocalUsers();
+      ClusterUser user = getUser(0);
+      if (users.contains(user.getPrincipal())) {
+        client.securityOperations().dropLocalUser(user.getPrincipal());
+      }
     }
   }
 
   @Test
   public void testBasic() throws Exception {
 
-    AccumuloClient client = getAccumuloClient();
-    String tableName = getUniqueNames(1)[0];
+    try (AccumuloClient client = getAccumuloClient()) {
+      String tableName = getUniqueNames(1)[0];
 
-    client.tableOperations().create(tableName);
-
-    try (
-        ConditionalWriter cw = client.createConditionalWriter(tableName,
-            new ConditionalWriterConfig());
-        Scanner scanner = client.createScanner(tableName, Authorizations.EMPTY)) {
-
-      // mutation conditional on column tx:seq not existing
-      ConditionalMutation cm0 = new ConditionalMutation("99006", new Condition("tx", "seq"));
-      cm0.put("name", "last", "doe");
-      cm0.put("name", "first", "john");
-      cm0.put("tx", "seq", "1");
-      assertEquals(Status.ACCEPTED, cw.write(cm0).getStatus());
-      assertEquals(Status.REJECTED, cw.write(cm0).getStatus());
-
-      // mutation conditional on column tx:seq being 1
-      ConditionalMutation cm1 = new ConditionalMutation("99006",
-          new Condition("tx", "seq").setValue("1"));
-      cm1.put("name", "last", "Doe");
-      cm1.put("tx", "seq", "2");
-      assertEquals(Status.ACCEPTED, cw.write(cm1).getStatus());
-
-      // test condition where value differs
-      ConditionalMutation cm2 = new ConditionalMutation("99006",
-          new Condition("tx", "seq").setValue("1"));
-      cm2.put("name", "last", "DOE");
-      cm2.put("tx", "seq", "2");
-      assertEquals(Status.REJECTED, cw.write(cm2).getStatus());
-
-      // test condition where column does not exists
-      ConditionalMutation cm3 = new ConditionalMutation("99006",
-          new Condition("txtypo", "seq").setValue("1"));
-      cm3.put("name", "last", "deo");
-      cm3.put("tx", "seq", "2");
-      assertEquals(Status.REJECTED, cw.write(cm3).getStatus());
-
-      // test two conditions, where one should fail
-      ConditionalMutation cm4 = new ConditionalMutation("99006",
-          new Condition("tx", "seq").setValue("2"), new Condition("name", "last").setValue("doe"));
-      cm4.put("name", "last", "deo");
-      cm4.put("tx", "seq", "3");
-      assertEquals(Status.REJECTED, cw.write(cm4).getStatus());
-
-      // test two conditions, where one should fail
-      ConditionalMutation cm5 = new ConditionalMutation("99006",
-          new Condition("tx", "seq").setValue("1"), new Condition("name", "last").setValue("Doe"));
-      cm5.put("name", "last", "deo");
-      cm5.put("tx", "seq", "3");
-      assertEquals(Status.REJECTED, cw.write(cm5).getStatus());
-
-      // ensure rejected mutations did not write
-      scanner.fetchColumn(new Text("name"), new Text("last"));
-      scanner.setRange(new Range("99006"));
-      Entry<Key,Value> entry = Iterables.getOnlyElement(scanner);
-      assertEquals("Doe", entry.getValue().toString());
-
-      // test w/ two conditions that are met
-      ConditionalMutation cm6 = new ConditionalMutation("99006",
-          new Condition("tx", "seq").setValue("2"), new Condition("name", "last").setValue("Doe"));
-      cm6.put("name", "last", "DOE");
-      cm6.put("tx", "seq", "3");
-      assertEquals(Status.ACCEPTED, cw.write(cm6).getStatus());
-
-      entry = Iterables.getOnlyElement(scanner);
-      assertEquals("DOE", entry.getValue().toString());
-
-      // test a conditional mutation that deletes
-      ConditionalMutation cm7 = new ConditionalMutation("99006",
-          new Condition("tx", "seq").setValue("3"));
-      cm7.putDelete("name", "last");
-      cm7.putDelete("name", "first");
-      cm7.putDelete("tx", "seq");
-      assertEquals(Status.ACCEPTED, cw.write(cm7).getStatus());
-
-      assertFalse("Did not expect to find any results", scanner.iterator().hasNext());
-
-      // add the row back
-      assertEquals(Status.ACCEPTED, cw.write(cm0).getStatus());
-      assertEquals(Status.REJECTED, cw.write(cm0).getStatus());
-
-      entry = Iterables.getOnlyElement(scanner);
-      assertEquals("doe", entry.getValue().toString());
-    }
-  }
+      client.tableOperations().create(tableName);
 
-  @Test
-  public void testFields() throws Exception {
+      try (
+          ConditionalWriter cw = client.createConditionalWriter(tableName,
+              new ConditionalWriterConfig());
+          Scanner scanner = client.createScanner(tableName, Authorizations.EMPTY)) {
 
-    AccumuloClient client = getAccumuloClient();
-    String tableName = getUniqueNames(1)[0];
+        // mutation conditional on column tx:seq not existing
+        ConditionalMutation cm0 = new ConditionalMutation("99006", new Condition("tx", "seq"));
+        cm0.put("name", "last", "doe");
+        cm0.put("name", "first", "john");
+        cm0.put("tx", "seq", "1");
+        assertEquals(Status.ACCEPTED, cw.write(cm0).getStatus());
+        assertEquals(Status.REJECTED, cw.write(cm0).getStatus());
 
-    String user = null;
+        // mutation conditional on column tx:seq being 1
+        ConditionalMutation cm1 = new ConditionalMutation("99006",
+            new Condition("tx", "seq").setValue("1"));
+        cm1.put("name", "last", "Doe");
+        cm1.put("tx", "seq", "2");
+        assertEquals(Status.ACCEPTED, cw.write(cm1).getStatus());
 
-    ClusterUser user1 = getUser(0);
-    user = user1.getPrincipal();
-    if (saslEnabled()) {
-      // The token is pointless for kerberos
-      client.securityOperations().createLocalUser(user, null);
-    } else {
-      client.securityOperations().createLocalUser(user, new PasswordToken(user1.getPassword()));
-    }
+        // test condition where value differs
+        ConditionalMutation cm2 = new ConditionalMutation("99006",
+            new Condition("tx", "seq").setValue("1"));
+        cm2.put("name", "last", "DOE");
+        cm2.put("tx", "seq", "2");
+        assertEquals(Status.REJECTED, cw.write(cm2).getStatus());
+
+        // test condition where column does not exists
+        ConditionalMutation cm3 = new ConditionalMutation("99006",
+            new Condition("txtypo", "seq").setValue("1"));
+        cm3.put("name", "last", "deo");
+        cm3.put("tx", "seq", "2");
+        assertEquals(Status.REJECTED, cw.write(cm3).getStatus());
+
+        // test two conditions, where one should fail
+        ConditionalMutation cm4 = new ConditionalMutation("99006",
+            new Condition("tx", "seq").setValue("2"),
+            new Condition("name", "last").setValue("doe"));
+        cm4.put("name", "last", "deo");
+        cm4.put("tx", "seq", "3");
+        assertEquals(Status.REJECTED, cw.write(cm4).getStatus());
+
+        // test two conditions, where one should fail
+        ConditionalMutation cm5 = new ConditionalMutation("99006",
+            new Condition("tx", "seq").setValue("1"),
+            new Condition("name", "last").setValue("Doe"));
+        cm5.put("name", "last", "deo");
+        cm5.put("tx", "seq", "3");
+        assertEquals(Status.REJECTED, cw.write(cm5).getStatus());
+
+        // ensure rejected mutations did not write
+        scanner.fetchColumn(new Text("name"), new Text("last"));
+        scanner.setRange(new Range("99006"));
+        Entry<Key,Value> entry = Iterables.getOnlyElement(scanner);
+        assertEquals("Doe", entry.getValue().toString());
 
-    Authorizations auths = new Authorizations("A", "B");
+        // test w/ two conditions that are met
+        ConditionalMutation cm6 = new ConditionalMutation("99006",
+            new Condition("tx", "seq").setValue("2"),
+            new Condition("name", "last").setValue("Doe"));
+        cm6.put("name", "last", "DOE");
+        cm6.put("tx", "seq", "3");
+        assertEquals(Status.ACCEPTED, cw.write(cm6).getStatus());
 
-    client.securityOperations().changeUserAuthorizations(user, auths);
-    client.securityOperations().grantSystemPermission(user, SystemPermission.CREATE_TABLE);
+        entry = Iterables.getOnlyElement(scanner);
+        assertEquals("DOE", entry.getValue().toString());
 
-    client = client.changeUser(user, user1.getToken());
-    client.tableOperations().create(tableName);
+        // test a conditional mutation that deletes
+        ConditionalMutation cm7 = new ConditionalMutation("99006",
+            new Condition("tx", "seq").setValue("3"));
+        cm7.putDelete("name", "last");
+        cm7.putDelete("name", "first");
+        cm7.putDelete("tx", "seq");
+        assertEquals(Status.ACCEPTED, cw.write(cm7).getStatus());
 
-    try (
-        ConditionalWriter cw = client.createConditionalWriter(tableName,
-            new ConditionalWriterConfig().setAuthorizations(auths));
-        Scanner scanner = client.createScanner(tableName, auths)) {
+        assertFalse("Did not expect to find any results", scanner.iterator().hasNext());
 
-      ColumnVisibility cva = new ColumnVisibility("A");
-      ColumnVisibility cvb = new ColumnVisibility("B");
+        // add the row back
+        assertEquals(Status.ACCEPTED, cw.write(cm0).getStatus());
+        assertEquals(Status.REJECTED, cw.write(cm0).getStatus());
 
-      ConditionalMutation cm0 = new ConditionalMutation("99006",
-          new Condition("tx", "seq").setVisibility(cva));
-      cm0.put("name", "last", cva, "doe");
-      cm0.put("name", "first", cva, "john");
-      cm0.put("tx", "seq", cva, "1");
-      assertEquals(Status.ACCEPTED, cw.write(cm0).getStatus());
-
-      scanner.setRange(new Range("99006"));
-      // TODO verify all columns
-      scanner.fetchColumn(new Text("tx"), new Text("seq"));
-      Entry<Key,Value> entry = Iterables.getOnlyElement(scanner);
-      assertEquals("1", entry.getValue().toString());
-      long ts = entry.getKey().getTimestamp();
-
-      // test wrong colf
-      ConditionalMutation cm1 = new ConditionalMutation("99006",
-          new Condition("txA", "seq").setVisibility(cva).setValue("1"));
-      cm1.put("name", "last", cva, "Doe");
-      cm1.put("name", "first", cva, "John");
-      cm1.put("tx", "seq", cva, "2");
-      assertEquals(Status.REJECTED, cw.write(cm1).getStatus());
-
-      // test wrong colq
-      ConditionalMutation cm2 = new ConditionalMutation("99006",
-          new Condition("tx", "seqA").setVisibility(cva).setValue("1"));
-      cm2.put("name", "last", cva, "Doe");
-      cm2.put("name", "first", cva, "John");
-      cm2.put("tx", "seq", cva, "2");
-      assertEquals(Status.REJECTED, cw.write(cm2).getStatus());
-
-      // test wrong colv
-      ConditionalMutation cm3 = new ConditionalMutation("99006",
-          new Condition("tx", "seq").setVisibility(cvb).setValue("1"));
-      cm3.put("name", "last", cva, "Doe");
-      cm3.put("name", "first", cva, "John");
-      cm3.put("tx", "seq", cva, "2");
-      assertEquals(Status.REJECTED, cw.write(cm3).getStatus());
-
-      // test wrong timestamp
-      ConditionalMutation cm4 = new ConditionalMutation("99006",
-          new Condition("tx", "seq").setVisibility(cva).setTimestamp(ts + 1).setValue("1"));
-      cm4.put("name", "last", cva, "Doe");
-      cm4.put("name", "first", cva, "John");
-      cm4.put("tx", "seq", cva, "2");
-      assertEquals(Status.REJECTED, cw.write(cm4).getStatus());
-
-      // test wrong timestamp
-      ConditionalMutation cm5 = new ConditionalMutation("99006",
-          new Condition("tx", "seq").setVisibility(cva).setTimestamp(ts - 1).setValue("1"));
-      cm5.put("name", "last", cva, "Doe");
-      cm5.put("name", "first", cva, "John");
-      cm5.put("tx", "seq", cva, "2");
-      assertEquals(Status.REJECTED, cw.write(cm5).getStatus());
-
-      // ensure no updates were made
-      entry = Iterables.getOnlyElement(scanner);
-      assertEquals("1", entry.getValue().toString());
-
-      // set all columns correctly
-      ConditionalMutation cm6 = new ConditionalMutation("99006",
-          new Condition("tx", "seq").setVisibility(cva).setTimestamp(ts).setValue("1"));
-      cm6.put("name", "last", cva, "Doe");
-      cm6.put("name", "first", cva, "John");
-      cm6.put("tx", "seq", cva, "2");
-      assertEquals(Status.ACCEPTED, cw.write(cm6).getStatus());
-
-      entry = Iterables.getOnlyElement(scanner);
-      assertEquals("2", entry.getValue().toString());
+        entry = Iterables.getOnlyElement(scanner);
+        assertEquals("doe", entry.getValue().toString());
+      }
     }
   }
 
   @Test
-  public void testBadColVis() throws Exception {
-    // test when a user sets a col vis in a condition that can never be seen
+  public void testFields() throws Exception {
 
-    AccumuloClient client = getAccumuloClient();
-    String tableName = getUniqueNames(1)[0];
+    try (AccumuloClient client1 = getAccumuloClient()) {
+      String tableName = getUniqueNames(1)[0];
 
-    client.tableOperations().create(tableName);
+      String user = null;
 
-    Authorizations auths = new Authorizations("A", "B");
+      ClusterUser user1 = getUser(0);
+      user = user1.getPrincipal();
+      if (saslEnabled()) {
+        // The token is pointless for kerberos
+        client1.securityOperations().createLocalUser(user, null);
+      } else {
+        client1.securityOperations().createLocalUser(user, new PasswordToken(user1.getPassword()));
+      }
 
-    client.securityOperations().changeUserAuthorizations(getAdminPrincipal(), auths);
+      Authorizations auths = new Authorizations("A", "B");
+
+      client1.securityOperations().changeUserAuthorizations(user, auths);
+      client1.securityOperations().grantSystemPermission(user, SystemPermission.CREATE_TABLE);
+
+      try (AccumuloClient client2 = client1.changeUser(user, user1.getToken())) {
+        client2.tableOperations().create(tableName);
+
+        try (
+            ConditionalWriter cw = client2.createConditionalWriter(tableName,
+                new ConditionalWriterConfig().setAuthorizations(auths));
+            Scanner scanner = client2.createScanner(tableName, auths)) {
+
+          ColumnVisibility cva = new ColumnVisibility("A");
+          ColumnVisibility cvb = new ColumnVisibility("B");
+
+          ConditionalMutation cm0 = new ConditionalMutation("99006",
+              new Condition("tx", "seq").setVisibility(cva));
+          cm0.put("name", "last", cva, "doe");
+          cm0.put("name", "first", cva, "john");
+          cm0.put("tx", "seq", cva, "1");
+          assertEquals(Status.ACCEPTED, cw.write(cm0).getStatus());
+
+          scanner.setRange(new Range("99006"));
+          // TODO verify all columns
+          scanner.fetchColumn(new Text("tx"), new Text("seq"));
+          Entry<Key,Value> entry = Iterables.getOnlyElement(scanner);
+          assertEquals("1", entry.getValue().toString());
+          long ts = entry.getKey().getTimestamp();
+
+          // test wrong colf
+          ConditionalMutation cm1 = new ConditionalMutation("99006",
+              new Condition("txA", "seq").setVisibility(cva).setValue("1"));
+          cm1.put("name", "last", cva, "Doe");
+          cm1.put("name", "first", cva, "John");
+          cm1.put("tx", "seq", cva, "2");
+          assertEquals(Status.REJECTED, cw.write(cm1).getStatus());
+
+          // test wrong colq
+          ConditionalMutation cm2 = new ConditionalMutation("99006",
+              new Condition("tx", "seqA").setVisibility(cva).setValue("1"));
+          cm2.put("name", "last", cva, "Doe");
+          cm2.put("name", "first", cva, "John");
+          cm2.put("tx", "seq", cva, "2");
+          assertEquals(Status.REJECTED, cw.write(cm2).getStatus());
+
+          // test wrong colv
+          ConditionalMutation cm3 = new ConditionalMutation("99006",
+              new Condition("tx", "seq").setVisibility(cvb).setValue("1"));
+          cm3.put("name", "last", cva, "Doe");
+          cm3.put("name", "first", cva, "John");
+          cm3.put("tx", "seq", cva, "2");
+          assertEquals(Status.REJECTED, cw.write(cm3).getStatus());
+
+          // test wrong timestamp
+          ConditionalMutation cm4 = new ConditionalMutation("99006",
+              new Condition("tx", "seq").setVisibility(cva).setTimestamp(ts + 1).setValue("1"));
+          cm4.put("name", "last", cva, "Doe");
+          cm4.put("name", "first", cva, "John");
+          cm4.put("tx", "seq", cva, "2");
+          assertEquals(Status.REJECTED, cw.write(cm4).getStatus());
+
+          // test wrong timestamp
+          ConditionalMutation cm5 = new ConditionalMutation("99006",
+              new Condition("tx", "seq").setVisibility(cva).setTimestamp(ts - 1).setValue("1"));
+          cm5.put("name", "last", cva, "Doe");
+          cm5.put("name", "first", cva, "John");
+          cm5.put("tx", "seq", cva, "2");
+          assertEquals(Status.REJECTED, cw.write(cm5).getStatus());
+
+          // ensure no updates were made
+          entry = Iterables.getOnlyElement(scanner);
+          assertEquals("1", entry.getValue().toString());
+
+          // set all columns correctly
+          ConditionalMutation cm6 = new ConditionalMutation("99006",
+              new Condition("tx", "seq").setVisibility(cva).setTimestamp(ts).setValue("1"));
+          cm6.put("name", "last", cva, "Doe");
+          cm6.put("name", "first", cva, "John");
+          cm6.put("tx", "seq", cva, "2");
+          assertEquals(Status.ACCEPTED, cw.write(cm6).getStatus());
+
+          entry = Iterables.getOnlyElement(scanner);
+          assertEquals("2", entry.getValue().toString());
+        }
+      }
+    }
+  }
 
-    Authorizations filteredAuths = new Authorizations("A");
+  @Test
+  public void testBadColVis() throws Exception {
+    // test when a user sets a col vis in a condition that can never be seen
 
-    ColumnVisibility cva = new ColumnVisibility("A");
-    ColumnVisibility cvb = new ColumnVisibility("B");
-    ColumnVisibility cvc = new ColumnVisibility("C");
+    try (AccumuloClient client = getAccumuloClient()) {
+      String tableName = getUniqueNames(1)[0];
 
-    try (ConditionalWriter cw = client.createConditionalWriter(tableName,
-        new ConditionalWriterConfig().setAuthorizations(filteredAuths))) {
+      client.tableOperations().create(tableName);
 
-      // User has authorization, but didn't include it in the writer
-      ConditionalMutation cm0 = new ConditionalMutation("99006",
-          new Condition("tx", "seq").setVisibility(cvb));
-      cm0.put("name", "last", cva, "doe");
-      cm0.put("name", "first", cva, "john");
-      cm0.put("tx", "seq", cva, "1");
-      assertEquals(Status.INVISIBLE_VISIBILITY, cw.write(cm0).getStatus());
-
-      ConditionalMutation cm1 = new ConditionalMutation("99006",
-          new Condition("tx", "seq").setVisibility(cvb).setValue("1"));
-      cm1.put("name", "last", cva, "doe");
-      cm1.put("name", "first", cva, "john");
-      cm1.put("tx", "seq", cva, "1");
-      assertEquals(Status.INVISIBLE_VISIBILITY, cw.write(cm1).getStatus());
-
-      // User does not have the authorization
-      ConditionalMutation cm2 = new ConditionalMutation("99006",
-          new Condition("tx", "seq").setVisibility(cvc));
-      cm2.put("name", "last", cva, "doe");
-      cm2.put("name", "first", cva, "john");
-      cm2.put("tx", "seq", cva, "1");
-      assertEquals(Status.INVISIBLE_VISIBILITY, cw.write(cm2).getStatus());
-
-      ConditionalMutation cm3 = new ConditionalMutation("99006",
-          new Condition("tx", "seq").setVisibility(cvc).setValue("1"));
-      cm3.put("name", "last", cva, "doe");
-      cm3.put("name", "first", cva, "john");
-      cm3.put("tx", "seq", cva, "1");
-      assertEquals(Status.INVISIBLE_VISIBILITY, cw.write(cm3).getStatus());
-
-      // if any visibility is bad, good visibilities don't override
-      ConditionalMutation cm4 = new ConditionalMutation("99006",
-          new Condition("tx", "seq").setVisibility(cvb),
-          new Condition("tx", "seq").setVisibility(cva));
-
-      cm4.put("name", "last", cva, "doe");
-      cm4.put("name", "first", cva, "john");
-      cm4.put("tx", "seq", cva, "1");
-      assertEquals(Status.INVISIBLE_VISIBILITY, cw.write(cm4).getStatus());
-
-      ConditionalMutation cm5 = new ConditionalMutation("99006",
-          new Condition("tx", "seq").setVisibility(cvb).setValue("1"),
-          new Condition("tx", "seq").setVisibility(cva).setValue("1"));
-      cm5.put("name", "last", cva, "doe");
-      cm5.put("name", "first", cva, "john");
-      cm5.put("tx", "seq", cva, "1");
-      assertEquals(Status.INVISIBLE_VISIBILITY, cw.write(cm5).getStatus());
-
-      ConditionalMutation cm6 = new ConditionalMutation("99006",
-          new Condition("tx", "seq").setVisibility(cvb).setValue("1"),
-          new Condition("tx", "seq").setVisibility(cva));
-      cm6.put("name", "last", cva, "doe");
-      cm6.put("name", "first", cva, "john");
-      cm6.put("tx", "seq", cva, "1");
-      assertEquals(Status.INVISIBLE_VISIBILITY, cw.write(cm6).getStatus());
-
-      ConditionalMutation cm7 = new ConditionalMutation("99006",
-          new Condition("tx", "seq").setVisibility(cvb),
-          new Condition("tx", "seq").setVisibility(cva).setValue("1"));
-      cm7.put("name", "last", cva, "doe");
-      cm7.put("name", "first", cva, "john");
-      cm7.put("tx", "seq", cva, "1");
-      assertEquals(Status.INVISIBLE_VISIBILITY, cw.write(cm7).getStatus());
+      Authorizations auths = new Authorizations("A", "B");
 
-    }
+      client.securityOperations().changeUserAuthorizations(getAdminPrincipal(), auths);
 
-    // test passing auths that exceed users configured auths
+      Authorizations filteredAuths = new Authorizations("A");
 
-    Authorizations exceedingAuths = new Authorizations("A", "B", "D");
-    try (ConditionalWriter cw2 = client.createConditionalWriter(tableName,
-        new ConditionalWriterConfig().setAuthorizations(exceedingAuths))) {
+      ColumnVisibility cva = new ColumnVisibility("A");
+      ColumnVisibility cvb = new ColumnVisibility("B");
+      ColumnVisibility cvc = new ColumnVisibility("C");
 
-      ConditionalMutation cm8 = new ConditionalMutation("99006",
-          new Condition("tx", "seq").setVisibility(cvb),
-          new Condition("tx", "seq").setVisibility(cva).setValue("1"));
-      cm8.put("name", "last", cva, "doe");
-      cm8.put("name", "first", cva, "john");
-      cm8.put("tx", "seq", cva, "1");
+      try (ConditionalWriter cw = client.createConditionalWriter(tableName,
+          new ConditionalWriterConfig().setAuthorizations(filteredAuths))) {
+
+        // User has authorization, but didn't include it in the writer
+        ConditionalMutation cm0 = new ConditionalMutation("99006",
+            new Condition("tx", "seq").setVisibility(cvb));
+        cm0.put("name", "last", cva, "doe");
+        cm0.put("name", "first", cva, "john");
+        cm0.put("tx", "seq", cva, "1");
+        assertEquals(Status.INVISIBLE_VISIBILITY, cw.write(cm0).getStatus());
+
+        ConditionalMutation cm1 = new ConditionalMutation("99006",
+            new Condition("tx", "seq").setVisibility(cvb).setValue("1"));
+        cm1.put("name", "last", cva, "doe");
+        cm1.put("name", "first", cva, "john");
+        cm1.put("tx", "seq", cva, "1");
+        assertEquals(Status.INVISIBLE_VISIBILITY, cw.write(cm1).getStatus());
+
+        // User does not have the authorization
+        ConditionalMutation cm2 = new ConditionalMutation("99006",
+            new Condition("tx", "seq").setVisibility(cvc));
+        cm2.put("name", "last", cva, "doe");
+        cm2.put("name", "first", cva, "john");
+        cm2.put("tx", "seq", cva, "1");
+        assertEquals(Status.INVISIBLE_VISIBILITY, cw.write(cm2).getStatus());
+
+        ConditionalMutation cm3 = new ConditionalMutation("99006",
+            new Condition("tx", "seq").setVisibility(cvc).setValue("1"));
+        cm3.put("name", "last", cva, "doe");
+        cm3.put("name", "first", cva, "john");
+        cm3.put("tx", "seq", cva, "1");
+        assertEquals(Status.INVISIBLE_VISIBILITY, cw.write(cm3).getStatus());
+
+        // if any visibility is bad, good visibilities don't override
+        ConditionalMutation cm4 = new ConditionalMutation("99006",
+            new Condition("tx", "seq").setVisibility(cvb),
+            new Condition("tx", "seq").setVisibility(cva));
+
+        cm4.put("name", "last", cva, "doe");
+        cm4.put("name", "first", cva, "john");
+        cm4.put("tx", "seq", cva, "1");
+        assertEquals(Status.INVISIBLE_VISIBILITY, cw.write(cm4).getStatus());
+
+        ConditionalMutation cm5 = new ConditionalMutation("99006",
+            new Condition("tx", "seq").setVisibility(cvb).setValue("1"),
+            new Condition("tx", "seq").setVisibility(cva).setValue("1"));
+        cm5.put("name", "last", cva, "doe");
+        cm5.put("name", "first", cva, "john");
+        cm5.put("tx", "seq", cva, "1");
+        assertEquals(Status.INVISIBLE_VISIBILITY, cw.write(cm5).getStatus());
+
+        ConditionalMutation cm6 = new ConditionalMutation("99006",
+            new Condition("tx", "seq").setVisibility(cvb).setValue("1"),
+            new Condition("tx", "seq").setVisibility(cva));
+        cm6.put("name", "last", cva, "doe");
+        cm6.put("name", "first", cva, "john");
+        cm6.put("tx", "seq", cva, "1");
+        assertEquals(Status.INVISIBLE_VISIBILITY, cw.write(cm6).getStatus());
+
+        ConditionalMutation cm7 = new ConditionalMutation("99006",
+            new Condition("tx", "seq").setVisibility(cvb),
+            new Condition("tx", "seq").setVisibility(cva).setValue("1"));
+        cm7.put("name", "last", cva, "doe");
+        cm7.put("name", "first", cva, "john");
+        cm7.put("tx", "seq", cva, "1");
+        assertEquals(Status.INVISIBLE_VISIBILITY, cw.write(cm7).getStatus());
 
-      try {
-        Status status = cw2.write(cm8).getStatus();
-        fail("Writing mutation with Authorizations the user doesn't have should fail. Got status: "
-            + status);
-      } catch (AccumuloSecurityException ase) {
-        // expected, check specific failure?
+      }
+
+      // test passing auths that exceed users configured auths
+
+      Authorizations exceedingAuths = new Authorizations("A", "B", "D");
+      try (ConditionalWriter cw2 = client.createConditionalWriter(tableName,
+          new ConditionalWriterConfig().setAuthorizations(exceedingAuths))) {
+
+        ConditionalMutation cm8 = new ConditionalMutation("99006",
+            new Condition("tx", "seq").setVisibility(cvb),
+            new Condition("tx", "seq").setVisibility(cva).setValue("1"));
+        cm8.put("name", "last", cva, "doe");
+        cm8.put("name", "first", cva, "john");
+        cm8.put("tx", "seq", cva, "1");
+
+        try {
+          Status status = cw2.write(cm8).getStatus();
+          fail(
+              "Writing mutation with Authorizations the user doesn't have should fail. Got status: "
+                  + status);
+        } catch (AccumuloSecurityException ase) {
+          // expected, check specific failure?
+        }
       }
     }
   }
@@ -453,141 +462,143 @@ public void testBadColVis() throws Exception {
   public void testConstraints() throws Exception {
     // ensure constraint violations are properly reported
 
-    AccumuloClient client = getAccumuloClient();
-    String tableName = getUniqueNames(1)[0];
+    try (AccumuloClient client = getAccumuloClient()) {
+      String tableName = getUniqueNames(1)[0];
 
-    client.tableOperations().create(tableName);
-    client.tableOperations().addConstraint(tableName, AlphaNumKeyConstraint.class.getName());
-    client.tableOperations().clone(tableName, tableName + "_clone", true, new HashMap<>(),
-        new HashSet<>());
+      client.tableOperations().create(tableName);
+      client.tableOperations().addConstraint(tableName, AlphaNumKeyConstraint.class.getName());
+      client.tableOperations().clone(tableName, tableName + "_clone", true, new HashMap<>(),
+          new HashSet<>());
 
-    try (
-        ConditionalWriter cw = client.createConditionalWriter(tableName + "_clone",
-            new ConditionalWriterConfig());
-        Scanner scanner = client.createScanner(tableName + "_clone", new Authorizations())) {
+      try (
+          ConditionalWriter cw = client.createConditionalWriter(tableName + "_clone",
+              new ConditionalWriterConfig());
+          Scanner scanner = client.createScanner(tableName + "_clone", new Authorizations())) {
 
-      ConditionalMutation cm0 = new ConditionalMutation("99006+", new Condition("tx", "seq"));
-      cm0.put("tx", "seq", "1");
+        ConditionalMutation cm0 = new ConditionalMutation("99006+", new Condition("tx", "seq"));
+        cm0.put("tx", "seq", "1");
 
-      assertEquals(Status.VIOLATED, cw.write(cm0).getStatus());
-      assertFalse("Should find no results in the table is mutation result was violated",
-          scanner.iterator().hasNext());
+        assertEquals(Status.VIOLATED, cw.write(cm0).getStatus());
+        assertFalse("Should find no results in the table is mutation result was violated",
+            scanner.iterator().hasNext());
 
-      ConditionalMutation cm1 = new ConditionalMutation("99006", new Condition("tx", "seq"));
-      cm1.put("tx", "seq", "1");
+        ConditionalMutation cm1 = new ConditionalMutation("99006", new Condition("tx", "seq"));
+        cm1.put("tx", "seq", "1");
 
-      assertEquals(Status.ACCEPTED, cw.write(cm1).getStatus());
-      assertTrue("Accepted result should be returned when reading table",
-          scanner.iterator().hasNext());
+        assertEquals(Status.ACCEPTED, cw.write(cm1).getStatus());
+        assertTrue("Accepted result should be returned when reading table",
+            scanner.iterator().hasNext());
+      }
     }
   }
 
   @Test
   public void testIterators() throws Exception {
 
-    AccumuloClient client = getAccumuloClient();
-    String tableName = getUniqueNames(1)[0];
+    try (AccumuloClient client = getAccumuloClient()) {
+      String tableName = getUniqueNames(1)[0];
 
-    client.tableOperations().create(tableName,
-        new NewTableConfiguration().withoutDefaultIterators());
+      client.tableOperations().create(tableName,
+          new NewTableConfiguration().withoutDefaultIterators());
 
-    BatchWriter bw = client.createBatchWriter(tableName, new BatchWriterConfig());
+      BatchWriter bw = client.createBatchWriter(tableName, new BatchWriterConfig());
 
-    Mutation m = new Mutation("ACCUMULO-1000");
-    m.put("count", "comments", "1");
-    bw.addMutation(m);
-    bw.addMutation(m);
-    bw.addMutation(m);
+      Mutation m = new Mutation("ACCUMULO-1000");
+      m.put("count", "comments", "1");
+      bw.addMutation(m);
+      bw.addMutation(m);
+      bw.addMutation(m);
 
-    m = new Mutation("ACCUMULO-1001");
-    m.put("count2", "comments", "1");
-    bw.addMutation(m);
-    bw.addMutation(m);
+      m = new Mutation("ACCUMULO-1001");
+      m.put("count2", "comments", "1");
+      bw.addMutation(m);
+      bw.addMutation(m);
 
-    m = new Mutation("ACCUMULO-1002");
-    m.put("count2", "comments", "1");
-    bw.addMutation(m);
-    bw.addMutation(m);
+      m = new Mutation("ACCUMULO-1002");
+      m.put("count2", "comments", "1");
+      bw.addMutation(m);
+      bw.addMutation(m);
 
-    bw.close();
+      bw.close();
 
-    IteratorSetting iterConfig = new IteratorSetting(10, SummingCombiner.class);
-    SummingCombiner.setEncodingType(iterConfig, Type.STRING);
-    SummingCombiner.setColumns(iterConfig,
-        Collections.singletonList(new IteratorSetting.Column("count")));
+      IteratorSetting iterConfig = new IteratorSetting(10, SummingCombiner.class);
+      SummingCombiner.setEncodingType(iterConfig, Type.STRING);
+      SummingCombiner.setColumns(iterConfig,
+          Collections.singletonList(new IteratorSetting.Column("count")));
 
-    IteratorSetting iterConfig2 = new IteratorSetting(10, SummingCombiner.class);
-    SummingCombiner.setEncodingType(iterConfig2, Type.STRING);
-    SummingCombiner.setColumns(iterConfig2,
-        Collections.singletonList(new IteratorSetting.Column("count2", "comments")));
+      IteratorSetting iterConfig2 = new IteratorSetting(10, SummingCombiner.class);
+      SummingCombiner.setEncodingType(iterConfig2, Type.STRING);
+      SummingCombiner.setColumns(iterConfig2,
+          Collections.singletonList(new IteratorSetting.Column("count2", "comments")));
 
-    IteratorSetting iterConfig3 = new IteratorSetting(5, VersioningIterator.class);
-    VersioningIterator.setMaxVersions(iterConfig3, 1);
+      IteratorSetting iterConfig3 = new IteratorSetting(5, VersioningIterator.class);
+      VersioningIterator.setMaxVersions(iterConfig3, 1);
 
-    try (Scanner scanner = client.createScanner(tableName, new Authorizations())) {
-      scanner.addScanIterator(iterConfig);
-      scanner.setRange(new Range("ACCUMULO-1000"));
-      scanner.fetchColumn(new Text("count"), new Text("comments"));
+      try (Scanner scanner = client.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);
-      assertEquals("3", entry.getValue().toString());
-
-      try (ConditionalWriter cw = client.createConditionalWriter(tableName,
-          new ConditionalWriterConfig())) {
-
-        ConditionalMutation cm0 = new ConditionalMutation("ACCUMULO-1000",
-            new Condition("count", "comments").setValue("3"));
-        cm0.put("count", "comments", "1");
-        assertEquals(Status.REJECTED, cw.write(cm0).getStatus());
-        entry = Iterables.getOnlyElement(scanner);
+        Entry<Key,Value> entry = Iterables.getOnlyElement(scanner);
         assertEquals("3", entry.getValue().toString());
 
-        ConditionalMutation cm1 = new ConditionalMutation("ACCUMULO-1000",
-            new Condition("count", "comments").setIterators(iterConfig).setValue("3"));
-        cm1.put("count", "comments", "1");
-        assertEquals(Status.ACCEPTED, cw.write(cm1).getStatus());
-        entry = Iterables.getOnlyElement(scanner);
-        assertEquals("4", entry.getValue().toString());
-
-        ConditionalMutation cm2 = new ConditionalMutation("ACCUMULO-1000",
-            new Condition("count", "comments").setValue("4"));
-        cm2.put("count", "comments", "1");
-        assertEquals(Status.REJECTED, cw.write(cm1).getStatus());
-        entry = Iterables.getOnlyElement(scanner);
-        assertEquals("4", entry.getValue().toString());
-
-        // 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");
+        try (ConditionalWriter cw = client.createConditionalWriter(tableName,
+            new ConditionalWriterConfig())) {
 
-        ConditionalMutation cm4 = new ConditionalMutation("ACCUMULO-1001",
-            new Condition("count2", "comments").setIterators(iterConfig2).setValue("2"));
-        cm4.put("count2", "comments", "1");
+          ConditionalMutation cm0 = new ConditionalMutation("ACCUMULO-1000",
+              new Condition("count", "comments").setValue("3"));
+          cm0.put("count", "comments", "1");
+          assertEquals(Status.REJECTED, cw.write(cm0).getStatus());
+          entry = Iterables.getOnlyElement(scanner);
+          assertEquals("3", entry.getValue().toString());
+
+          ConditionalMutation cm1 = new ConditionalMutation("ACCUMULO-1000",
+              new Condition("count", "comments").setIterators(iterConfig).setValue("3"));
+          cm1.put("count", "comments", "1");
+          assertEquals(Status.ACCEPTED, cw.write(cm1).getStatus());
+          entry = Iterables.getOnlyElement(scanner);
+          assertEquals("4", entry.getValue().toString());
+
+          ConditionalMutation cm2 = new ConditionalMutation("ACCUMULO-1000",
+              new Condition("count", "comments").setValue("4"));
+          cm2.put("count", "comments", "1");
+          assertEquals(Status.REJECTED, cw.write(cm1).getStatus());
+          entry = Iterables.getOnlyElement(scanner);
+          assertEquals("4", entry.getValue().toString());
+
+          // 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 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");
+
+          Iterator<Result> results = cw.write(Arrays.asList(cm3, cm4, cm5).iterator());
+          Map<String,Status> actual = new HashMap<>();
 
-        ConditionalMutation cm5 = new ConditionalMutation("ACCUMULO-1002",
-            new Condition("count2", "comments").setIterators(iterConfig2, iterConfig3)
-                .setValue("2"));
-        cm5.put("count2", "comments", "1");
+          while (results.hasNext()) {
+            Result result = results.next();
+            String k = new String(result.getMutation().getRow());
+            assertFalse("Did not expect to see multiple resultus for the row: " + k,
+                actual.containsKey(k));
+            actual.put(k, result.getStatus());
+          }
 
-        Iterator<Result> results = cw.write(Arrays.asList(cm3, cm4, cm5).iterator());
-        Map<String,Status> actual = new HashMap<>();
+          Map<String,Status> expected = new HashMap<>();
+          expected.put("ACCUMULO-1000", Status.ACCEPTED);
+          expected.put("ACCUMULO-1001", Status.ACCEPTED);
+          expected.put("ACCUMULO-1002", Status.REJECTED);
 
-        while (results.hasNext()) {
-          Result result = results.next();
-          String k = new String(result.getMutation().getRow());
-          assertFalse("Did not expect to see multiple resultus for the row: " + k,
-              actual.containsKey(k));
-          actual.put(k, result.getStatus());
+          assertEquals(expected, actual);
         }
-
-        Map<String,Status> expected = new HashMap<>();
-        expected.put("ACCUMULO-1000", Status.ACCEPTED);
-        expected.put("ACCUMULO-1001", Status.ACCEPTED);
-        expected.put("ACCUMULO-1002", Status.REJECTED);
-
-        assertEquals(expected, actual);
       }
     }
   }
@@ -634,374 +645,378 @@ public void init(SortedKeyValueIterator<Key,Value> source, Map<String,String> op
   public void testTableAndConditionIterators() throws Exception {
 
     // test w/ table that has iterators configured
-    AccumuloClient client = getAccumuloClient();
-    String tableName = getUniqueNames(1)[0];
+    try (AccumuloClient client = getAccumuloClient()) {
+      String tableName = getUniqueNames(1)[0];
 
-    IteratorSetting aiConfig1 = new IteratorSetting(30, "AI1", AddingIterator.class);
-    aiConfig1.addOption("amount", "2");
-    IteratorSetting aiConfig2 = new IteratorSetting(35, "MI1", MultiplyingIterator.class);
-    aiConfig2.addOption("amount", "3");
-    IteratorSetting aiConfig3 = new IteratorSetting(40, "AI2", AddingIterator.class);
-    aiConfig3.addOption("amount", "5");
+      IteratorSetting aiConfig1 = new IteratorSetting(30, "AI1", AddingIterator.class);
+      aiConfig1.addOption("amount", "2");
+      IteratorSetting aiConfig2 = new IteratorSetting(35, "MI1", MultiplyingIterator.class);
+      aiConfig2.addOption("amount", "3");
+      IteratorSetting aiConfig3 = new IteratorSetting(40, "AI2", AddingIterator.class);
+      aiConfig3.addOption("amount", "5");
 
-    client.tableOperations().create(tableName);
+      client.tableOperations().create(tableName);
 
-    BatchWriter bw = client.createBatchWriter(tableName, new BatchWriterConfig());
+      BatchWriter bw = client.createBatchWriter(tableName, new BatchWriterConfig());
 
-    Mutation m = new Mutation("ACCUMULO-1000");
-    m.put("count", "comments", "6");
-    bw.addMutation(m);
+      Mutation m = new Mutation("ACCUMULO-1000");
+      m.put("count", "comments", "6");
+      bw.addMutation(m);
 
-    m = new Mutation("ACCUMULO-1001");
-    m.put("count", "comments", "7");
-    bw.addMutation(m);
+      m = new Mutation("ACCUMULO-1001");
+      m.put("count", "comments", "7");
+      bw.addMutation(m);
 
-    m = new Mutation("ACCUMULO-1002");
-    m.put("count", "comments", "8");
-    bw.addMutation(m);
+      m = new Mutation("ACCUMULO-1002");
+      m.put("count", "comments", "8");
+      bw.addMutation(m);
 
-    bw.close();
+      bw.close();
 
-    client.tableOperations().attachIterator(tableName, aiConfig1, EnumSet.of(IteratorScope.scan));
-    client.tableOperations().offline(tableName, true);
-    client.tableOperations().online(tableName, true);
+      client.tableOperations().attachIterator(tableName, aiConfig1, EnumSet.of(IteratorScope.scan));
+      client.tableOperations().offline(tableName, true);
+      client.tableOperations().online(tableName, true);
 
-    try (
-        ConditionalWriter cw = client.createConditionalWriter(tableName,
-            new ConditionalWriterConfig());
-        Scanner scanner = client.createScanner(tableName, new Authorizations())) {
+      try (
+          ConditionalWriter cw = client.createConditionalWriter(tableName,
+              new ConditionalWriterConfig());
+          Scanner scanner = client.createScanner(tableName, new Authorizations())) {
 
-      ConditionalMutation cm6 = new ConditionalMutation("ACCUMULO-1000",
-          new Condition("count", "comments").setValue("8"));
-      cm6.put("count", "comments", "7");
-      assertEquals(Status.ACCEPTED, cw.write(cm6).getStatus());
+        ConditionalMutation cm6 = new ConditionalMutation("ACCUMULO-1000",
+            new Condition("count", "comments").setValue("8"));
+        cm6.put("count", "comments", "7");
+        assertEquals(Status.ACCEPTED, cw.write(cm6).getStatus());
 
-      scanner.setRange(new Range("ACCUMULO-1000"));
-      scanner.fetchColumn(new Text("count"), new Text("comments"));
+        scanner.setRange(new Range("ACCUMULO-1000"));
+        scanner.fetchColumn(new Text("count"), new Text("comments"));
+
+        Entry<Key,Value> entry = Iterables.getOnlyElement(scanner);
+        assertEquals("9", entry.getValue().toString());
 
-      Entry<Key,Value> entry = Iterables.getOnlyElement(scanner);
-      assertEquals("9", entry.getValue().toString());
+        ConditionalMutation cm7 = new ConditionalMutation("ACCUMULO-1000",
+            new Condition("count", "comments").setIterators(aiConfig2).setValue("27"));
+        cm7.put("count", "comments", "8");
+        assertEquals(Status.ACCEPTED, cw.write(cm7).getStatus());
 
-      ConditionalMutation cm7 = new ConditionalMutation("ACCUMULO-1000",
-          new Condition("count", "comments").setIterators(aiConfig2).setValue("27"));
-      cm7.put("count", "comments", "8");
-      assertEquals(Status.ACCEPTED, cw.write(cm7).getStatus());
+        entry = Iterables.getOnlyElement(scanner);
+        assertEquals("10", entry.getValue().toString());
 
-      entry = Iterables.getOnlyElement(scanner);
-      assertEquals("10", entry.getValue().toString());
+        ConditionalMutation cm8 = new ConditionalMutation("ACCUMULO-1000",
+            new Condition("count", "comments").setIterators(aiConfig2, aiConfig3).setValue("35"));
+        cm8.put("count", "comments", "9");
+        assertEquals(Status.ACCEPTED, cw.write(cm8).getStatus());
 
-      ConditionalMutation cm8 = new ConditionalMutation("ACCUMULO-1000",
-          new Condition("count", "comments").setIterators(aiConfig2, aiConfig3).setValue("35"));
-      cm8.put("count", "comments", "9");
-      assertEquals(Status.ACCEPTED, cw.write(cm8).getStatus());
+        entry = Iterables.getOnlyElement(scanner);
+        assertEquals("11", entry.getValue().toString());
 
-      entry = Iterables.getOnlyElement(scanner);
-      assertEquals("11", entry.getValue().toString());
+        ConditionalMutation cm3 = new ConditionalMutation("ACCUMULO-1000",
+            new Condition("count", "comments").setIterators(aiConfig2).setValue("33"));
+        cm3.put("count", "comments", "3");
 
-      ConditionalMutation cm3 = new ConditionalMutation("ACCUMULO-1000",
-          new Condition("count", "comments").setIterators(aiConfig2).setValue("33"));
-      cm3.put("count", "comments", "3");
+        ConditionalMutation cm4 = new ConditionalMutation("ACCUMULO-1001",
+            new Condition("count", "comments").setIterators(aiConfig3).setValue("14"));
+        cm4.put("count", "comments", "3");
 
-      ConditionalMutation cm4 = new ConditionalMutation("ACCUMULO-1001",
-          new Condition("count", "comments").setIterators(aiConfig3).setValue("14"));
-      cm4.put("count", "comments", "3");
+        ConditionalMutation cm5 = new ConditionalMutation("ACCUMULO-1002",
+            new Condition("count", "comments").setIterators(aiConfig3).setValue("10"));
+        cm5.put("count", "comments", "3");
 
-      ConditionalMutation cm5 = new ConditionalMutation("ACCUMULO-1002",
-          new Condition("count", "comments").setIterators(aiConfig3).setValue("10"));
-      cm5.put("count", "comments", "3");
+        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());
+          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());
-        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);
+        assertEquals(expected, actual);
       }
-
-      Map<String,Status> expected = new HashMap<>();
-      expected.put("ACCUMULO-1000", Status.ACCEPTED);
-      expected.put("ACCUMULO-1001", Status.ACCEPTED);
-      expected.put("ACCUMULO-1002", Status.REJECTED);
-      assertEquals(expected, actual);
     }
   }
 
   @Test
   public void testBatch() throws Exception {
 
-    AccumuloClient client = getAccumuloClient();
-    String tableName = getUniqueNames(1)[0];
-
-    client.tableOperations().create(tableName);
-
-    client.securityOperations().changeUserAuthorizations(getAdminPrincipal(),
-        new Authorizations("A", "B"));
-
-    ColumnVisibility cvab = new ColumnVisibility("A|B");
-
-    ArrayList<ConditionalMutation> mutations = new ArrayList<>();
-
-    ConditionalMutation cm0 = new ConditionalMutation("99006",
-        new Condition("tx", "seq").setVisibility(cvab));
-    cm0.put("name", "last", cvab, "doe");
-    cm0.put("name", "first", cvab, "john");
-    cm0.put("tx", "seq", cvab, "1");
-    mutations.add(cm0);
-
-    ConditionalMutation cm1 = new ConditionalMutation("59056",
-        new Condition("tx", "seq").setVisibility(cvab));
-    cm1.put("name", "last", cvab, "doe");
-    cm1.put("name", "first", cvab, "jane");
-    cm1.put("tx", "seq", cvab, "1");
-    mutations.add(cm1);
-
-    ConditionalMutation cm2 = new ConditionalMutation("19059",
-        new Condition("tx", "seq").setVisibility(cvab));
-    cm2.put("name", "last", cvab, "doe");
-    cm2.put("name", "first", cvab, "jack");
-    cm2.put("tx", "seq", cvab, "1");
-    mutations.add(cm2);
-
-    try (
-        ConditionalWriter cw = client.createConditionalWriter(tableName,
-            new ConditionalWriterConfig().setAuthorizations(new Authorizations("A")));
-        Scanner scanner = client.createScanner(tableName, new Authorizations("A"))) {
-      Iterator<Result> results = cw.write(mutations.iterator());
-      int count = 0;
-      while (results.hasNext()) {
-        Result result = results.next();
-        assertEquals(Status.ACCEPTED, result.getStatus());
-        count++;
-      }
+    try (AccumuloClient client = getAccumuloClient()) {
+      String tableName = getUniqueNames(1)[0];
 
-      assertEquals(3, count);
+      client.tableOperations().create(tableName);
 
-      scanner.fetchColumn(new Text("tx"), new Text("seq"));
+      client.securityOperations().changeUserAuthorizations(getAdminPrincipal(),
+          new Authorizations("A", "B"));
 
-      for (String row : new String[] {"99006", "59056", "19059"}) {
-        scanner.setRange(new Range(row));
-        Entry<Key,Value> entry = Iterables.getOnlyElement(scanner);
-        assertEquals("1", entry.getValue().toString());
-      }
+      ColumnVisibility cvab = new ColumnVisibility("A|B");
 
-      TreeSet<Text> splits = new TreeSet<>();
-      splits.add(new Text("7"));
-      splits.add(new Text("3"));
-      client.tableOperations().addSplits(tableName, splits);
+      ArrayList<ConditionalMutation> mutations = new ArrayList<>();
 
-      mutations.clear();
+      ConditionalMutation cm0 = new ConditionalMutation("99006",
+          new Condition("tx", "seq").setVisibility(cvab));
+      cm0.put("name", "last", cvab, "doe");
+      cm0.put("name", "first", cvab, "john");
+      cm0.put("tx", "seq", cvab, "1");
+      mutations.add(cm0);
 
-      ConditionalMutation cm3 = new ConditionalMutation("99006",
-          new Condition("tx", "seq").setVisibility(cvab).setValue("1"));
-      cm3.put("name", "last", cvab, "Doe");
-      cm3.put("tx", "seq", cvab, "2");
-      mutations.add(cm3);
+      ConditionalMutation cm1 = new ConditionalMutation("59056",
+          new Condition("tx", "seq").setVisibility(cvab));
+      cm1.put("name", "last", cvab, "doe");
+      cm1.put("name", "first", cvab, "jane");
+      cm1.put("tx", "seq", cvab, "1");
+      mutations.add(cm1);
 
-      ConditionalMutation cm4 = new ConditionalMutation("59056",
+      ConditionalMutation cm2 = new ConditionalMutation("19059",
           new Condition("tx", "seq").setVisibility(cvab));
-      cm4.put("name", "last", cvab, "Doe");
-      cm4.put("tx", "seq", cvab, "1");
-      mutations.add(cm4);
-
-      ConditionalMutation cm5 = new ConditionalMutation("19059",
-          new Condition("tx", "seq").setVisibility(cvab).setValue("2"));
-      cm5.put("name", "last", cvab, "Doe");
-      cm5.put("tx", "seq", cvab, "3");
-      mutations.add(cm5);
-
-      results = cw.write(mutations.iterator());
-      int accepted = 0;
-      int rejected = 0;
-      while (results.hasNext()) {
-        Result result = results.next();
-        if (new String(result.getMutation().getRow()).equals("99006")) {
+      cm2.put("name", "last", cvab, "doe");
+      cm2.put("name", "first", cvab, "jack");
+      cm2.put("tx", "seq", cvab, "1");
+      mutations.add(cm2);
+
+      try (
+          ConditionalWriter cw = client.createConditionalWriter(tableName,
+              new ConditionalWriterConfig().setAuthorizations(new Authorizations("A")));
+          Scanner scanner = client.createScanner(tableName, new Authorizations("A"))) {
+        Iterator<Result> results = cw.write(mutations.iterator());
+        int count = 0;
+        while (results.hasNext()) {
+          Result result = results.next();
           assertEquals(Status.ACCEPTED, result.getStatus());
-          accepted++;
-        } else {
-          assertEquals(Status.REJECTED, result.getStatus());
-          rejected++;
+          count++;
         }
-      }
 
-      assertEquals("Expected only one accepted conditional mutation", 1, accepted);
-      assertEquals("Expected two rejected conditional mutations", 2, rejected);
+        assertEquals(3, count);
 
-      for (String row : new String[] {"59056", "19059"}) {
-        scanner.setRange(new Range(row));
-        Entry<Key,Value> entry = Iterables.getOnlyElement(scanner);
-        assertEquals("1", entry.getValue().toString());
-      }
+        scanner.fetchColumn(new Text("tx"), new Text("seq"));
+
+        for (String row : new String[] {"99006", "59056", "19059"}) {
+          scanner.setRange(new Range(row));
+          Entry<Key,Value> entry = Iterables.getOnlyElement(scanner);
+          assertEquals("1", entry.getValue().toString());
+        }
 
-      scanner.setRange(new Range("99006"));
-      Entry<Key,Value> entry = Iterables.getOnlyElement(scanner);
-      assertEquals("2", entry.getValue().toString());
+        TreeSet<Text> splits = new TreeSet<>();
+        splits.add(new Text("7"));
+        splits.add(new Text("3"));
+        client.tableOperations().addSplits(tableName, splits);
+
+        mutations.clear();
+
+        ConditionalMutation cm3 = new ConditionalMutation("99006",
+            new Condition("tx", "seq").setVisibility(cvab).setValue("1"));
+        cm3.put("name", "last", cvab, "Doe");
+        cm3.put("tx", "seq", cvab, "2");
+        mutations.add(cm3);
+
+        ConditionalMutation cm4 = new ConditionalMutation("59056",
+            new Condition("tx", "seq").setVisibility(cvab));
+        cm4.put("name", "last", cvab, "Doe");
+        cm4.put("tx", "seq", cvab, "1");
+        mutations.add(cm4);
+
+        ConditionalMutation cm5 = new ConditionalMutation("19059",
+            new Condition("tx", "seq").setVisibility(cvab).setValue("2"));
+        cm5.put("name", "last", cvab, "Doe");
+        cm5.put("tx", "seq", cvab, "3");
+        mutations.add(cm5);
+
+        results = cw.write(mutations.iterator());
+        int accepted = 0;
+        int rejected = 0;
+        while (results.hasNext()) {
+          Result result = results.next();
+          if (new String(result.getMutation().getRow()).equals("99006")) {
+            assertEquals(Status.ACCEPTED, result.getStatus());
+            accepted++;
+          } else {
+            assertEquals(Status.REJECTED, result.getStatus());
+            rejected++;
+          }
+        }
 
-      scanner.clearColumns();
-      scanner.fetchColumn(new Text("name"), new Text("last"));
-      entry = Iterables.getOnlyElement(scanner);
-      assertEquals("Doe", entry.getValue().toString());
+        assertEquals("Expected only one accepted conditional mutation", 1, accepted);
+        assertEquals("Expected two rejected conditional mutations", 2, rejected);
+
+        for (String row : new String[] {"59056", "19059"}) {
+          scanner.setRange(new Range(row));
+          Entry<Key,Value> entry = Iterables.getOnlyElement(scanner);
+          assertEquals("1", entry.getValue().toString());
+        }
+
+        scanner.setRange(new Range("99006"));
+        Entry<Key,Value> entry = Iterables.getOnlyElement(scanner);
+        assertEquals("2", entry.getValue().toString());
+
+        scanner.clearColumns();
+        scanner.fetchColumn(new Text("name"), new Text("last"));
+        entry = Iterables.getOnlyElement(scanner);
+        assertEquals("Doe", entry.getValue().toString());
+      }
     }
   }
 
   @Test
   public void testBigBatch() throws Exception {
 
-    AccumuloClient client = getAccumuloClient();
-    String tableName = getUniqueNames(1)[0];
+    try (AccumuloClient client = getAccumuloClient()) {
+      String tableName = getUniqueNames(1)[0];
 
-    client.tableOperations().create(tableName);
-    client.tableOperations().addSplits(tableName, nss("2", "4", "6"));
+      client.tableOperations().create(tableName);
+      client.tableOperations().addSplits(tableName, nss("2", "4", "6"));
 
-    sleepUninterruptibly(2, TimeUnit.SECONDS);
+      sleepUninterruptibly(2, TimeUnit.SECONDS);
 
-    int num = 100;
+      int num = 100;
 
-    ArrayList<byte[]> rows = new ArrayList<>(num);
-    ArrayList<ConditionalMutation> cml = new ArrayList<>(num);
+      ArrayList<byte[]> rows = new ArrayList<>(num);
+      ArrayList<ConditionalMutation> cml = new ArrayList<>(num);
 
-    Random r = new SecureRandom();
-    byte[] e = new byte[0];
+      Random r = new SecureRandom();
+      byte[] e = new byte[0];
 
-    for (int i = 0; i < num; i++) {
-      rows.add(FastFormat.toZeroPaddedString(abs(r.nextLong()), 16, 16, e));
-    }
+      for (int i = 0; i < num; i++) {
+        rows.add(FastFormat.toZeroPaddedString(abs(r.nextLong()), 16, 16, e));
+      }
+
+      for (int i = 0; i < num; i++) {
+        ConditionalMutation cm = new ConditionalMutation(rows.get(i), new Condition("meta", "seq"));
 
-    for (int i = 0; i < num; i++) {
-      ConditionalMutation cm = new ConditionalMutation(rows.get(i), new Condition("meta", "seq"));
+        cm.put("meta", "seq", "1");
+        cm.put("meta", "tx", UUID.randomUUID().toString());
 
-      cm.put("meta", "seq", "1");
-      cm.put("meta", "tx", UUID.randomUUID().toString());
+        cml.add(cm);
+      }
 
-      cml.add(cm);
-    }
+      try (ConditionalWriter cw = client.createConditionalWriter(tableName,
+          new ConditionalWriterConfig())) {
 
-    try (ConditionalWriter cw = client.createConditionalWriter(tableName,
-        new ConditionalWriterConfig())) {
+        Iterator<Result> results = cw.write(cml.iterator());
 
-      Iterator<Result> results = cw.write(cml.iterator());
+        int count = 0;
 
-      int count = 0;
+        // TODO check got each row back
+        while (results.hasNext()) {
+          Result result = results.next();
+          assertEquals(Status.ACCEPTED, result.getStatus());
+          count++;
+        }
 
-      // TODO check got each row back
-      while (results.hasNext()) {
-        Result result = results.next();
-        assertEquals(Status.ACCEPTED, result.getStatus());
-        count++;
-      }
+        assertEquals("Did not receive the expected number of results", num, count);
 
-      assertEquals("Did not receive the expected number of results", num, count);
+        ArrayList<ConditionalMutation> cml2 = new ArrayList<>(num);
 
-      ArrayList<ConditionalMutation> cml2 = new ArrayList<>(num);
+        for (int i = 0; i < num; i++) {
+          ConditionalMutation cm = new ConditionalMutation(rows.get(i),
+              new Condition("meta", "seq").setValue("1"));
 
-      for (int i = 0; i < num; i++) {
-        ConditionalMutation cm = new ConditionalMutation(rows.get(i),
-            new Condition("meta", "seq").setValue("1"));
+          cm.put("meta", "seq", "2");
+          cm.put("meta", "tx", UUID.randomUUID().toString());
 
-        cm.put("meta", "seq", "2");
-        cm.put("meta", "tx", UUID.randomUUID().toString());
+          cml2.add(cm);
+        }
 
-        cml2.add(cm);
-      }
+        count = 0;
 
-      count = 0;
+        results = cw.write(cml2.iterator());
 
-      results = cw.write(cml2.iterator());
+        while (results.hasNext()) {
+          Result result = results.next();
+          assertEquals(Status.ACCEPTED, result.getStatus());
+          count++;
+        }
 
-      while (results.hasNext()) {
-        Result result = results.next();
-        assertEquals(Status.ACCEPTED, result.getStatus());
-        count++;
+        assertEquals("Did not receive the expected number of results", num, count);
       }
-
-      assertEquals("Did not receive the expected number of results", num, count);
     }
   }
 
   @Test
   public void testBatchErrors() throws Exception {
 
-    AccumuloClient client = getAccumuloClient();
-    String tableName = getUniqueNames(1)[0];
+    try (AccumuloClient client = getAccumuloClient()) {
+      String tableName = getUniqueNames(1)[0];
 
-    client.tableOperations().create(tableName);
-    client.tableOperations().addConstraint(tableName, AlphaNumKeyConstraint.class.getName());
-    client.tableOperations().clone(tableName, tableName + "_clone", true, new HashMap<>(),
-        new HashSet<>());
+      client.tableOperations().create(tableName);
+      client.tableOperations().addConstraint(tableName, AlphaNumKeyConstraint.class.getName());
+      client.tableOperations().clone(tableName, tableName + "_clone", true, new HashMap<>(),
+          new HashSet<>());
 
-    client.securityOperations().changeUserAuthorizations(getAdminPrincipal(),
-        new Authorizations("A", "B"));
+      client.securityOperations().changeUserAuthorizations(getAdminPrincipal(),
+          new Authorizations("A", "B"));
 
-    ColumnVisibility cvaob = new ColumnVisibility("A|B");
-    ColumnVisibility cvaab = new ColumnVisibility("A&B");
+      ColumnVisibility cvaob = new ColumnVisibility("A|B");
+      ColumnVisibility cvaab = new ColumnVisibility("A&B");
 
-    switch ((new SecureRandom()).nextInt(3)) {
-      case 1:
-        client.tableOperations().addSplits(tableName, nss("6"));
-        break;
-      case 2:
-        client.tableOperations().addSplits(tableName, nss("2", "95"));
-        break;
-    }
+      switch ((new SecureRandom()).nextInt(3)) {
+        case 1:
+          client.tableOperations().addSplits(tableName, nss("6"));
+          break;
+        case 2:
+          client.tableOperations().addSplits(tableName, nss("2", "95"));
+          break;
+      }
 
-    ArrayList<ConditionalMutation> mutations = new ArrayList<>();
-
-    ConditionalMutation cm0 = new ConditionalMutation("99006",
-        new Condition("tx", "seq").setVisibility(cvaob));
-    cm0.put("name+", "last", cvaob, "doe");
-    cm0.put("name", "first", cvaob, "john");
-    cm0.put("tx", "seq", cvaob, "1");
-    mutations.add(cm0);
-
-    ConditionalMutation cm1 = new ConditionalMutation("59056",
-        new Condition("tx", "seq").setVisibility(cvaab));
-    cm1.put("name", "last", cvaab, "doe");
-    cm1.put("name", "first", cvaab, "jane");
-    cm1.put("tx", "seq", cvaab, "1");
-    mutations.add(cm1);
-
-    ConditionalMutation cm2 = new ConditionalMutation("19059",
-        new Condition("tx", "seq").setVisibility(cvaob));
-    cm2.put("name", "last", cvaob, "doe");
-    cm2.put("name", "first", cvaob, "jack");
-    cm2.put("tx", "seq", cvaob, "1");
-    mutations.add(cm2);
-
-    ConditionalMutation cm3 = new ConditionalMutation("90909",
-        new Condition("tx", "seq").setVisibility(cvaob).setValue("1"));
-    cm3.put("name", "last", cvaob, "doe");
-    cm3.put("name", "first", cvaob, "john");
-    cm3.put("tx", "seq", cvaob, "2");
-    mutations.add(cm3);
-
-    try (
-        ConditionalWriter cw = client.createConditionalWriter(tableName,
-            new ConditionalWriterConfig().setAuthorizations(new Authorizations("A")));
-        Scanner scanner = client.createScanner(tableName, new Authorizations("A"))) {
-      Iterator<Result> results = cw.write(mutations.iterator());
-      HashSet<String> rows = new HashSet<>();
-      while (results.hasNext()) {
-        Result result = results.next();
-        String row = new String(result.getMutation().getRow());
-        if (row.equals("19059")) {
-          assertEquals(Status.ACCEPTED, result.getStatus());
-        } else if (row.equals("59056")) {
-          assertEquals(Status.INVISIBLE_VISIBILITY, result.getStatus());
-        } else if (row.equals("99006")) {
-          assertEquals(Status.VIOLATED, result.getStatus());
-        } else if (row.equals("90909")) {
-          assertEquals(Status.REJECTED, result.getStatus());
+      ArrayList<ConditionalMutation> mutations = new ArrayList<>();
+
+      ConditionalMutation cm0 = new ConditionalMutation("99006",
+          new Condition("tx", "seq").setVisibility(cvaob));
+      cm0.put("name+", "last", cvaob, "doe");
+      cm0.put("name", "first", cvaob, "john");
+      cm0.put("tx", "seq", cvaob, "1");
+      mutations.add(cm0);
+
+      ConditionalMutation cm1 = new ConditionalMutation("59056",
+          new Condition("tx", "seq").setVisibility(cvaab));
+      cm1.put("name", "last", cvaab, "doe");
+      cm1.put("name", "first", cvaab, "jane");
+      cm1.put("tx", "seq", cvaab, "1");
+      mutations.add(cm1);
+
+      ConditionalMutation cm2 = new ConditionalMutation("19059",
+          new Condition("tx", "seq").setVisibility(cvaob));
+      cm2.put("name", "last", cvaob, "doe");
+      cm2.put("name", "first", cvaob, "jack");
+      cm2.put("tx", "seq", cvaob, "1");
+      mutations.add(cm2);
+
+      ConditionalMutation cm3 = new ConditionalMutation("90909",
+          new Condition("tx", "seq").setVisibility(cvaob).setValue("1"));
+      cm3.put("name", "last", cvaob, "doe");
+      cm3.put("name", "first", cvaob, "john");
+      cm3.put("tx", "seq", cvaob, "2");
+      mutations.add(cm3);
+
+      try (
+          ConditionalWriter cw = client.createConditionalWriter(tableName,
+              new ConditionalWriterConfig().setAuthorizations(new Authorizations("A")));
+          Scanner scanner = client.createScanner(tableName, new Authorizations("A"))) {
+        Iterator<Result> results = cw.write(mutations.iterator());
+        HashSet<String> rows = new HashSet<>();
+        while (results.hasNext()) {
+          Result result = results.next();
+          String row = new String(result.getMutation().getRow());
+          if (row.equals("19059")) {
+            assertEquals(Status.ACCEPTED, result.getStatus());
+          } else if (row.equals("59056")) {
+            assertEquals(Status.INVISIBLE_VISIBILITY, result.getStatus());
+          } else if (row.equals("99006")) {
+            assertEquals(Status.VIOLATED, result.getStatus());
+          } else if (row.equals("90909")) {
+            assertEquals(Status.REJECTED, result.getStatus());
+          }
+          rows.add(row);
         }
-        rows.add(row);
-      }
 
-      assertEquals(4, rows.size());
+        assertEquals(4, rows.size());
 
-      scanner.fetchColumn(new Text("tx"), new Text("seq"));
-      Entry<Key,Value> entry = Iterables.getOnlyElement(scanner);
-      assertEquals("1", entry.getValue().toString());
+        scanner.fetchColumn(new Text("tx"), new Text("seq"));
+        Entry<Key,Value> entry = Iterables.getOnlyElement(scanner);
+        assertEquals("1", entry.getValue().toString());
+      }
     }
   }
 
@@ -1009,53 +1024,54 @@ public void testBatchErrors() throws Exception {
   public void testSameRow() throws Exception {
     // test multiple mutations for same row in same batch
 
-    AccumuloClient client = getAccumuloClient();
-    String tableName = getUniqueNames(1)[0];
+    try (AccumuloClient client = getAccumuloClient()) {
+      String tableName = getUniqueNames(1)[0];
 
-    client.tableOperations().create(tableName);
+      client.tableOperations().create(tableName);
 
-    try (ConditionalWriter cw = client.createConditionalWriter(tableName,
-        new ConditionalWriterConfig())) {
+      try (ConditionalWriter cw = client.createConditionalWriter(tableName,
+          new ConditionalWriterConfig())) {
 
-      ConditionalMutation cm1 = new ConditionalMutation("r1", new Condition("tx", "seq"));
-      cm1.put("tx", "seq", "1");
-      cm1.put("data", "x", "a");
+        ConditionalMutation cm1 = new ConditionalMutation("r1", new Condition("tx", "seq"));
+        cm1.put("tx", "seq", "1");
+        cm1.put("data", "x", "a");
 
-      assertEquals(Status.ACCEPTED, cw.write(cm1).getStatus());
+        assertEquals(Status.ACCEPTED, cw.write(cm1).getStatus());
 
-      ConditionalMutation cm2 = new ConditionalMutation("r1",
-          new Condition("tx", "seq").setValue("1"));
-      cm2.put("tx", "seq", "2");
-      cm2.put("data", "x", "b");
+        ConditionalMutation cm2 = new ConditionalMutation("r1",
+            new Condition("tx", "seq").setValue("1"));
+        cm2.put("tx", "seq", "2");
+        cm2.put("data", "x", "b");
 
-      ConditionalMutation cm3 = new ConditionalMutation("r1",
-          new Condition("tx", "seq").setValue("1"));
-      cm3.put("tx", "seq", "2");
-      cm3.put("data", "x", "c");
+        ConditionalMutation cm3 = new ConditionalMutation("r1",
+            new Condition("tx", "seq").setValue("1"));
+        cm3.put("tx", "seq", "2");
+        cm3.put("data", "x", "c");
 
-      ConditionalMutation cm4 = new ConditionalMutation("r1",
-          new Condition("tx", "seq").setValue("1"));
-      cm4.put("tx", "seq", "2");
-      cm4.put("data", "x", "d");
+        ConditionalMutation cm4 = new ConditionalMutation("r1",
+            new Condition("tx", "seq").setValue("1"));
+        cm4.put("tx", "seq", "2");
+        cm4.put("data", "x", "d");
 
-      Iterator<Result> results = cw.write(Arrays.asList(cm2, cm3, cm4).iterator());
+        Iterator<Result> results = cw.write(Arrays.asList(cm2, cm3, cm4).iterator());
 
-      int accepted = 0;
-      int rejected = 0;
-      int total = 0;
+        int accepted = 0;
+        int rejected = 0;
+        int total = 0;
 
-      while (results.hasNext()) {
-        Status status = results.next().getStatus();
-        if (status == Status.ACCEPTED)
-          accepted++;
-        if (status == Status.REJECTED)
-          rejected++;
-        total++;
-      }
+        while (results.hasNext()) {
+          Status status = results.next().getStatus();
+          if (status == Status.ACCEPTED)
+            accepted++;
+          if (status == Status.REJECTED)
+            rejected++;
+          total++;
+        }
 
-      assertEquals("Expected one accepted result", 1, accepted);
-      assertEquals("Expected two rejected results", 2, rejected);
-      assertEquals("Expected three total results", 3, total);
+        assertEquals("Expected one accepted result", 1, accepted);
+        assertEquals("Expected two rejected results", 2, rejected);
+        assertEquals("Expected three total results", 3, total);
+      }
     }
   }
 
@@ -1196,71 +1212,72 @@ public void testThreads() throws Exception {
     // test multiple threads using a single conditional writer
 
     String tableName = getUniqueNames(1)[0];
-    AccumuloClient client = getAccumuloClient();
+    try (AccumuloClient client = getAccumuloClient()) {
 
-    client.tableOperations().create(tableName);
+      client.tableOperations().create(tableName);
 
-    Random rand = new SecureRandom();
+      Random rand = new SecureRandom();
 
-    switch (rand.nextInt(3)) {
-      case 1:
-        client.tableOperations().addSplits(tableName, nss("4"));
-        break;
-      case 2:
-        client.tableOperations().addSplits(tableName, nss("3", "5"));
-        break;
-    }
+      switch (rand.nextInt(3)) {
+        case 1:
+          client.tableOperations().addSplits(tableName, nss("4"));
+          break;
+        case 2:
+          client.tableOperations().addSplits(tableName, nss("3", "5"));
+          break;
+      }
 
-    try (ConditionalWriter cw = client.createConditionalWriter(tableName,
-        new ConditionalWriterConfig())) {
+      try (ConditionalWriter cw = client.createConditionalWriter(tableName,
+          new ConditionalWriterConfig())) {
 
-      ArrayList<ByteSequence> rows = new ArrayList<>();
+        ArrayList<ByteSequence> rows = new ArrayList<>();
 
-      for (int i = 0; i < 1000; i++) {
-        rows.add(new ArrayByteSequence(
-            FastFormat.toZeroPaddedString(abs(rand.nextLong()), 16, 16, new byte[0])));
-      }
+        for (int i = 0; i < 1000; i++) {
+          rows.add(new ArrayByteSequence(
+              FastFormat.toZeroPaddedString(abs(rand.nextLong()), 16, 16, new byte[0])));
+        }
 
-      ArrayList<ConditionalMutation> mutations = new ArrayList<>();
+        ArrayList<ConditionalMutation> mutations = new ArrayList<>();
 
-      for (ByteSequence row : rows)
-        mutations.add(new Stats(row).toMutation());
+        for (ByteSequence row : rows)
+          mutations.add(new Stats(row).toMutation());
 
-      ArrayList<ByteSequence> rows2 = new ArrayList<>();
-      Iterator<Result> results = cw.write(mutations.iterator());
-      while (results.hasNext()) {
-        Result result = results.next();
-        assertEquals(Status.ACCEPTED, result.getStatus());
-        rows2.add(new ArrayByteSequence(result.getMutation().getRow()));
-      }
+        ArrayList<ByteSequence> rows2 = new ArrayList<>();
+        Iterator<Result> results = cw.write(mutations.iterator());
+        while (results.hasNext()) {
+          Result result = results.next();
+          assertEquals(Status.ACCEPTED, result.getStatus());
+          rows2.add(new ArrayByteSequence(result.getMutation().getRow()));
+        }
 
-      Collections.sort(rows);
-      Collections.sort(rows2);
+        Collections.sort(rows);
+        Collections.sort(rows2);
 
-      assertEquals(rows, rows2);
+        assertEquals(rows, rows2);
 
-      AtomicBoolean failed = new AtomicBoolean(false);
+        AtomicBoolean failed = new AtomicBoolean(false);
 
-      ExecutorService tp = Executors.newFixedThreadPool(5);
-      for (int i = 0; i < 5; i++) {
-        tp.submit(new MutatorTask(tableName, client, rows, cw, failed));
-      }
+        ExecutorService tp = Executors.newFixedThreadPool(5);
+        for (int i = 0; i < 5; i++) {
+          tp.submit(new MutatorTask(tableName, client, rows, cw, failed));
+        }
 
-      tp.shutdown();
+        tp.shutdown();
 
-      while (!tp.isTerminated()) {
-        tp.awaitTermination(1, TimeUnit.MINUTES);
-      }
+        while (!tp.isTerminated()) {
+          tp.awaitTermination(1, TimeUnit.MINUTES);
+        }
 
-      assertFalse("A MutatorTask failed with an exception", failed.get());
-    }
+        assertFalse("A MutatorTask failed with an exception", failed.get());
+      }
 
-    try (Scanner scanner = client.createScanner(tableName, Authorizations.EMPTY)) {
-      RowIterator rowIter = new RowIterator(scanner);
+      try (Scanner scanner = client.createScanner(tableName, Authorizations.EMPTY)) {
+        RowIterator rowIter = new RowIterator(scanner);
 
-      while (rowIter.hasNext()) {
-        Iterator<Entry<Key,Value>> row = rowIter.next();
-        new Stats(row);
+        while (rowIter.hasNext()) {
+          Iterator<Entry<Key,Value>> row = rowIter.next();
+          new Stats(row);
+        }
       }
     }
   }
@@ -1276,150 +1293,150 @@ public void testThreads() throws Exception {
   @Test
   public void testSecurity() throws Exception {
     // test against table user does not have read and/or write permissions for
-    AccumuloClient client = getAccumuloClient();
-    String user = null;
-
-    // Create a new user
-    ClusterUser user1 = getUser(0);
-    user = user1.getPrincipal();
-    if (saslEnabled()) {
-      client.securityOperations().createLocalUser(user, null);
-    } else {
-      client.securityOperations().createLocalUser(user, new PasswordToken(user1.getPassword()));
-    }
+    try (AccumuloClient client = getAccumuloClient()) {
+      String user = null;
+
+      // Create a new user
+      ClusterUser user1 = getUser(0);
+      user = user1.getPrincipal();
+      if (saslEnabled()) {
+        client.securityOperations().createLocalUser(user, null);
+      } else {
+        client.securityOperations().createLocalUser(user, new PasswordToken(user1.getPassword()));
+      }
 
-    String[] tables = getUniqueNames(3);
-    String table1 = tables[0], table2 = tables[1], table3 = tables[2];
-
-    // Create three tables
-    client.tableOperations().create(table1);
-    client.tableOperations().create(table2);
-    client.tableOperations().create(table3);
-
-    // Grant R on table1, W on table2, R/W on table3
-    client.securityOperations().grantTablePermission(user, table1, TablePermission.READ);
-    client.securityOperations().grantTablePermission(user, table2, TablePermission.WRITE);
-    client.securityOperations().grantTablePermission(user, table3, TablePermission.READ);
-    client.securityOperations().grantTablePermission(user, table3, TablePermission.WRITE);
-
-    // Login as the user
-    AccumuloClient conn2 = client.changeUser(user, user1.getToken());
-
-    ConditionalMutation cm1 = new ConditionalMutation("r1", new Condition("tx", "seq"));
-    cm1.put("tx", "seq", "1");
-    cm1.put("data", "x", "a");
-
-    try (
-        ConditionalWriter cw1 = conn2.createConditionalWriter(table1,
-            new ConditionalWriterConfig());
-        ConditionalWriter cw2 = conn2.createConditionalWriter(table2,
-            new ConditionalWriterConfig());
-        ConditionalWriter cw3 = conn2.createConditionalWriter(table3,
-            new ConditionalWriterConfig())) {
+      String[] tables = getUniqueNames(3);
+      String table1 = tables[0], table2 = tables[1], table3 = tables[2];
 
-      // Should be able to conditional-update a table we have R/W on
-      assertEquals(Status.ACCEPTED, cw3.write(cm1).getStatus());
+      // Create three tables
+      client.tableOperations().create(table1);
+      client.tableOperations().create(table2);
+      client.tableOperations().create(table3);
 
-      // Conditional-update to a table we only have read on should fail
-      try {
-        Status status = cw1.write(cm1).getStatus();
-        fail("Expected exception writing conditional mutation to table"
-            + " the user doesn't have write access to, Got status: " + status);
-      } catch (AccumuloSecurityException ase) {
+      // Grant R on table1, W on table2, R/W on table3
+      client.securityOperations().grantTablePermission(user, table1, TablePermission.READ);
+      client.securityOperations().grantTablePermission(user, table2, TablePermission.WRITE);
+      client.securityOperations().grantTablePermission(user, table3, TablePermission.READ);
+      client.securityOperations().grantTablePermission(user, table3, TablePermission.WRITE);
 
-      }
+      ConditionalMutation cm1 = new ConditionalMutation("r1", new Condition("tx", "seq"));
+      cm1.put("tx", "seq", "1");
+      cm1.put("data", "x", "a");
 
-      // Conditional-update to a table we only have writer on should fail
-      try {
-        Status status = cw2.write(cm1).getStatus();
-        fail("Expected exception writing conditional mutation to table"
-            + " the user doesn't have read access to. Got status: " + status);
-      } catch (AccumuloSecurityException ase) {
+      try (AccumuloClient conn2 = client.changeUser(user, user1.getToken());
+          ConditionalWriter cw1 = conn2.createConditionalWriter(table1,
+              new ConditionalWriterConfig());
+          ConditionalWriter cw2 = conn2.createConditionalWriter(table2,
+              new ConditionalWriterConfig());
+          ConditionalWriter cw3 = conn2.createConditionalWriter(table3,
+              new ConditionalWriterConfig())) {
+
+        // Should be able to conditional-update a table we have R/W on
+        assertEquals(Status.ACCEPTED, cw3.write(cm1).getStatus());
+
+        // Conditional-update to a table we only have read on should fail
+        try {
+          Status status = cw1.write(cm1).getStatus();
+          fail("Expected exception writing conditional mutation to table"
+              + " the user doesn't have write access to, Got status: " + status);
+        } catch (AccumuloSecurityException ase) {
+
+        }
+
+        // Conditional-update to a table we only have writer on should fail
+        try {
+          Status status = cw2.write(cm1).getStatus();
+          fail("Expected exception writing conditional mutation to table"
+              + " the user doesn't have read access to. Got status: " + status);
+        } catch (AccumuloSecurityException ase) {
 
+        }
       }
     }
   }
 
   @Test
   public void testTimeout() throws Exception {
-    AccumuloClient client = getAccumuloClient();
+    try (AccumuloClient client = getAccumuloClient()) {
 
-    String table = getUniqueNames(1)[0];
+      String table = getUniqueNames(1)[0];
 
-    client.tableOperations().create(table);
+      client.tableOperations().create(table);
 
-    try (
-        ConditionalWriter cw = client.createConditionalWriter(table,
-            new ConditionalWriterConfig().setTimeout(3, TimeUnit.SECONDS));
-        Scanner scanner = client.createScanner(table, Authorizations.EMPTY)) {
+      try (
+          ConditionalWriter cw = client.createConditionalWriter(table,
+              new ConditionalWriterConfig().setTimeout(3, TimeUnit.SECONDS));
+          Scanner scanner = client.createScanner(table, Authorizations.EMPTY)) {
 
-      ConditionalMutation cm1 = new ConditionalMutation("r1", new Condition("tx", "seq"));
-      cm1.put("tx", "seq", "1");
-      cm1.put("data", "x", "a");
+        ConditionalMutation cm1 = new ConditionalMutation("r1", new Condition("tx", "seq"));
+        cm1.put("tx", "seq", "1");
+        cm1.put("data", "x", "a");
 
-      assertEquals(cw.write(cm1).getStatus(), Status.ACCEPTED);
+        assertEquals(cw.write(cm1).getStatus(), Status.ACCEPTED);
 
-      IteratorSetting is = new IteratorSetting(5, SlowIterator.class);
-      SlowIterator.setSeekSleepTime(is, 5000);
+        IteratorSetting is = new IteratorSetting(5, SlowIterator.class);
+        SlowIterator.setSeekSleepTime(is, 5000);
 
-      ConditionalMutation cm2 = new ConditionalMutation("r1",
-          new Condition("tx", "seq").setValue("1").setIterators(is));
-      cm2.put("tx", "seq", "2");
-      cm2.put("data", "x", "b");
+        ConditionalMutation cm2 = new ConditionalMutation("r1",
+            new Condition("tx", "seq").setValue("1").setIterators(is));
+        cm2.put("tx", "seq", "2");
+        cm2.put("data", "x", "b");
 
-      assertEquals(cw.write(cm2).getStatus(), Status.UNKNOWN);
+        assertEquals(cw.write(cm2).getStatus(), Status.UNKNOWN);
 
-      for (Entry<Key,Value> entry : scanner) {
-        String cf = entry.getKey().getColumnFamilyData().toString();
-        String cq = entry.getKey().getColumnQualifierData().toString();
-        String val = entry.getValue().toString();
-
-        if (cf.equals("tx") && cq.equals("seq"))
-          assertEquals("Unexpected value in tx:seq", "1", val);
-        else if (cf.equals("data") && cq.equals("x"))
-          assertEquals("Unexpected value in data:x", "a", val);
-        else
-          fail("Saw unexpected column family and qualifier: " + entry);
-      }
+        for (Entry<Key,Value> entry : scanner) {
+          String cf = entry.getKey().getColumnFamilyData().toString();
+          String cq = entry.getKey().getColumnQualifierData().toString();
+          String val = entry.getValue().toString();
+
+          if (cf.equals("tx") && cq.equals("seq"))
+            assertEquals("Unexpected value in tx:seq", "1", val);
+          else if (cf.equals("data") && cq.equals("x"))
+            assertEquals("Unexpected value in data:x", "a", val);
+          else
+            fail("Saw unexpected column family and qualifier: " + entry);
+        }
 
-      ConditionalMutation cm3 = new ConditionalMutation("r1",
-          new Condition("tx", "seq").setValue("1"));
-      cm3.put("tx", "seq", "2");
-      cm3.put("data", "x", "b");
+        ConditionalMutation cm3 = new ConditionalMutation("r1",
+            new Condition("tx", "seq").setValue("1"));
+        cm3.put("tx", "seq", "2");
+        cm3.put("data", "x", "b");
 
-      assertEquals(cw.write(cm3).getStatus(), Status.ACCEPTED);
+        assertEquals(cw.write(cm3).getStatus(), Status.ACCEPTED);
+      }
     }
   }
 
   @Test
   public void testDeleteTable() throws Exception {
     String table = getUniqueNames(1)[0];
-    AccumuloClient client = getAccumuloClient();
+    try (AccumuloClient client = getAccumuloClient()) {
 
-    try {
-      client.createConditionalWriter(table, new ConditionalWriterConfig());
-      fail("Creating conditional writer for table that doesn't exist should fail");
-    } catch (TableNotFoundException e) {}
+      try {
+        client.createConditionalWriter(table, new ConditionalWriterConfig());
+        fail("Creating conditional writer for table that doesn't exist should fail");
+      } catch (TableNotFoundException e) {}
 
-    client.tableOperations().create(table);
+      client.tableOperations().create(table);
 
-    try (ConditionalWriter cw = client.createConditionalWriter(table,
-        new ConditionalWriterConfig())) {
+      try (ConditionalWriter cw = client.createConditionalWriter(table,
+          new ConditionalWriterConfig())) {
 
-      client.tableOperations().delete(table);
+        client.tableOperations().delete(table);
 
-      ConditionalMutation cm1 = new ConditionalMutation("r1", new Condition("tx", "seq"));
-      cm1.put("tx", "seq", "1");
-      cm1.put("data", "x", "a");
+        ConditionalMutation cm1 = new ConditionalMutation("r1", new Condition("tx", "seq"));
+        cm1.put("tx", "seq", "1");
+        cm1.put("data", "x", "a");
 
-      Result result = cw.write(cm1);
+        Result result = cw.write(cm1);
 
-      try {
-        Status status = result.getStatus();
-        fail("Expected exception writing conditional mutation to deleted table. Got status: "
-            + status);
-      } catch (AccumuloException ae) {
-        assertEquals(TableDeletedException.class, ae.getCause().getClass());
+        try {
+          Status status = result.getStatus();
+          fail("Expected exception writing conditional mutation to deleted table. Got status: "
+              + status);
+        } catch (AccumuloException ae) {
+          assertEquals(TableDeletedException.class, ae.getCause().getClass());
+        }
       }
     }
   }
@@ -1427,62 +1444,64 @@ public void testDeleteTable() throws Exception {
   @Test
   public void testOffline() throws Exception {
     String table = getUniqueNames(1)[0];
-    AccumuloClient client = getAccumuloClient();
+    try (AccumuloClient client = getAccumuloClient()) {
 
-    client.tableOperations().create(table);
+      client.tableOperations().create(table);
 
-    try (ConditionalWriter cw = client.createConditionalWriter(table,
-        new ConditionalWriterConfig())) {
+      try (ConditionalWriter cw = client.createConditionalWriter(table,
+          new ConditionalWriterConfig())) {
 
-      client.tableOperations().offline(table, true);
+        client.tableOperations().offline(table, true);
 
-      ConditionalMutation cm1 = new ConditionalMutation("r1", new Condition("tx", "seq"));
-      cm1.put("tx", "seq", "1");
-      cm1.put("data", "x", "a");
+        ConditionalMutation cm1 = new ConditionalMutation("r1", new Condition("tx", "seq"));
+        cm1.put("tx", "seq", "1");
+        cm1.put("data", "x", "a");
 
-      Result result = cw.write(cm1);
+        Result result = cw.write(cm1);
 
-      try {
-        Status status = result.getStatus();
-        fail("Expected exception writing conditional mutation to offline table. Got status: "
-            + status);
-      } catch (AccumuloException ae) {
-        assertEquals(TableOfflineException.class, ae.getCause().getClass());
-      }
+        try {
+          Status status = result.getStatus();
+          fail("Expected exception writing conditional mutation to offline table. Got status: "
+              + status);
+        } catch (AccumuloException ae) {
+          assertEquals(TableOfflineException.class, ae.getCause().getClass());
+        }
 
-      try {
-        client.createConditionalWriter(table, new ConditionalWriterConfig());
-        fail("Expected exception creating conditional writer to offline table");
-      } catch (TableOfflineException e) {}
+        try {
+          client.createConditionalWriter(table, new ConditionalWriterConfig());
+          fail("Expected exception creating conditional writer to offline table");
+        } catch (TableOfflineException e) {}
+      }
     }
   }
 
   @Test
   public void testError() throws Exception {
     String table = getUniqueNames(1)[0];
-    AccumuloClient client = getAccumuloClient();
+    try (AccumuloClient client = getAccumuloClient()) {
 
-    client.tableOperations().create(table);
+      client.tableOperations().create(table);
 
-    try (ConditionalWriter cw = client.createConditionalWriter(table,
-        new ConditionalWriterConfig())) {
+      try (ConditionalWriter cw = client.createConditionalWriter(table,
+          new ConditionalWriterConfig())) {
 
-      IteratorSetting iterSetting = new IteratorSetting(5, BadIterator.class);
+        IteratorSetting iterSetting = new IteratorSetting(5, BadIterator.class);
 
-      ConditionalMutation cm1 = new ConditionalMutation("r1",
-          new Condition("tx", "seq").setIterators(iterSetting));
-      cm1.put("tx", "seq", "1");
-      cm1.put("data", "x", "a");
+        ConditionalMutation cm1 = new ConditionalMutation("r1",
+            new Condition("tx", "seq").setIterators(iterSetting));
+        cm1.put("tx", "seq", "1");
+        cm1.put("data", "x", "a");
 
-      Result result = cw.write(cm1);
+        Result result = cw.write(cm1);
 
-      try {
-        Status status = result.getStatus();
-        fail("Expected exception using iterator which throws an error, Got status: " + status);
-      } catch (AccumuloException ae) {
+        try {
+          Status status = result.getStatus();
+          fail("Expected exception using iterator which throws an error, Got status: " + status);
+        } catch (AccumuloException ae) {
 
-      }
+        }
 
+      }
     }
   }
 
@@ -1490,18 +1509,19 @@ public void testError() throws Exception {
   public void testNoConditions() throws AccumuloException, AccumuloSecurityException,
       TableExistsException, TableNotFoundException {
     String table = getUniqueNames(1)[0];
-    AccumuloClient client = getAccumuloClient();
+    try (AccumuloClient client = getAccumuloClient()) {
 
-    client.tableOperations().create(table);
+      client.tableOperations().create(table);
 
-    try (ConditionalWriter cw = client.createConditionalWriter(table,
-        new ConditionalWriterConfig())) {
+      try (ConditionalWriter cw = client.createConditionalWriter(table,
+          new ConditionalWriterConfig())) {
 
-      ConditionalMutation cm1 = new ConditionalMutation("r1");
-      cm1.put("tx", "seq", "1");
-      cm1.put("data", "x", "a");
+        ConditionalMutation cm1 = new ConditionalMutation("r1");
+        cm1.put("tx", "seq", "1");
+        cm1.put("data", "x", "a");
 
-      cw.write(cm1);
+        cw.write(cm1);
+      }
     }
   }
 
@@ -1510,75 +1530,76 @@ public void testTrace() throws Exception {
     // Need to add a getClientConfig() to AccumuloCluster
     Assume.assumeTrue(getClusterType() == ClusterType.MINI);
     Process tracer = null;
-    AccumuloClient client = getAccumuloClient();
-    AccumuloCluster cluster = getCluster();
-    MiniAccumuloClusterImpl mac = (MiniAccumuloClusterImpl) cluster;
-    if (!client.tableOperations().exists("trace")) {
-      tracer = mac.exec(TraceServer.class);
-      while (!client.tableOperations().exists("trace")) {
-        sleepUninterruptibly(1, TimeUnit.SECONDS);
+    try (AccumuloClient client = getAccumuloClient()) {
+      AccumuloCluster cluster = getCluster();
+      MiniAccumuloClusterImpl mac = (MiniAccumuloClusterImpl) cluster;
+      if (!client.tableOperations().exists("trace")) {
+        tracer = mac.exec(TraceServer.class);
+        while (!client.tableOperations().exists("trace")) {
+          sleepUninterruptibly(1, TimeUnit.SECONDS);
+        }
       }
-    }
 
-    String tableName = getUniqueNames(1)[0];
-    client.tableOperations().create(tableName);
-
-    DistributedTrace.enable("localhost", "testTrace", mac.getClientInfo().getProperties());
-    sleepUninterruptibly(1, TimeUnit.SECONDS);
-    Span root = Trace.on("traceTest");
-    try (ConditionalWriter cw = client.createConditionalWriter(tableName,
-        new ConditionalWriterConfig())) {
-
-      // mutation conditional on column tx:seq not exiting
-      ConditionalMutation cm0 = new ConditionalMutation("99006", new Condition("tx", "seq"));
-      cm0.put("name", "last", "doe");
-      cm0.put("name", "first", "john");
-      cm0.put("tx", "seq", "1");
-      assertEquals(Status.ACCEPTED, cw.write(cm0).getStatus());
-      root.stop();
-    }
+      String tableName = getUniqueNames(1)[0];
+      client.tableOperations().create(tableName);
 
-    try (Scanner scanner = client.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);
+      DistributedTrace.enable("localhost", "testTrace", mac.getClientInfo().getProperties());
+      sleepUninterruptibly(1, TimeUnit.SECONDS);
+      Span root = Trace.on("traceTest");
+      try (ConditionalWriter cw = client.createConditionalWriter(tableName,
+          new ConditionalWriterConfig())) {
+
+        // mutation conditional on column tx:seq not exiting
+        ConditionalMutation cm0 = new ConditionalMutation("99006", new Condition("tx", "seq"));
+        cm0.put("name", "last", "doe");
+        cm0.put("name", "first", "john");
+        cm0.put("tx", "seq", "1");
+        assertEquals(Status.ACCEPTED, cw.write(cm0).getStatus());
+        root.stop();
+      }
+
+      try (Scanner scanner = client.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) {
-          String[] parts = ("traceTest, startScan,startConditionalUpdate,conditionalUpdate"
-              + ",Check conditions,apply conditional mutations").split(",");
-          int lastPos = 0;
-          for (String part : parts) {
-            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) {
+            String[] parts = ("traceTest, startScan,startConditionalUpdate,conditionalUpdate"
+                + ",Check conditions,apply conditional mutations").split(",");
+            int lastPos = 0;
+            for (String part : parts) {
+              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 1664135457..9323cb181d 100644
--- a/test/src/main/java/org/apache/accumulo/test/ConfigurableMajorCompactionIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/ConfigurableMajorCompactionIT.java
@@ -81,23 +81,24 @@ public CompactionPlan getCompactionPlan(MajorCompactionRequest request) throws I
 
   @Test
   public void test() throws Exception {
-    AccumuloClient client = getClient();
-    String tableName = getUniqueNames(1)[0];
-    client.tableOperations().create(tableName);
-    client.tableOperations().setProperty(tableName, Property.TABLE_COMPACTION_STRATEGY.getKey(),
-        TestCompactionStrategy.class.getName());
-    writeFile(client, tableName);
-    writeFile(client, tableName);
-    writeFile(client, tableName);
-    writeFile(client, tableName);
-    UtilWaitThread.sleep(2 * 1000);
-    assertEquals(4, countFiles(client));
-    writeFile(client, tableName);
-    int count = countFiles(client);
-    assertTrue(count == 1 || count == 5);
-    while (count != 1) {
-      UtilWaitThread.sleep(250);
-      count = countFiles(client);
+    try (AccumuloClient client = getClient()) {
+      String tableName = getUniqueNames(1)[0];
+      client.tableOperations().create(tableName);
+      client.tableOperations().setProperty(tableName, Property.TABLE_COMPACTION_STRATEGY.getKey(),
+          TestCompactionStrategy.class.getName());
+      writeFile(client, tableName);
+      writeFile(client, tableName);
+      writeFile(client, tableName);
+      writeFile(client, tableName);
+      UtilWaitThread.sleep(2 * 1000);
+      assertEquals(4, countFiles(client));
+      writeFile(client, tableName);
+      int count = countFiles(client);
+      assertTrue(count == 1 || count == 5);
+      while (count != 1) {
+        UtilWaitThread.sleep(250);
+        count = countFiles(client);
+      }
     }
   }
 
diff --git a/test/src/main/java/org/apache/accumulo/test/CountNameNodeOpsBulkIT.java b/test/src/main/java/org/apache/accumulo/test/CountNameNodeOpsBulkIT.java
index 0f0f68b870..a701661f11 100644
--- a/test/src/main/java/org/apache/accumulo/test/CountNameNodeOpsBulkIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/CountNameNodeOpsBulkIT.java
@@ -92,89 +92,89 @@ private long getStat(Map<?,?> map, String stat) {
 
   @Test
   public void compareOldNewBulkImportTest() throws Exception {
-    final AccumuloClient c = getClient();
-    getCluster().getClusterControl().kill(ServerType.GARBAGE_COLLECTOR, "localhost");
-    final String tableName = getUniqueNames(1)[0];
-    c.tableOperations().create(tableName);
-    // turn off compactions
-    c.tableOperations().setProperty(tableName, Property.TABLE_MAJC_RATIO.getKey(), "2000");
-    c.tableOperations().setProperty(tableName, Property.TABLE_FILE_MAX.getKey(), "2000");
-    // splits to slow down bulk import
-    SortedSet<Text> splits = new TreeSet<>();
-    for (int i = 1; i < 0xf; i++) {
-      splits.add(new Text(Integer.toHexString(i)));
-    }
-    c.tableOperations().addSplits(tableName, splits);
+    try (AccumuloClient c = getClient()) {
+      getCluster().getClusterControl().kill(ServerType.GARBAGE_COLLECTOR, "localhost");
+      final String tableName = getUniqueNames(1)[0];
+      c.tableOperations().create(tableName);
+      // turn off compactions
+      c.tableOperations().setProperty(tableName, Property.TABLE_MAJC_RATIO.getKey(), "2000");
+      c.tableOperations().setProperty(tableName, Property.TABLE_FILE_MAX.getKey(), "2000");
+      // splits to slow down bulk import
+      SortedSet<Text> splits = new TreeSet<>();
+      for (int i = 1; i < 0xf; i++) {
+        splits.add(new Text(Integer.toHexString(i)));
+      }
+      c.tableOperations().addSplits(tableName, splits);
 
-    MasterMonitorInfo stats = getCluster().getMasterMonitorInfo();
-    assertEquals(1, stats.tServerInfo.size());
+      MasterMonitorInfo stats = getCluster().getMasterMonitorInfo();
+      assertEquals(1, stats.tServerInfo.size());
 
-    log.info("Creating lots of bulk import files");
-    final FileSystem fs = getCluster().getFileSystem();
-    final Path basePath = getCluster().getTemporaryPath();
-    CachedConfiguration.setInstance(fs.getConf());
+      log.info("Creating lots of bulk import files");
+      final FileSystem fs = getCluster().getFileSystem();
+      final Path basePath = getCluster().getTemporaryPath();
+      CachedConfiguration.setInstance(fs.getConf());
 
-    final Path base = new Path(basePath, "testBulkLoad" + tableName);
-    fs.delete(base, true);
-    fs.mkdirs(base);
+      final Path base = new Path(basePath, "testBulkLoad" + tableName);
+      fs.delete(base, true);
+      fs.mkdirs(base);
 
-    ExecutorService es = Executors.newFixedThreadPool(5);
-    List<Future<String>> futures = new ArrayList<>();
-    for (int i = 0; i < 10; i++) {
-      final int which = i;
-      futures.add(es.submit(() -> {
-        Path files = new Path(base, "files" + which);
-        fs.mkdirs(files);
-        for (int i1 = 0; i1 < 100; i1++) {
-          FileSKVWriter writer = FileOperations.getInstance().newWriterBuilder()
-              .forFile(files + "/bulk_" + i1 + "." + RFile.EXTENSION, fs, fs.getConf())
-              .withTableConfiguration(DefaultConfiguration.getInstance()).build();
-          writer.startDefaultLocalityGroup();
-          for (int j = 0x100; j < 0xfff; j += 3) {
-            writer.append(new Key(Integer.toHexString(j)), new Value(new byte[0]));
+      ExecutorService es = Executors.newFixedThreadPool(5);
+      List<Future<String>> futures = new ArrayList<>();
+      for (int i = 0; i < 10; i++) {
+        final int which = i;
+        futures.add(es.submit(() -> {
+          Path files = new Path(base, "files" + which);
+          fs.mkdirs(files);
+          for (int i1 = 0; i1 < 100; i1++) {
+            FileSKVWriter writer = FileOperations.getInstance().newWriterBuilder()
+                .forFile(files + "/bulk_" + i1 + "." + RFile.EXTENSION, fs, fs.getConf())
+                .withTableConfiguration(DefaultConfiguration.getInstance()).build();
+            writer.startDefaultLocalityGroup();
+            for (int j = 0x100; j < 0xfff; j += 3) {
+              writer.append(new Key(Integer.toHexString(j)), new Value(new byte[0]));
+            }
+            writer.close();
           }
-          writer.close();
+          return files.toString();
+        }));
+      }
+      List<String> dirs = new ArrayList<>();
+      for (Future<String> f : futures) {
+        dirs.add(f.get());
+      }
+      log.info("Importing");
+      long startOps = getStat(getStats(), "FileInfoOps");
+      long now = System.currentTimeMillis();
+      List<Future<Object>> errs = new ArrayList<>();
+      for (String dir : dirs) {
+        errs.add(es.submit(() -> {
+          c.tableOperations().importDirectory(dir).to(tableName).load();
+          return null;
+        }));
+      }
+      for (Future<Object> err : errs) {
+        err.get();
+      }
+      es.shutdown();
+      es.awaitTermination(2, TimeUnit.MINUTES);
+      log.info(
+          String.format("Completed in %.2f seconds", (System.currentTimeMillis() - now) / 1000.));
+      sleepUninterruptibly(30, TimeUnit.SECONDS);
+      Map<?,?> map = getStats();
+      map.forEach((k, v) -> {
+        try {
+          if (v != null && Double.parseDouble(v.toString()) > 0.0)
+            log.debug("{}:{}", k, v);
+        } catch (NumberFormatException e) {
+          // only looking for numbers
         }
-        return files.toString();
-      }));
+      });
+      long getFileInfoOpts = getStat(map, "FileInfoOps") - startOps;
+      log.info("New bulk import used {} opts, vs old using 2060", getFileInfoOpts);
+      // counts for old bulk import:
+      // Expected number of FileInfoOps was between 1000 and 2100
+      // new bulk import is way better :)
+      assertEquals("unexpected number of FileInfoOps", 20, getFileInfoOpts);
     }
-    List<String> dirs = new ArrayList<>();
-    for (Future<String> f : futures) {
-      dirs.add(f.get());
-    }
-    log.info("Importing");
-    long startOps = getStat(getStats(), "FileInfoOps");
-    long now = System.currentTimeMillis();
-    List<Future<Object>> errs = new ArrayList<>();
-    for (String dir : dirs) {
-      errs.add(es.submit(() -> {
-        c.tableOperations().importDirectory(dir).to(tableName).load();
-        return null;
-      }));
-    }
-    for (Future<Object> err : errs) {
-      err.get();
-    }
-    es.shutdown();
-    es.awaitTermination(2, TimeUnit.MINUTES);
-    log.info(
-        String.format("Completed in %.2f seconds", (System.currentTimeMillis() - now) / 1000.));
-    sleepUninterruptibly(30, TimeUnit.SECONDS);
-    Map<?,?> map = getStats();
-    map.forEach((k, v) -> {
-      try {
-        if (v != null && Double.parseDouble(v.toString()) > 0.0)
-          log.debug("{}:{}", k, v);
-      } catch (NumberFormatException e) {
-        // only looking for numbers
-      }
-    });
-    long getFileInfoOpts = getStat(map, "FileInfoOps") - startOps;
-    log.info("New bulk import used {} opts, vs old using 2060", getFileInfoOpts);
-    // counts for old bulk import:
-    // Expected number of FileInfoOps was between 1000 and 2100
-    // new bulk import is way better :)
-    assertEquals("unexpected number of FileInfoOps", 20, getFileInfoOpts);
   }
-
 }
diff --git a/test/src/main/java/org/apache/accumulo/test/DetectDeadTabletServersIT.java b/test/src/main/java/org/apache/accumulo/test/DetectDeadTabletServersIT.java
index 1000b41010..090d7193dc 100644
--- a/test/src/main/java/org/apache/accumulo/test/DetectDeadTabletServersIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/DetectDeadTabletServersIT.java
@@ -51,37 +51,38 @@ protected void configure(MiniAccumuloConfigImpl cfg, Configuration hadoopCoreSit
 
   @Test
   public void test() throws Exception {
-    AccumuloClient c = getClient();
-    log.info("verifying that everything is up");
-    Iterators.size(c.createScanner(MetadataTable.NAME, Authorizations.EMPTY).iterator());
+    try (AccumuloClient c = getClient()) {
+      log.info("verifying that everything is up");
+      Iterators.size(c.createScanner(MetadataTable.NAME, Authorizations.EMPTY).iterator());
 
-    MasterMonitorInfo stats = getStats(c);
-    assertEquals(2, stats.tServerInfo.size());
-    assertEquals(0, stats.badTServers.size());
-    assertEquals(0, stats.deadTabletServers.size());
-    log.info("Killing a tablet server");
-    getCluster().killProcess(TABLET_SERVER,
-        getCluster().getProcesses().get(TABLET_SERVER).iterator().next());
+      MasterMonitorInfo stats = getStats(c);
+      assertEquals(2, stats.tServerInfo.size());
+      assertEquals(0, stats.badTServers.size());
+      assertEquals(0, stats.deadTabletServers.size());
+      log.info("Killing a tablet server");
+      getCluster().killProcess(TABLET_SERVER,
+          getCluster().getProcesses().get(TABLET_SERVER).iterator().next());
 
-    while (true) {
-      stats = getStats(c);
-      if (2 != stats.tServerInfo.size()) {
-        break;
+      while (true) {
+        stats = getStats(c);
+        if (2 != stats.tServerInfo.size()) {
+          break;
+        }
+        UtilWaitThread.sleep(500);
       }
-      UtilWaitThread.sleep(500);
-    }
-    assertEquals(1, stats.tServerInfo.size());
-    assertEquals(1, stats.badTServers.size() + stats.deadTabletServers.size());
-    while (true) {
-      stats = getStats(c);
-      if (0 != stats.deadTabletServers.size()) {
-        break;
+      assertEquals(1, stats.tServerInfo.size());
+      assertEquals(1, stats.badTServers.size() + stats.deadTabletServers.size());
+      while (true) {
+        stats = getStats(c);
+        if (0 != stats.deadTabletServers.size()) {
+          break;
+        }
+        UtilWaitThread.sleep(500);
       }
-      UtilWaitThread.sleep(500);
+      assertEquals(1, stats.tServerInfo.size());
+      assertEquals(0, stats.badTServers.size());
+      assertEquals(1, stats.deadTabletServers.size());
     }
-    assertEquals(1, stats.tServerInfo.size());
-    assertEquals(0, stats.badTServers.size());
-    assertEquals(1, stats.deadTabletServers.size());
   }
 
   private MasterMonitorInfo getStats(AccumuloClient c) throws Exception {
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 ddad2f33b4..5da280a876 100644
--- a/test/src/main/java/org/apache/accumulo/test/ExistingMacIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/ExistingMacIT.java
@@ -158,37 +158,38 @@ public void testExistingInstance() throws Exception {
   @Test
   public void testExistingRunningInstance() throws Exception {
     final String table = getUniqueNames(1)[0];
-    AccumuloClient client = getClient();
-    // Ensure that a master and tserver are up so the existing instance check won't fail.
-    client.tableOperations().create(table);
-    BatchWriter bw = client.createBatchWriter(table, new BatchWriterConfig());
-    Mutation m = new Mutation("foo");
-    m.put("cf", "cq", "value");
-    bw.addMutation(m);
-    bw.close();
-
-    File hadoopConfDir = createTestDir(ExistingMacIT.class.getSimpleName() + "_hadoop_conf_2");
-    FileUtils.deleteQuietly(hadoopConfDir);
-    assertTrue(hadoopConfDir.mkdirs());
-    createEmptyConfig(new File(hadoopConfDir, "core-site.xml"));
-    createEmptyConfig(new File(hadoopConfDir, "hdfs-site.xml"));
-
-    File testDir2 = createTestDir(ExistingMacIT.class.getSimpleName() + "_3");
-    FileUtils.deleteQuietly(testDir2);
-
-    MiniAccumuloConfigImpl macConfig2 = new MiniAccumuloConfigImpl(testDir2, "notused");
-    macConfig2.useExistingInstance(
-        new File(getCluster().getConfig().getConfDir(), "accumulo.properties"), hadoopConfDir);
-
-    System.out
-        .println("conf " + new File(getCluster().getConfig().getConfDir(), "accumulo.properties"));
-
-    MiniAccumuloClusterImpl accumulo2 = new MiniAccumuloClusterImpl(macConfig2);
-    try {
-      accumulo2.start();
-      fail("A 2nd MAC instance should not be able to start over an existing MAC instance");
-    } catch (RuntimeException e) {
-      // TODO check message or throw more explicit exception
+    try (AccumuloClient client = getClient()) {
+      // Ensure that a master and tserver are up so the existing instance check won't fail.
+      client.tableOperations().create(table);
+      BatchWriter bw = client.createBatchWriter(table, new BatchWriterConfig());
+      Mutation m = new Mutation("foo");
+      m.put("cf", "cq", "value");
+      bw.addMutation(m);
+      bw.close();
+
+      File hadoopConfDir = createTestDir(ExistingMacIT.class.getSimpleName() + "_hadoop_conf_2");
+      FileUtils.deleteQuietly(hadoopConfDir);
+      assertTrue(hadoopConfDir.mkdirs());
+      createEmptyConfig(new File(hadoopConfDir, "core-site.xml"));
+      createEmptyConfig(new File(hadoopConfDir, "hdfs-site.xml"));
+
+      File testDir2 = createTestDir(ExistingMacIT.class.getSimpleName() + "_3");
+      FileUtils.deleteQuietly(testDir2);
+
+      MiniAccumuloConfigImpl macConfig2 = new MiniAccumuloConfigImpl(testDir2, "notused");
+      macConfig2.useExistingInstance(
+          new File(getCluster().getConfig().getConfDir(), "accumulo.properties"), hadoopConfDir);
+
+      System.out.println(
+          "conf " + new File(getCluster().getConfig().getConfDir(), "accumulo.properties"));
+
+      MiniAccumuloClusterImpl accumulo2 = new MiniAccumuloClusterImpl(macConfig2);
+      try {
+        accumulo2.start();
+        fail("A 2nd MAC instance should not be able to start over an existing MAC instance");
+      } catch (RuntimeException e) {
+        // TODO check message or throw more explicit exception
+      }
     }
   }
 }
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 f366d8036a..3415fef930 100644
--- a/test/src/main/java/org/apache/accumulo/test/FindMaxIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/FindMaxIT.java
@@ -50,75 +50,74 @@ private static Mutation nm(String row) {
 
   @Test
   public void test1() throws Exception {
-    AccumuloClient client = getAccumuloClient();
-    String tableName = getUniqueNames(1)[0];
+    try (AccumuloClient client = getAccumuloClient()) {
+      String tableName = getUniqueNames(1)[0];
+
+      client.tableOperations().create(tableName);
+
+      try (BatchWriter bw = client.createBatchWriter(tableName, new BatchWriterConfig())) {
+        bw.addMutation(nm(new byte[] {0}));
+        bw.addMutation(nm(new byte[] {0, 0}));
+        bw.addMutation(nm(new byte[] {0, 1}));
+        bw.addMutation(nm(new byte[] {0, 1, 0}));
+        bw.addMutation(nm(new byte[] {1, 0}));
+        bw.addMutation(nm(new byte[] {'a', 'b', 'c'}));
+        bw.addMutation(nm(new byte[] {(byte) 0xff}));
+        bw.addMutation(nm(new byte[] {(byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff,
+            (byte) 0xff, (byte) 0xff}));
+
+        for (int i = 0; i < 1000; i += 5) {
+          bw.addMutation(nm(String.format("r%05d", i)));
+        }
+      }
 
-    client.tableOperations().create(tableName);
+      try (Scanner scanner = client.createScanner(tableName, Authorizations.EMPTY)) {
 
-    BatchWriter bw = client.createBatchWriter(tableName, new BatchWriterConfig());
+        ArrayList<Text> rows = new ArrayList<>();
 
-    bw.addMutation(nm(new byte[] {0}));
-    bw.addMutation(nm(new byte[] {0, 0}));
-    bw.addMutation(nm(new byte[] {0, 1}));
-    bw.addMutation(nm(new byte[] {0, 1, 0}));
-    bw.addMutation(nm(new byte[] {1, 0}));
-    bw.addMutation(nm(new byte[] {'a', 'b', 'c'}));
-    bw.addMutation(nm(new byte[] {(byte) 0xff}));
-    bw.addMutation(nm(
-        new byte[] {(byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff}));
+        for (Entry<Key,Value> entry : scanner) {
+          rows.add(entry.getKey().getRow());
+        }
 
-    for (int i = 0; i < 1000; i += 5) {
-      bw.addMutation(nm(String.format("r%05d", i)));
-    }
+        for (int i = rows.size() - 1; i > 0; i--) {
+          Text max = client.tableOperations().getMaxRow(tableName, Authorizations.EMPTY, null, true,
+              rows.get(i), false);
+          assertEquals(rows.get(i - 1), max);
 
-    bw.close();
+          max = client.tableOperations().getMaxRow(tableName, Authorizations.EMPTY, rows.get(i - 1),
+              true, rows.get(i), false);
+          assertEquals(rows.get(i - 1), max);
 
-    try (Scanner scanner = client.createScanner(tableName, Authorizations.EMPTY)) {
+          max = client.tableOperations().getMaxRow(tableName, Authorizations.EMPTY, rows.get(i - 1),
+              false, rows.get(i), false);
+          assertNull(max);
 
-      ArrayList<Text> rows = new ArrayList<>();
+          max = client.tableOperations().getMaxRow(tableName, Authorizations.EMPTY, null, true,
+              rows.get(i), true);
+          assertEquals(rows.get(i), max);
 
-      for (Entry<Key,Value> entry : scanner) {
-        rows.add(entry.getKey().getRow());
-      }
+          max = client.tableOperations().getMaxRow(tableName, Authorizations.EMPTY, rows.get(i),
+              true, rows.get(i), true);
+          assertEquals(rows.get(i), max);
 
-      for (int i = rows.size() - 1; i > 0; i--) {
-        Text max = client.tableOperations().getMaxRow(tableName, Authorizations.EMPTY, null, true,
-            rows.get(i), false);
-        assertEquals(rows.get(i - 1), max);
+          max = client.tableOperations().getMaxRow(tableName, Authorizations.EMPTY, rows.get(i - 1),
+              false, rows.get(i), true);
+          assertEquals(rows.get(i), max);
 
-        max = client.tableOperations().getMaxRow(tableName, Authorizations.EMPTY, rows.get(i - 1),
-            true, rows.get(i), false);
-        assertEquals(rows.get(i - 1), max);
+        }
 
-        max = client.tableOperations().getMaxRow(tableName, Authorizations.EMPTY, rows.get(i - 1),
-            false, rows.get(i), false);
-        assertNull(max);
+        Text max = client.tableOperations().getMaxRow(tableName, Authorizations.EMPTY, null, true,
+            null, true);
+        assertEquals(rows.get(rows.size() - 1), max);
 
         max = client.tableOperations().getMaxRow(tableName, Authorizations.EMPTY, null, true,
-            rows.get(i), true);
-        assertEquals(rows.get(i), max);
-
-        max = client.tableOperations().getMaxRow(tableName, Authorizations.EMPTY, rows.get(i), true,
-            rows.get(i), true);
-        assertEquals(rows.get(i), max);
-
-        max = client.tableOperations().getMaxRow(tableName, Authorizations.EMPTY, rows.get(i - 1),
-            false, rows.get(i), true);
-        assertEquals(rows.get(i), max);
+            new Text(new byte[] {0}), false);
+        assertNull(max);
 
+        max = client.tableOperations().getMaxRow(tableName, Authorizations.EMPTY, null, true,
+            new Text(new byte[] {0}), true);
+        assertEquals(rows.get(0), max);
       }
-
-      Text max = client.tableOperations().getMaxRow(tableName, Authorizations.EMPTY, null, true,
-          null, true);
-      assertEquals(rows.get(rows.size() - 1), max);
-
-      max = client.tableOperations().getMaxRow(tableName, Authorizations.EMPTY, null, true,
-          new Text(new byte[] {0}), false);
-      assertNull(max);
-
-      max = client.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/GarbageCollectWALIT.java b/test/src/main/java/org/apache/accumulo/test/GarbageCollectWALIT.java
index 9b8b0c9085..4e1b951c1a 100644
--- a/test/src/main/java/org/apache/accumulo/test/GarbageCollectWALIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/GarbageCollectWALIT.java
@@ -53,17 +53,18 @@ public void test() throws Exception {
     // not yet, please
     String tableName = getUniqueNames(1)[0];
     cluster.getClusterControl().stop(ServerType.GARBAGE_COLLECTOR);
-    AccumuloClient c = getClient();
-    c.tableOperations().create(tableName);
-    // count the number of WALs in the filesystem
-    assertEquals(2, countWALsInFS(cluster));
-    cluster.getClusterControl().stop(ServerType.TABLET_SERVER);
-    cluster.getClusterControl().start(ServerType.GARBAGE_COLLECTOR);
-    cluster.getClusterControl().start(ServerType.TABLET_SERVER);
-    Iterators.size(c.createScanner(MetadataTable.NAME, Authorizations.EMPTY).iterator());
-    // let GC run
-    UtilWaitThread.sleep(3 * 5 * 1000);
-    assertEquals(2, countWALsInFS(cluster));
+    try (AccumuloClient c = getClient()) {
+      c.tableOperations().create(tableName);
+      // count the number of WALs in the filesystem
+      assertEquals(2, countWALsInFS(cluster));
+      cluster.getClusterControl().stop(ServerType.TABLET_SERVER);
+      cluster.getClusterControl().start(ServerType.GARBAGE_COLLECTOR);
+      cluster.getClusterControl().start(ServerType.TABLET_SERVER);
+      Iterators.size(c.createScanner(MetadataTable.NAME, Authorizations.EMPTY).iterator());
+      // let GC run
+      UtilWaitThread.sleep(3 * 5 * 1000);
+      assertEquals(2, countWALsInFS(cluster));
+    }
   }
 
   private int countWALsInFS(MiniAccumuloClusterImpl cluster) throws Exception {
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 0977159e9d..4b4edfeb19 100644
--- a/test/src/main/java/org/apache/accumulo/test/ImportExportIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/ImportExportIT.java
@@ -68,112 +68,113 @@ protected int defaultTimeoutSeconds() {
 
   @Test
   public void testExportImportThenScan() throws Exception {
-    AccumuloClient client = getAccumuloClient();
+    try (AccumuloClient client = getAccumuloClient()) {
 
-    String[] tableNames = getUniqueNames(2);
-    String srcTable = tableNames[0], destTable = tableNames[1];
-    client.tableOperations().create(srcTable);
+      String[] tableNames = getUniqueNames(2);
+      String srcTable = tableNames[0], destTable = tableNames[1];
+      client.tableOperations().create(srcTable);
 
-    BatchWriter bw = client.createBatchWriter(srcTable, new BatchWriterConfig());
-    for (int row = 0; row < 1000; row++) {
-      Mutation m = new Mutation(Integer.toString(row));
-      for (int col = 0; col < 100; col++) {
-        m.put(Integer.toString(col), "", Integer.toString(col * 2));
+      BatchWriter bw = client.createBatchWriter(srcTable, new BatchWriterConfig());
+      for (int row = 0; row < 1000; row++) {
+        Mutation m = new Mutation(Integer.toString(row));
+        for (int col = 0; col < 100; col++) {
+          m.put(Integer.toString(col), "", Integer.toString(col * 2));
+        }
+        bw.addMutation(m);
       }
-      bw.addMutation(m);
-    }
 
-    bw.close();
+      bw.close();
 
-    client.tableOperations().compact(srcTable, null, null, true, true);
+      client.tableOperations().compact(srcTable, null, null, true, true);
 
-    // Make a directory we can use to throw the export and import directories
-    // Must exist on the filesystem the cluster is running.
-    FileSystem fs = cluster.getFileSystem();
-    Path tmp = cluster.getTemporaryPath();
-    log.info("Using FileSystem: " + fs);
-    Path baseDir = new Path(tmp, getClass().getName());
-    if (fs.exists(baseDir)) {
-      log.info("{} exists on filesystem, deleting", baseDir);
-      assertTrue("Failed to deleted " + baseDir, fs.delete(baseDir, true));
-    }
-    log.info("Creating {}", baseDir);
-    assertTrue("Failed to create " + baseDir, fs.mkdirs(baseDir));
-    Path exportDir = new Path(baseDir, "export");
-    Path importDir = new Path(baseDir, "import");
-    for (Path p : new Path[] {exportDir, importDir}) {
-      assertTrue("Failed to create " + baseDir, fs.mkdirs(p));
-    }
+      // Make a directory we can use to throw the export and import directories
+      // Must exist on the filesystem the cluster is running.
+      FileSystem fs = cluster.getFileSystem();
+      Path tmp = cluster.getTemporaryPath();
+      log.info("Using FileSystem: " + fs);
+      Path baseDir = new Path(tmp, getClass().getName());
+      if (fs.exists(baseDir)) {
+        log.info("{} exists on filesystem, deleting", baseDir);
+        assertTrue("Failed to deleted " + baseDir, fs.delete(baseDir, true));
+      }
+      log.info("Creating {}", baseDir);
+      assertTrue("Failed to create " + baseDir, fs.mkdirs(baseDir));
+      Path exportDir = new Path(baseDir, "export");
+      Path importDir = new Path(baseDir, "import");
+      for (Path p : new Path[] {exportDir, importDir}) {
+        assertTrue("Failed to create " + baseDir, fs.mkdirs(p));
+      }
 
-    log.info("Exporting table to {}", exportDir);
-    log.info("Importing table from {}", importDir);
-
-    // Offline the table
-    client.tableOperations().offline(srcTable, true);
-    // Then export it
-    client.tableOperations().exportTable(srcTable, exportDir.toString());
-
-    // Make sure the distcp.txt file that exporttable creates is available
-    Path distcp = new Path(exportDir, "distcp.txt");
-    assertTrue("Distcp file doesn't exist", fs.exists(distcp));
-    FSDataInputStream is = fs.open(distcp);
-    BufferedReader reader = new BufferedReader(new InputStreamReader(is));
-
-    // Copy each file that was exported to the import directory
-    String line;
-    while (null != (line = reader.readLine())) {
-      Path p = new Path(line.substring(5));
-      assertTrue("File doesn't exist: " + p, fs.exists(p));
-
-      Path dest = new Path(importDir, p.getName());
-      assertFalse("Did not expect " + dest + " to exist", fs.exists(dest));
-      FileUtil.copy(fs, p, fs, dest, false, fs.getConf());
-    }
+      log.info("Exporting table to {}", exportDir);
+      log.info("Importing table from {}", importDir);
+
+      // Offline the table
+      client.tableOperations().offline(srcTable, true);
+      // Then export it
+      client.tableOperations().exportTable(srcTable, exportDir.toString());
+
+      // Make sure the distcp.txt file that exporttable creates is available
+      Path distcp = new Path(exportDir, "distcp.txt");
+      assertTrue("Distcp file doesn't exist", fs.exists(distcp));
+      FSDataInputStream is = fs.open(distcp);
+      BufferedReader reader = new BufferedReader(new InputStreamReader(is));
+
+      // Copy each file that was exported to the import directory
+      String line;
+      while (null != (line = reader.readLine())) {
+        Path p = new Path(line.substring(5));
+        assertTrue("File doesn't exist: " + p, fs.exists(p));
+
+        Path dest = new Path(importDir, p.getName());
+        assertFalse("Did not expect " + dest + " to exist", fs.exists(dest));
+        FileUtil.copy(fs, p, fs, dest, false, fs.getConf());
+      }
 
-    reader.close();
-
-    log.info("Import dir: {}", Arrays.toString(fs.listStatus(importDir)));
-
-    // Import the exported data into a new table
-    client.tableOperations().importTable(destTable, importDir.toString());
-
-    // Get the table ID for the table that the importtable command created
-    final String tableId = client.tableOperations().tableIdMap().get(destTable);
-    assertNotNull(tableId);
-
-    // Get all `file` colfams from the metadata table for the new table
-    log.info("Imported into table with ID: {}", tableId);
-
-    try (Scanner s = client.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();
-          assertFalse("Imported files should have absolute URIs, not relative: " + fileUri,
-              looksLikeRelativePath(fileUri));
-        } else if (k.getColumnFamily()
-            .equals(MetadataSchema.TabletsSection.ServerColumnFamily.NAME)) {
-          assertFalse("Server directory should have absolute URI, not relative: " + value,
-              looksLikeRelativePath(value));
-        } else {
-          fail("Got expected pair: " + k + "=" + fileEntry.getValue());
+      reader.close();
+
+      log.info("Import dir: {}", Arrays.toString(fs.listStatus(importDir)));
+
+      // Import the exported data into a new table
+      client.tableOperations().importTable(destTable, importDir.toString());
+
+      // Get the table ID for the table that the importtable command created
+      final String tableId = client.tableOperations().tableIdMap().get(destTable);
+      assertNotNull(tableId);
+
+      // Get all `file` colfams from the metadata table for the new table
+      log.info("Imported into table with ID: {}", tableId);
+
+      try (Scanner s = client.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();
+            assertFalse("Imported files should have absolute URIs, not relative: " + fileUri,
+                looksLikeRelativePath(fileUri));
+          } else if (k.getColumnFamily()
+              .equals(MetadataSchema.TabletsSection.ServerColumnFamily.NAME)) {
+            assertFalse("Server directory should have absolute URI, not relative: " + value,
+                looksLikeRelativePath(value));
+          } else {
+            fail("Got expected pair: " + k + "=" + fileEntry.getValue());
+          }
         }
+
       }
+      // Online the original table before we verify equivalence
+      client.tableOperations().online(srcTable, true);
 
+      verifyTableEquality(client, srcTable, destTable);
     }
-    // Online the original table before we verify equivalence
-    client.tableOperations().online(srcTable, true);
-
-    verifyTableEquality(client, srcTable, destTable);
   }
 
   private void verifyTableEquality(AccumuloClient client, String srcTable, String destTable)
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 04c614bd5b..0a3300072d 100644
--- a/test/src/main/java/org/apache/accumulo/test/InterruptibleScannersIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/InterruptibleScannersIT.java
@@ -51,55 +51,56 @@ public void configureMiniCluster(MiniAccumuloConfigImpl cfg, Configuration hadoo
   public void test() throws Exception {
     // make a table
     final String tableName = getUniqueNames(1)[0];
-    final AccumuloClient client = getAccumuloClient();
-    client.tableOperations().create(tableName);
+    try (AccumuloClient client = getAccumuloClient()) {
+      client.tableOperations().create(tableName);
 
-    // make the world's slowest scanner
-    try (Scanner scanner = client.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 = client.instanceOperations().getTabletServers().iterator().next();
-            do {
-              ArrayList<ActiveScan> scans = new ArrayList<>(
-                  client.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();
+      // make the world's slowest scanner
+      try (Scanner scanner = client.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 = client.instanceOperations().getTabletServers().iterator().next();
+              do {
+                ArrayList<ActiveScan> scans = new ArrayList<>(
+                    client.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());
+          fail("Scan should not succeed");
+        } catch (Exception ex) {} finally {
+          thread.join();
         }
-      };
-      thread.start();
-      try {
-        // Use the scanner, expect problems
-        Iterators.size(scanner.iterator());
-        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 7a9bbf2530..1e47482e6e 100644
--- a/test/src/main/java/org/apache/accumulo/test/IsolationAndDeepCopyIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/IsolationAndDeepCopyIT.java
@@ -26,7 +26,6 @@
 
 import org.apache.accumulo.core.client.AccumuloClient;
 import org.apache.accumulo.core.client.BatchWriter;
-import org.apache.accumulo.core.client.BatchWriterConfig;
 import org.apache.accumulo.core.client.IteratorSetting;
 import org.apache.accumulo.core.client.MutationsRejectedException;
 import org.apache.accumulo.core.client.Scanner;
@@ -46,36 +45,35 @@ public void testBugFix() throws Exception {
     // test bug fox for ACCUMULO-3977
 
     String table = super.getUniqueNames(1)[0];
-    AccumuloClient client = getAccumuloClient();
+    try (AccumuloClient client = getAccumuloClient()) {
 
-    client.tableOperations().create(table);
+      client.tableOperations().create(table);
 
-    BatchWriter bw = client.createBatchWriter(table, new BatchWriterConfig());
-
-    addDocument(bw, "000A", "dog", "cat", "hamster", "iguana", "the");
-    addDocument(bw, "000B", "java", "perl", "C++", "pascal", "the");
-    addDocument(bw, "000C", "chrome", "firefox", "safari", "opera", "the");
-    addDocument(bw, "000D", "logarithmic", "quadratic", "linear", "exponential", "the");
-
-    bw.close();
+      try (BatchWriter bw = client.createBatchWriter(table)) {
+        addDocument(bw, "000A", "dog", "cat", "hamster", "iguana", "the");
+        addDocument(bw, "000B", "java", "perl", "C++", "pascal", "the");
+        addDocument(bw, "000C", "chrome", "firefox", "safari", "opera", "the");
+        addDocument(bw, "000D", "logarithmic", "quadratic", "linear", "exponential", "the");
+      }
 
-    // its a bug when using rfiles, so flush
-    client.tableOperations().flush(table, null, null, true);
+      // its a bug when using rfiles, so flush
+      client.tableOperations().flush(table, null, null, true);
 
-    IteratorSetting iterCfg = new IteratorSetting(30, "ayeaye",
-        IntersectingIterator.class.getName());
-    IntersectingIterator.setColumnFamilies(iterCfg,
-        new Text[] {new Text("the"), new Text("hamster")});
+      IteratorSetting iterCfg = new IteratorSetting(30, "ayeaye",
+          IntersectingIterator.class.getName());
+      IntersectingIterator.setColumnFamilies(iterCfg,
+          new Text[] {new Text("the"), new Text("hamster")});
 
-    try (Scanner scanner = client.createScanner(table, Authorizations.EMPTY)) {
-      scanner.enableIsolation();
-      scanner.addScanIterator(iterCfg);
+      try (Scanner scanner = client.createScanner(table, Authorizations.EMPTY)) {
+        scanner.enableIsolation();
+        scanner.addScanIterator(iterCfg);
 
-      for (int i = 0; i < 100; i++) {
-        Iterator<Entry<Key,Value>> iter = scanner.iterator();
-        assertTrue(iter.hasNext());
-        assertEquals("000A", iter.next().getKey().getColumnQualifierData().toString());
-        assertFalse(iter.hasNext());
+        for (int i = 0; i < 100; i++) {
+          Iterator<Entry<Key,Value>> iter = scanner.iterator();
+          assertTrue(iter.hasNext());
+          assertEquals("000A", iter.next().getKey().getColumnQualifierData().toString());
+          assertFalse(iter.hasNext());
+        }
       }
     }
   }
diff --git a/test/src/main/java/org/apache/accumulo/test/KeyValueEqualityIT.java b/test/src/main/java/org/apache/accumulo/test/KeyValueEqualityIT.java
index 96d96d87c8..f536cb01d2 100644
--- a/test/src/main/java/org/apache/accumulo/test/KeyValueEqualityIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/KeyValueEqualityIT.java
@@ -42,40 +42,41 @@ public int defaultTimeoutSeconds() {
 
   @Test
   public void testEquality() throws Exception {
-    AccumuloClient client = this.getAccumuloClient();
-    final BatchWriterConfig config = new BatchWriterConfig();
+    try (AccumuloClient client = this.getAccumuloClient()) {
+      final BatchWriterConfig config = new BatchWriterConfig();
 
-    final String[] tables = getUniqueNames(2);
-    final String table1 = tables[0], table2 = tables[1];
-    final TableOperations tops = client.tableOperations();
-    tops.create(table1);
-    tops.create(table2);
+      final String[] tables = getUniqueNames(2);
+      final String table1 = tables[0], table2 = tables[1];
+      final TableOperations tops = client.tableOperations();
+      tops.create(table1);
+      tops.create(table2);
 
-    final BatchWriter bw1 = client.createBatchWriter(table1, config),
-        bw2 = client.createBatchWriter(table2, config);
+      final BatchWriter bw1 = client.createBatchWriter(table1, config),
+          bw2 = client.createBatchWriter(table2, config);
 
-    for (int row = 0; row < 100; row++) {
-      Mutation m = new Mutation(Integer.toString(row));
-      for (int col = 0; col < 10; col++) {
-        m.put(Integer.toString(col), "", System.currentTimeMillis(), Integer.toString(col * 2));
+      for (int row = 0; row < 100; row++) {
+        Mutation m = new Mutation(Integer.toString(row));
+        for (int col = 0; col < 10; col++) {
+          m.put(Integer.toString(col), "", System.currentTimeMillis(), Integer.toString(col * 2));
+        }
+        bw1.addMutation(m);
+        bw2.addMutation(m);
       }
-      bw1.addMutation(m);
-      bw2.addMutation(m);
-    }
 
-    bw1.close();
-    bw2.close();
+      bw1.close();
+      bw2.close();
 
-    Iterator<Entry<Key,Value>> t1 = client.createScanner(table1, Authorizations.EMPTY).iterator(),
-        t2 = client.createScanner(table2, Authorizations.EMPTY).iterator();
-    while (t1.hasNext() && t2.hasNext()) {
-      // KeyValue, the implementation of Entry<Key,Value>, should support equality and hashCode
-      // properly
-      Entry<Key,Value> e1 = t1.next(), e2 = t2.next();
-      assertEquals(e1, e2);
-      assertEquals(e1.hashCode(), e2.hashCode());
+      Iterator<Entry<Key,Value>> t1 = client.createScanner(table1, Authorizations.EMPTY).iterator(),
+          t2 = client.createScanner(table2, Authorizations.EMPTY).iterator();
+      while (t1.hasNext() && t2.hasNext()) {
+        // KeyValue, the implementation of Entry<Key,Value>, should support equality and hashCode
+        // properly
+        Entry<Key,Value> e1 = t1.next(), e2 = t2.next();
+        assertEquals(e1, e2);
+        assertEquals(e1.hashCode(), e2.hashCode());
+      }
+      assertFalse("table1 had more data to read", t1.hasNext());
+      assertFalse("table2 had more data to read", t2.hasNext());
     }
-    assertFalse("table1 had more data to read", t1.hasNext());
-    assertFalse("table2 had more data to read", t2.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 c92a19e7b7..4f08503db6 100644
--- a/test/src/main/java/org/apache/accumulo/test/LargeSplitRowIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/LargeSplitRowIT.java
@@ -67,49 +67,51 @@ public void userAddedSplit() throws Exception {
 
     // make a table and lower the TABLE_END_ROW_MAX_SIZE property
     final String tableName = getUniqueNames(1)[0];
-    final AccumuloClient client = getClient();
-    client.tableOperations().create(tableName);
-    client.tableOperations().setProperty(tableName, Property.TABLE_MAX_END_ROW_SIZE.getKey(),
-        "1000");
-
-    // Create a BatchWriter and add a mutation to the table
-    BatchWriter batchWriter = client.createBatchWriter(tableName, new BatchWriterConfig());
-    Mutation m = new Mutation("Row");
-    m.put("cf", "cq", "value");
-    batchWriter.addMutation(m);
-    batchWriter.close();
-
-    // Create a split point that is too large to be an end row and fill it with all 'm'
-    SortedSet<Text> partitionKeys = new TreeSet<>();
-    byte data[] = new byte[(int) (ConfigurationTypeHelper
-        .getFixedMemoryAsBytes(Property.TABLE_MAX_END_ROW_SIZE.getDefaultValue()) + 2)];
-    for (int i = 0; i < data.length; i++) {
-      data[i] = 'm';
-    }
-    partitionKeys.add(new Text(data));
-
-    // try to add the split point that is too large, if the split point is created the test fails.
-    try {
-      client.tableOperations().addSplits(tableName, partitionKeys);
-      fail();
-    } catch (AccumuloServerException e) {}
-
-    // 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;
-    try (Scanner scanner = client.createScanner(tableName, Authorizations.EMPTY)) {
-      for (Entry<Key,Value> entry : scanner) {
-        counter++;
-        Key k = entry.getKey();
-        assertEquals("Row", k.getRow().toString());
-        assertEquals("cf", k.getColumnFamily().toString());
-        assertEquals("cq", k.getColumnQualifier().toString());
-        assertEquals("value", entry.getValue().toString());
+    try (AccumuloClient client = getClient()) {
+      client.tableOperations().create(tableName);
+      client.tableOperations().setProperty(tableName, Property.TABLE_MAX_END_ROW_SIZE.getKey(),
+          "1000");
+
+      // Create a BatchWriter and add a mutation to the table
+      BatchWriter batchWriter = client.createBatchWriter(tableName, new BatchWriterConfig());
+      Mutation m = new Mutation("Row");
+      m.put("cf", "cq", "value");
+      batchWriter.addMutation(m);
+      batchWriter.close();
+
+      // Create a split point that is too large to be an end row and fill it with all 'm'
+      SortedSet<Text> partitionKeys = new TreeSet<>();
+      byte data[] = new byte[(int) (ConfigurationTypeHelper
+          .getFixedMemoryAsBytes(Property.TABLE_MAX_END_ROW_SIZE.getDefaultValue()) + 2)];
+      for (int i = 0; i < data.length; i++) {
+        data[i] = 'm';
+      }
+      partitionKeys.add(new Text(data));
+
+      // try to add the split point that is too large, if the split point is created the test fails.
+      try {
+        client.tableOperations().addSplits(tableName, partitionKeys);
+        fail();
+      } catch (AccumuloServerException e) {}
+
+      // 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;
+      try (Scanner scanner = client.createScanner(tableName, Authorizations.EMPTY)) {
+        for (Entry<Key,Value> entry : scanner) {
+          counter++;
+          Key k = entry.getKey();
+          assertEquals("Row", k.getRow().toString());
+          assertEquals("cf", k.getColumnFamily().toString());
+          assertEquals("cq", k.getColumnQualifier().toString());
+          assertEquals("value", entry.getValue().toString());
 
+        }
       }
+      // Make sure there is only one line in the table
+      assertEquals(1, counter);
     }
-    // Make sure there is only one line in the table
-    assertEquals(1, counter);
   }
 
   // Test tablet server split with 250 entries with all the same prefix
@@ -119,128 +121,132 @@ public void automaticSplitWith250Same() throws Exception {
 
     // make a table and lower the configure properties
     final String tableName = getUniqueNames(1)[0];
-    final AccumuloClient client = getClient();
-    client.tableOperations().create(tableName);
-    client.tableOperations().setProperty(tableName, Property.TABLE_SPLIT_THRESHOLD.getKey(), "10K");
-    client.tableOperations().setProperty(tableName, Property.TABLE_FILE_COMPRESSION_TYPE.getKey(),
-        "none");
-    client.tableOperations().setProperty(tableName,
-        Property.TABLE_FILE_COMPRESSED_BLOCK_SIZE.getKey(), "64");
-    client.tableOperations().setProperty(tableName, Property.TABLE_MAX_END_ROW_SIZE.getKey(),
-        "1000");
-
-    // Create a BatchWriter and key for a table entry that is longer than the allowed size for an
-    // end row
-    // Fill this key with all m's except the last spot
-    BatchWriter batchWriter = client.createBatchWriter(tableName, new BatchWriterConfig());
-    byte data[] = new byte[(int) (ConfigurationTypeHelper
-        .getFixedMemoryAsBytes(Property.TABLE_MAX_END_ROW_SIZE.getDefaultValue()) + 2)];
-    for (int i = 0; i < data.length - 1; i++) {
-      data[i] = (byte) 'm';
-    }
-
-    // Make the last place in the key different for every entry added to the table
-    for (int i = 0; i < 250; i++) {
-      data[data.length - 1] = (byte) i;
-      Mutation m = new Mutation(data);
-      m.put("cf", "cq", "value");
-      batchWriter.addMutation(m);
-    }
-    // Flush the BatchWriter and table and sleep for a bit to make sure that there is enough time
-    // for the table to split if need be.
-    batchWriter.close();
-    client.tableOperations().flush(tableName, new Text(), new Text("z"), true);
-    Thread.sleep(500);
+    try (AccumuloClient client = getClient()) {
+      client.tableOperations().create(tableName);
+      client.tableOperations().setProperty(tableName, Property.TABLE_SPLIT_THRESHOLD.getKey(),
+          "10K");
+      client.tableOperations().setProperty(tableName, Property.TABLE_FILE_COMPRESSION_TYPE.getKey(),
+          "none");
+      client.tableOperations().setProperty(tableName,
+          Property.TABLE_FILE_COMPRESSED_BLOCK_SIZE.getKey(), "64");
+      client.tableOperations().setProperty(tableName, Property.TABLE_MAX_END_ROW_SIZE.getKey(),
+          "1000");
+
+      // Create a BatchWriter and key for a table entry that is longer than the allowed size for an
+      // end row
+      // Fill this key with all m's except the last spot
+      BatchWriter batchWriter = client.createBatchWriter(tableName, new BatchWriterConfig());
+      byte data[] = new byte[(int) (ConfigurationTypeHelper
+          .getFixedMemoryAsBytes(Property.TABLE_MAX_END_ROW_SIZE.getDefaultValue()) + 2)];
+      for (int i = 0; i < data.length - 1; i++) {
+        data[i] = (byte) 'm';
+      }
 
-    // Make sure all the data that was put in the table is still correct
-    int count = 0;
-    try (Scanner scanner = client.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);
-        assertEquals(expected, k.getRow().toString());
-        assertEquals("cf", k.getColumnFamily().toString());
-        assertEquals("cq", k.getColumnQualifier().toString());
-        assertEquals("value", entry.getValue().toString());
-        count++;
+      // Make the last place in the key different for every entry added to the table
+      for (int i = 0; i < 250; i++) {
+        data[data.length - 1] = (byte) i;
+        Mutation m = new Mutation(data);
+        m.put("cf", "cq", "value");
+        batchWriter.addMutation(m);
       }
-    }
-    assertEquals(250, count);
+      // Flush the BatchWriter and table and sleep for a bit to make sure that there is enough time
+      // for the table to split if need be.
+      batchWriter.close();
+      client.tableOperations().flush(tableName, new Text(), new Text("z"), true);
+      Thread.sleep(500);
+
+      // Make sure all the data that was put in the table is still correct
+      int count = 0;
+      try (Scanner scanner = client.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);
+          assertEquals(expected, k.getRow().toString());
+          assertEquals("cf", k.getColumnFamily().toString());
+          assertEquals("cq", k.getColumnQualifier().toString());
+          assertEquals("value", entry.getValue().toString());
+          count++;
+        }
+      }
+      assertEquals(250, count);
 
-    // Make sure no splits occurred in the table
-    assertEquals(0, client.tableOperations().listSplits(tableName).size());
+      // Make sure no splits occurred in the table
+      assertEquals(0, client.tableOperations().listSplits(tableName).size());
+    }
   }
 
   // 10 0's; 10 2's; 10 4's... 10 30's etc
   @Test(timeout = 60 * 1000)
   public void automaticSplitWithGaps() throws Exception {
     log.info("Automatic Split With Gaps");
-
-    automaticSplit(30, 2);
+    try (AccumuloClient client = getClient()) {
+      automaticSplit(client, 30, 2);
+    }
   }
 
   // 10 0's; 10 1's; 10 2's... 10 15's etc
   @Test(timeout = 60 * 1000)
   public void automaticSplitWithoutGaps() throws Exception {
     log.info("Automatic Split Without Gaps");
-
-    automaticSplit(15, 1);
+    try (AccumuloClient client = getClient()) {
+      automaticSplit(client, 15, 1);
+    }
   }
 
   @Test(timeout = 60 * 1000)
   public void automaticSplitLater() throws Exception {
     log.info("Split later");
-    automaticSplit(15, 1);
+    try (AccumuloClient client = getClient()) {
+      automaticSplit(client, 15, 1);
 
-    final AccumuloClient client = getClient();
+      String tableName = new String();
+      java.util.Iterator<String> iterator = client.tableOperations().list().iterator();
 
-    String tableName = new String();
-    java.util.Iterator<String> iterator = client.tableOperations().list().iterator();
-
-    while (iterator.hasNext()) {
-      String curr = iterator.next();
-      if (!curr.startsWith(Namespace.ACCUMULO + ".")) {
-        tableName = curr;
+      while (iterator.hasNext()) {
+        String curr = iterator.next();
+        if (!curr.startsWith(Namespace.ACCUMULO + ".")) {
+          tableName = curr;
+        }
       }
-    }
 
-    // Create a BatchWriter and key for a table entry that is longer than the allowed size for an
-    // end row
-    BatchWriter batchWriter = client.createBatchWriter(tableName, new BatchWriterConfig());
-    byte data[] = new byte[10];
+      // Create a BatchWriter and key for a table entry that is longer than the allowed size for an
+      // end row
+      BatchWriter batchWriter = client.createBatchWriter(tableName, new BatchWriterConfig());
+      byte data[] = new byte[10];
+
+      // Fill key with all j's except for last spot which alternates through 1 through 10 for every
+      // j
+      // value
+      for (int j = 15; j < 150; j += 1) {
+        for (int i = 0; i < data.length - 1; i++) {
+          data[i] = (byte) j;
+        }
 
-    // Fill key with all j's except for last spot which alternates through 1 through 10 for every j
-    // value
-    for (int j = 15; j < 150; j += 1) {
-      for (int i = 0; i < data.length - 1; i++) {
-        data[i] = (byte) j;
+        for (int i = 0; i < 25; i++) {
+          data[data.length - 1] = (byte) i;
+          Mutation m = new Mutation(data);
+          m.put("cf", "cq", "value");
+          batchWriter.addMutation(m);
+        }
       }
-
-      for (int i = 0; i < 25; i++) {
-        data[data.length - 1] = (byte) i;
-        Mutation m = new Mutation(data);
-        m.put("cf", "cq", "value");
-        batchWriter.addMutation(m);
+      // Flush the BatchWriter and table and sleep for a bit to make sure that there is enough time
+      // for the table to split if need be.
+      batchWriter.close();
+      client.tableOperations().flush(tableName, new Text(), new Text("z"), true);
+
+      // Make sure a split occurs
+      while (client.tableOperations().listSplits(tableName).size() == 0) {
+        Thread.sleep(250);
       }
-    }
-    // Flush the BatchWriter and table and sleep for a bit to make sure that there is enough time
-    // for the table to split if need be.
-    batchWriter.close();
-    client.tableOperations().flush(tableName, new Text(), new Text("z"), true);
 
-    // Make sure a split occurs
-    while (client.tableOperations().listSplits(tableName).size() == 0) {
-      Thread.sleep(250);
+      assertTrue(0 < client.tableOperations().listSplits(tableName).size());
     }
-
-    assertTrue(0 < client.tableOperations().listSplits(tableName).size());
   }
 
-  private void automaticSplit(int max, int spacing) throws Exception {
+  private void automaticSplit(AccumuloClient client, int max, int spacing) throws Exception {
     // make a table and lower the configure properties
     final String tableName = getUniqueNames(1)[0];
-    final AccumuloClient client = getClient();
     client.tableOperations().create(tableName);
     client.tableOperations().setProperty(tableName, Property.TABLE_SPLIT_THRESHOLD.getKey(), "10K");
     client.tableOperations().setProperty(tableName, Property.TABLE_FILE_COMPRESSION_TYPE.getKey(),
diff --git a/test/src/main/java/org/apache/accumulo/test/LocatorIT.java b/test/src/main/java/org/apache/accumulo/test/LocatorIT.java
index 4efb9a6ea2..37d7572142 100644
--- a/test/src/main/java/org/apache/accumulo/test/LocatorIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/LocatorIT.java
@@ -86,59 +86,61 @@ private static TabletId newTabletId(String tableId, String endRow, String prevRo
 
   @Test
   public void testBasic() throws Exception {
-    AccumuloClient client = getAccumuloClient();
-    String tableName = getUniqueNames(1)[0];
+    try (AccumuloClient client = getAccumuloClient()) {
+      String tableName = getUniqueNames(1)[0];
 
-    client.tableOperations().create(tableName);
+      client.tableOperations().create(tableName);
 
-    Range r1 = new Range("m");
-    Range r2 = new Range("o", "x");
+      Range r1 = new Range("m");
+      Range r2 = new Range("o", "x");
 
-    String tableId = client.tableOperations().tableIdMap().get(tableName);
+      String tableId = client.tableOperations().tableIdMap().get(tableName);
 
-    TabletId t1 = newTabletId(tableId, null, null);
-    TabletId t2 = newTabletId(tableId, "r", null);
-    TabletId t3 = newTabletId(tableId, null, "r");
+      TabletId t1 = newTabletId(tableId, null, null);
+      TabletId t2 = newTabletId(tableId, "r", null);
+      TabletId t3 = newTabletId(tableId, null, "r");
 
-    ArrayList<Range> ranges = new ArrayList<>();
+      ArrayList<Range> ranges = new ArrayList<>();
 
-    HashSet<String> tservers = new HashSet<>(client.instanceOperations().getTabletServers());
+      HashSet<String> tservers = new HashSet<>(client.instanceOperations().getTabletServers());
 
-    ranges.add(r1);
-    Locations ret = client.tableOperations().locate(tableName, ranges);
-    assertContains(ret, tservers, ImmutableMap.of(r1, ImmutableSet.of(t1)),
-        ImmutableMap.of(t1, ImmutableSet.of(r1)));
+      ranges.add(r1);
+      Locations ret = client.tableOperations().locate(tableName, ranges);
+      assertContains(ret, tservers, ImmutableMap.of(r1, ImmutableSet.of(t1)),
+          ImmutableMap.of(t1, ImmutableSet.of(r1)));
 
-    ranges.add(r2);
-    ret = client.tableOperations().locate(tableName, ranges);
-    assertContains(ret, tservers, ImmutableMap.of(r1, ImmutableSet.of(t1), r2, ImmutableSet.of(t1)),
-        ImmutableMap.of(t1, ImmutableSet.of(r1, r2)));
+      ranges.add(r2);
+      ret = client.tableOperations().locate(tableName, ranges);
+      assertContains(ret, tservers,
+          ImmutableMap.of(r1, ImmutableSet.of(t1), r2, ImmutableSet.of(t1)),
+          ImmutableMap.of(t1, ImmutableSet.of(r1, r2)));
 
-    TreeSet<Text> splits = new TreeSet<>();
-    splits.add(new Text("r"));
-    client.tableOperations().addSplits(tableName, splits);
+      TreeSet<Text> splits = new TreeSet<>();
+      splits.add(new Text("r"));
+      client.tableOperations().addSplits(tableName, splits);
 
-    ret = client.tableOperations().locate(tableName, ranges);
-    assertContains(ret, tservers,
-        ImmutableMap.of(r1, ImmutableSet.of(t2), r2, ImmutableSet.of(t2, t3)),
-        ImmutableMap.of(t2, ImmutableSet.of(r1, r2), t3, ImmutableSet.of(r2)));
+      ret = client.tableOperations().locate(tableName, ranges);
+      assertContains(ret, tservers,
+          ImmutableMap.of(r1, ImmutableSet.of(t2), r2, ImmutableSet.of(t2, t3)),
+          ImmutableMap.of(t2, ImmutableSet.of(r1, r2), t3, ImmutableSet.of(r2)));
 
-    client.tableOperations().offline(tableName, true);
+      client.tableOperations().offline(tableName, true);
 
-    try {
-      client.tableOperations().locate(tableName, ranges);
-      fail();
-    } catch (TableOfflineException e) {
-      // expected
-    }
+      try {
+        client.tableOperations().locate(tableName, ranges);
+        fail();
+      } catch (TableOfflineException e) {
+        // expected
+      }
 
-    client.tableOperations().delete(tableName);
+      client.tableOperations().delete(tableName);
 
-    try {
-      client.tableOperations().locate(tableName, ranges);
-      fail();
-    } catch (TableNotFoundException e) {
-      // expected
+      try {
+        client.tableOperations().locate(tableName, ranges);
+        fail();
+      } catch (TableNotFoundException e) {
+        // expected
+      }
     }
   }
 }
diff --git a/test/src/main/java/org/apache/accumulo/test/ManySplitIT.java b/test/src/main/java/org/apache/accumulo/test/ManySplitIT.java
index 63ea2d1cec..0be929415d 100644
--- a/test/src/main/java/org/apache/accumulo/test/ManySplitIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/ManySplitIT.java
@@ -24,10 +24,10 @@
 import java.util.TreeSet;
 import java.util.concurrent.atomic.AtomicBoolean;
 
+import org.apache.accumulo.core.client.AccumuloClient;
 import org.apache.accumulo.core.client.AccumuloException;
 import org.apache.accumulo.core.client.AccumuloSecurityException;
 import org.apache.accumulo.core.client.TableNotFoundException;
-import org.apache.accumulo.core.client.admin.TableOperations;
 import org.apache.accumulo.core.metadata.MetadataTable;
 import org.apache.accumulo.fate.util.UtilWaitThread;
 import org.apache.accumulo.minicluster.MemoryUnit;
@@ -59,46 +59,47 @@ public void test() throws Exception {
 
     final String tableName = getUniqueNames(1)[0];
 
-    log.info("Creating table");
-    final TableOperations tableOperations = getClient().tableOperations();
+    try (AccumuloClient client = getClient()) {
 
-    log.info("splitting metadata table");
-    tableOperations.create(tableName);
-    SortedSet<Text> splits = new TreeSet<>();
-    for (byte b : "123456789abcde".getBytes(UTF_8)) {
-      splits.add(new Text(new byte[] {'1', ';', b}));
-    }
-    tableOperations.addSplits(MetadataTable.NAME, splits);
-    splits.clear();
-    for (int i = 0; i < SPLITS; i++) {
-      splits.add(new Text(Integer.toHexString(i)));
-    }
-    log.info("Adding splits");
-    // print out the number of splits so we have some idea of what's going on
-    final AtomicBoolean stop = new AtomicBoolean(false);
-    Thread t = new Thread() {
-      @Override
-      public void run() {
-        while (!stop.get()) {
-          UtilWaitThread.sleep(1000);
-          try {
-            log.info("splits: " + tableOperations.listSplits(tableName).size());
-          } catch (TableNotFoundException | AccumuloException | AccumuloSecurityException e) {
-            // TODO Auto-generated catch block
-            e.printStackTrace();
+      log.info("Creating table");
+      log.info("splitting metadata table");
+      client.tableOperations().create(tableName);
+      SortedSet<Text> splits = new TreeSet<>();
+      for (byte b : "123456789abcde".getBytes(UTF_8)) {
+        splits.add(new Text(new byte[] {'1', ';', b}));
+      }
+      client.tableOperations().addSplits(MetadataTable.NAME, splits);
+      splits.clear();
+      for (int i = 0; i < SPLITS; i++) {
+        splits.add(new Text(Integer.toHexString(i)));
+      }
+      log.info("Adding splits");
+      // print out the number of splits so we have some idea of what's going on
+      final AtomicBoolean stop = new AtomicBoolean(false);
+      Thread t = new Thread() {
+        @Override
+        public void run() {
+          while (!stop.get()) {
+            UtilWaitThread.sleep(1000);
+            try {
+              log.info("splits: " + client.tableOperations().listSplits(tableName).size());
+            } catch (TableNotFoundException | AccumuloException | AccumuloSecurityException e) {
+              // TODO Auto-generated catch block
+              e.printStackTrace();
+            }
           }
         }
-      }
-    };
-    t.start();
-    long now = System.currentTimeMillis();
-    tableOperations.addSplits(tableName, splits);
-    long diff = System.currentTimeMillis() - now;
-    double splitsPerSec = SPLITS / (diff / 1000.);
-    log.info("Done: {} splits per second", splitsPerSec);
-    assertTrue("splits created too slowly", splitsPerSec > 100);
-    stop.set(true);
-    t.join();
+      };
+      t.start();
+      long now = System.currentTimeMillis();
+      client.tableOperations().addSplits(tableName, splits);
+      long diff = System.currentTimeMillis() - now;
+      double splitsPerSec = SPLITS / (diff / 1000.);
+      log.info("Done: {} splits per second", splitsPerSec);
+      assertTrue("splits created too slowly", splitsPerSec > 100);
+      stop.set(true);
+      t.join();
+    }
   }
 
   @Override
diff --git a/test/src/main/java/org/apache/accumulo/test/MasterRepairsDualAssignmentIT.java b/test/src/main/java/org/apache/accumulo/test/MasterRepairsDualAssignmentIT.java
index 1ad7a8ae52..edd9187e54 100644
--- a/test/src/main/java/org/apache/accumulo/test/MasterRepairsDualAssignmentIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/MasterRepairsDualAssignmentIT.java
@@ -69,81 +69,83 @@ public void configure(MiniAccumuloConfigImpl cfg, Configuration hadoopCoreSite)
   @Test
   public void test() throws Exception {
     // make some tablets, spread 'em around
-    AccumuloClient c = getClient();
-    ClientContext context = getClientContext();
-    String table = this.getUniqueNames(1)[0];
-    c.securityOperations().grantTablePermission("root", MetadataTable.NAME, TablePermission.WRITE);
-    c.securityOperations().grantTablePermission("root", RootTable.NAME, TablePermission.WRITE);
-    c.tableOperations().create(table);
-    SortedSet<Text> partitions = new TreeSet<>();
-    for (String part : "a b c d e f g h i j k l m n o p q r s t u v w x y z".split(" ")) {
-      partitions.add(new Text(part));
-    }
-    c.tableOperations().addSplits(table, partitions);
-    // scan the metadata table and get the two table location states
-    Set<TServerInstance> states = new HashSet<>();
-    Set<TabletLocationState> oldLocations = new HashSet<>();
-    MetaDataStateStore store = new MetaDataStateStore(context, null);
-    while (states.size() < 2) {
-      UtilWaitThread.sleep(250);
-      oldLocations.clear();
-      for (TabletLocationState tls : store) {
-        if (tls.current != null) {
-          states.add(tls.current);
-          oldLocations.add(tls);
+    try (AccumuloClient c = getClient()) {
+      ClientContext context = getClientContext();
+      String table = this.getUniqueNames(1)[0];
+      c.securityOperations().grantTablePermission("root", MetadataTable.NAME,
+          TablePermission.WRITE);
+      c.securityOperations().grantTablePermission("root", RootTable.NAME, TablePermission.WRITE);
+      c.tableOperations().create(table);
+      SortedSet<Text> partitions = new TreeSet<>();
+      for (String part : "a b c d e f g h i j k l m n o p q r s t u v w x y z".split(" ")) {
+        partitions.add(new Text(part));
+      }
+      c.tableOperations().addSplits(table, partitions);
+      // scan the metadata table and get the two table location states
+      Set<TServerInstance> states = new HashSet<>();
+      Set<TabletLocationState> oldLocations = new HashSet<>();
+      MetaDataStateStore store = new MetaDataStateStore(context, null);
+      while (states.size() < 2) {
+        UtilWaitThread.sleep(250);
+        oldLocations.clear();
+        for (TabletLocationState tls : store) {
+          if (tls.current != null) {
+            states.add(tls.current);
+            oldLocations.add(tls);
+          }
         }
       }
-    }
-    assertEquals(2, states.size());
-    // Kill a tablet server... we don't care which one... wait for everything to be reassigned
-    cluster.killProcess(ServerType.TABLET_SERVER,
-        cluster.getProcesses().get(ServerType.TABLET_SERVER).iterator().next());
-    Set<TServerInstance> replStates = new HashSet<>();
-    // Find out which tablet server remains
-    while (true) {
-      UtilWaitThread.sleep(1000);
-      states.clear();
-      replStates.clear();
-      boolean allAssigned = true;
-      for (TabletLocationState tls : store) {
-        if (tls != null && tls.current != null) {
-          states.add(tls.current);
-        } else if (tls != null
-            && tls.extent.equals(new KeyExtent(ReplicationTable.ID, null, null))) {
-          replStates.add(tls.current);
-        } else {
-          allAssigned = false;
+      assertEquals(2, states.size());
+      // Kill a tablet server... we don't care which one... wait for everything to be reassigned
+      cluster.killProcess(ServerType.TABLET_SERVER,
+          cluster.getProcesses().get(ServerType.TABLET_SERVER).iterator().next());
+      Set<TServerInstance> replStates = new HashSet<>();
+      // Find out which tablet server remains
+      while (true) {
+        UtilWaitThread.sleep(1000);
+        states.clear();
+        replStates.clear();
+        boolean allAssigned = true;
+        for (TabletLocationState tls : store) {
+          if (tls != null && tls.current != null) {
+            states.add(tls.current);
+          } else if (tls != null
+              && tls.extent.equals(new KeyExtent(ReplicationTable.ID, null, null))) {
+            replStates.add(tls.current);
+          } else {
+            allAssigned = false;
+          }
         }
+        System.out.println(states + " size " + states.size() + " allAssigned " + allAssigned);
+        if (states.size() != 2 && allAssigned)
+          break;
       }
-      System.out.println(states + " size " + states.size() + " allAssigned " + allAssigned);
-      if (states.size() != 2 && allAssigned)
-        break;
-    }
-    assertEquals(1, replStates.size());
-    assertEquals(1, states.size());
-    // pick an assigned tablet and assign it to the old tablet
-    TabletLocationState moved = null;
-    for (TabletLocationState old : oldLocations) {
-      if (!states.contains(old.current)) {
-        moved = old;
+      assertEquals(1, replStates.size());
+      assertEquals(1, states.size());
+      // pick an assigned tablet and assign it to the old tablet
+      TabletLocationState moved = null;
+      for (TabletLocationState old : oldLocations) {
+        if (!states.contains(old.current)) {
+          moved = old;
+        }
       }
+      assertNotEquals(null, moved);
+      // throw a mutation in as if we were the dying tablet
+      BatchWriter bw = c.createBatchWriter(MetadataTable.NAME, new BatchWriterConfig());
+      Mutation assignment = new Mutation(moved.extent.getMetadataEntry());
+      moved.current.putLocation(assignment);
+      bw.addMutation(assignment);
+      bw.close();
+      // wait for the master to fix the problem
+      waitForCleanStore(store);
+      // now jam up the metadata table
+      bw = c.createBatchWriter(MetadataTable.NAME, new BatchWriterConfig());
+      assignment = new Mutation(new KeyExtent(MetadataTable.ID, null, null).getMetadataEntry());
+      moved.current.putLocation(assignment);
+      bw.addMutation(assignment);
+      bw.close();
+      waitForCleanStore(new RootTabletStateStore(context, null));
     }
-    assertNotEquals(null, moved);
-    // throw a mutation in as if we were the dying tablet
-    BatchWriter bw = c.createBatchWriter(MetadataTable.NAME, new BatchWriterConfig());
-    Mutation assignment = new Mutation(moved.extent.getMetadataEntry());
-    moved.current.putLocation(assignment);
-    bw.addMutation(assignment);
-    bw.close();
-    // wait for the master to fix the problem
-    waitForCleanStore(store);
-    // now jam up the metadata table
-    bw = c.createBatchWriter(MetadataTable.NAME, new BatchWriterConfig());
-    assignment = new Mutation(new KeyExtent(MetadataTable.ID, null, null).getMetadataEntry());
-    moved.current.putLocation(assignment);
-    bw.addMutation(assignment);
-    bw.close();
-    waitForCleanStore(new RootTabletStateStore(context, null));
   }
 
   private void waitForCleanStore(MetaDataStateStore store) {
diff --git a/test/src/main/java/org/apache/accumulo/test/MetaConstraintRetryIT.java b/test/src/main/java/org/apache/accumulo/test/MetaConstraintRetryIT.java
index 369af43696..b2de8612fc 100644
--- a/test/src/main/java/org/apache/accumulo/test/MetaConstraintRetryIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/MetaConstraintRetryIT.java
@@ -17,6 +17,7 @@
 
 package org.apache.accumulo.test;
 
+import org.apache.accumulo.core.client.AccumuloClient;
 import org.apache.accumulo.core.client.impl.Table;
 import org.apache.accumulo.core.client.impl.Writer;
 import org.apache.accumulo.core.data.Mutation;
@@ -39,23 +40,24 @@ public int defaultTimeoutSeconds() {
   // a test for ACCUMULO-3096
   @Test(expected = ConstraintViolationException.class)
   public void test() throws Exception {
+    try (AccumuloClient client = getAccumuloClient()) {
+      client.securityOperations().grantTablePermission(getAdminPrincipal(), MetadataTable.NAME,
+          TablePermission.WRITE);
 
-    getAccumuloClient().securityOperations().grantTablePermission(getAdminPrincipal(),
-        MetadataTable.NAME, TablePermission.WRITE);
+      ServerContext context = getServerContext();
+      Writer w = new Writer(context, MetadataTable.ID);
+      KeyExtent extent = new KeyExtent(Table.ID.of("5"), null, null);
 
-    ServerContext context = getServerContext();
-    Writer w = new Writer(context, MetadataTable.ID);
-    KeyExtent extent = new KeyExtent(Table.ID.of("5"), null, null);
+      Mutation m = new Mutation(extent.getMetadataEntry());
+      // unknown columns should cause constraint violation
+      m.put("badcolfam", "badcolqual", "3");
 
-    Mutation m = new Mutation(extent.getMetadataEntry());
-    // unknown columns should cause constraint violation
-    m.put("badcolfam", "badcolqual", "3");
-
-    try {
-      MetadataTableUtil.update(context, w, null, m);
-    } catch (RuntimeException e) {
-      if (e.getCause().getClass().equals(ConstraintViolationException.class)) {
-        throw (ConstraintViolationException) e.getCause();
+      try {
+        MetadataTableUtil.update(context, w, null, m);
+      } catch (RuntimeException e) {
+        if (e.getCause().getClass().equals(ConstraintViolationException.class)) {
+          throw (ConstraintViolationException) e.getCause();
+        }
       }
     }
   }
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 cd5ec8055a..20ab3d0df3 100644
--- a/test/src/main/java/org/apache/accumulo/test/MetaGetsReadersIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/MetaGetsReadersIT.java
@@ -80,40 +80,41 @@ private static Thread slowScan(final AccumuloClient c, final String tableName,
   @Test(timeout = 2 * 60 * 1000)
   public void test() throws Exception {
     final String tableName = getUniqueNames(1)[0];
-    final AccumuloClient c = getClient();
-    c.tableOperations().create(tableName);
-    Random random = new SecureRandom();
-    BatchWriter bw = c.createBatchWriter(tableName, null);
-    for (int i = 0; i < 50000; i++) {
-      byte[] row = new byte[100];
-      random.nextBytes(row);
-      Mutation m = new Mutation(row);
-      m.put("", "", "");
-      bw.addMutation(m);
-    }
-    bw.close();
-    c.tableOperations().flush(tableName, null, null, true);
-    final AtomicBoolean stop = new AtomicBoolean(false);
-    Thread t1 = slowScan(c, tableName, stop);
-    t1.start();
-    Thread t2 = slowScan(c, tableName, stop);
-    t2.start();
-    sleepUninterruptibly(500, TimeUnit.MILLISECONDS);
-    long now = System.currentTimeMillis();
+    try (AccumuloClient c = getClient()) {
+      c.tableOperations().create(tableName);
+      Random random = new SecureRandom();
+      BatchWriter bw = c.createBatchWriter(tableName, null);
+      for (int i = 0; i < 50000; i++) {
+        byte[] row = new byte[100];
+        random.nextBytes(row);
+        Mutation m = new Mutation(row);
+        m.put("", "", "");
+        bw.addMutation(m);
+      }
+      bw.close();
+      c.tableOperations().flush(tableName, null, null, true);
+      final AtomicBoolean stop = new AtomicBoolean(false);
+      Thread t1 = slowScan(c, tableName, stop);
+      t1.start();
+      Thread t2 = slowScan(c, tableName, stop);
+      t2.start();
+      sleepUninterruptibly(500, TimeUnit.MILLISECONDS);
+      long now = System.currentTimeMillis();
 
-    try (Scanner s = c.createScanner(MetadataTable.NAME, Authorizations.EMPTY)) {
-      Iterators.size(s.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);
-    assertFalse(stop.get());
-    stop.set(true);
-    t1.interrupt();
-    t2.interrupt();
-    t1.join();
-    t2.join();
+      long delay = System.currentTimeMillis() - now;
+      System.out.println("Delay = " + delay);
+      assertTrue("metadata table scan was slow", delay < 1000);
+      assertFalse(stop.get());
+      stop.set(true);
+      t1.interrupt();
+      t2.interrupt();
+      t1.join();
+      t2.join();
+    }
   }
 
 }
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 cb5c35a70d..9876f20b42 100644
--- a/test/src/main/java/org/apache/accumulo/test/MetaRecoveryIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/MetaRecoveryIT.java
@@ -56,38 +56,39 @@ protected void configure(MiniAccumuloConfigImpl cfg, Configuration hadoopCoreSit
   @Test(timeout = 4 * 60 * 1000)
   public void test() throws Exception {
     String[] tables = getUniqueNames(10);
-    AccumuloClient c = getClient();
-    int i = 0;
-    for (String table : tables) {
-      log.info("Creating table {}", i);
-      c.tableOperations().create(table);
-      BatchWriter bw = c.createBatchWriter(table, null);
-      for (int j = 0; j < 1000; j++) {
-        Mutation m = new Mutation("" + j);
-        m.put("cf", "cq", "value");
-        bw.addMutation(m);
+    try (AccumuloClient c = getClient()) {
+      int i = 0;
+      for (String table : tables) {
+        log.info("Creating table {}", i);
+        c.tableOperations().create(table);
+        BatchWriter bw = c.createBatchWriter(table, null);
+        for (int j = 0; j < 1000; j++) {
+          Mutation m = new Mutation("" + j);
+          m.put("cf", "cq", "value");
+          bw.addMutation(m);
+        }
+        bw.close();
+        log.info("Data written to table {}", i);
+        i++;
       }
-      bw.close();
-      log.info("Data written to table {}", i);
-      i++;
-    }
-    c.tableOperations().flush(MetadataTable.NAME, null, null, true);
-    c.tableOperations().flush(RootTable.NAME, null, null, true);
-    SortedSet<Text> splits = new TreeSet<>();
-    for (i = 1; i < tables.length; i++) {
-      splits.add(new Text("" + i));
-    }
-    c.tableOperations().addSplits(MetadataTable.NAME, splits);
-    log.info("Added {} splits to {}", splits.size(), MetadataTable.NAME);
-    c.instanceOperations().waitForBalance();
-    log.info("Restarting");
-    getCluster().getClusterControl().kill(ServerType.TABLET_SERVER, "localhost");
-    getCluster().start();
-    log.info("Verifying");
-    for (String table : tables) {
-      try (BatchScanner scanner = c.createBatchScanner(table, Authorizations.EMPTY, 5)) {
-        scanner.setRanges(Collections.singletonList(new Range()));
-        assertEquals(1000, Iterators.size(scanner.iterator()));
+      c.tableOperations().flush(MetadataTable.NAME, null, null, true);
+      c.tableOperations().flush(RootTable.NAME, null, null, true);
+      SortedSet<Text> splits = new TreeSet<>();
+      for (i = 1; i < tables.length; i++) {
+        splits.add(new Text("" + i));
+      }
+      c.tableOperations().addSplits(MetadataTable.NAME, splits);
+      log.info("Added {} splits to {}", splits.size(), MetadataTable.NAME);
+      c.instanceOperations().waitForBalance();
+      log.info("Restarting");
+      getCluster().getClusterControl().kill(ServerType.TABLET_SERVER, "localhost");
+      getCluster().start();
+      log.info("Verifying");
+      for (String table : tables) {
+        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/MetaSplitIT.java b/test/src/main/java/org/apache/accumulo/test/MetaSplitIT.java
index 1c07dbc8df..7baa8847cf 100644
--- a/test/src/main/java/org/apache/accumulo/test/MetaSplitIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/MetaSplitIT.java
@@ -52,16 +52,17 @@ public int defaultTimeoutSeconds() {
   @Before
   public void saveMetadataSplits() throws Exception {
     if (ClusterType.STANDALONE == getClusterType()) {
-      AccumuloClient client = getAccumuloClient();
-      Collection<Text> splits = client.tableOperations().listSplits(MetadataTable.NAME);
-      // We expect a single split
-      if (!splits.equals(Arrays.asList(new Text("~")))) {
-        log.info("Existing splits on metadata table. Saving them, and applying"
-            + " single original split of '~'");
-        metadataSplits = splits;
-        client.tableOperations().merge(MetadataTable.NAME, null, null);
-        client.tableOperations().addSplits(MetadataTable.NAME,
-            new TreeSet<>(Collections.singleton(new Text("~"))));
+      try (AccumuloClient client = getAccumuloClient()) {
+        Collection<Text> splits = client.tableOperations().listSplits(MetadataTable.NAME);
+        // We expect a single split
+        if (!splits.equals(Arrays.asList(new Text("~")))) {
+          log.info("Existing splits on metadata table. Saving them, and applying"
+              + " single original split of '~'");
+          metadataSplits = splits;
+          client.tableOperations().merge(MetadataTable.NAME, null, null);
+          client.tableOperations().addSplits(MetadataTable.NAME,
+              new TreeSet<>(Collections.singleton(new Text("~"))));
+        }
       }
     }
   }
@@ -70,24 +71,27 @@ public void saveMetadataSplits() throws Exception {
   public void restoreMetadataSplits() throws Exception {
     if (null != metadataSplits) {
       log.info("Restoring split on metadata table");
-      AccumuloClient client = getAccumuloClient();
-      client.tableOperations().merge(MetadataTable.NAME, null, null);
-      client.tableOperations().addSplits(MetadataTable.NAME, new TreeSet<>(metadataSplits));
+      try (AccumuloClient client = getAccumuloClient()) {
+        client.tableOperations().merge(MetadataTable.NAME, null, null);
+        client.tableOperations().addSplits(MetadataTable.NAME, new TreeSet<>(metadataSplits));
+      }
     }
   }
 
   @Test(expected = AccumuloException.class)
   public void testRootTableSplit() throws Exception {
-    TableOperations opts = getAccumuloClient().tableOperations();
-    SortedSet<Text> splits = new TreeSet<>();
-    splits.add(new Text("5"));
-    opts.addSplits(RootTable.NAME, splits);
+    try (AccumuloClient client = getAccumuloClient()) {
+      SortedSet<Text> splits = new TreeSet<>();
+      splits.add(new Text("5"));
+      client.tableOperations().addSplits(RootTable.NAME, splits);
+    }
   }
 
   @Test
   public void testRootTableMerge() throws Exception {
-    TableOperations opts = getAccumuloClient().tableOperations();
-    opts.merge(RootTable.NAME, null, null);
+    try (AccumuloClient client = getAccumuloClient()) {
+      client.tableOperations().merge(RootTable.NAME, null, null);
+    }
   }
 
   private void addSplits(TableOperations opts, String... points) throws Exception {
@@ -100,26 +104,28 @@ private void addSplits(TableOperations opts, String... points) throws Exception
 
   @Test
   public void testMetadataTableSplit() throws Exception {
-    TableOperations opts = getAccumuloClient().tableOperations();
-    for (int i = 1; i <= 10; i++) {
-      opts.create(Integer.toString(i));
-    }
-    try {
-      opts.merge(MetadataTable.NAME, new Text("01"), new Text("02"));
-      checkMetadataSplits(1, opts);
-      addSplits(opts, "4 5 6 7 8".split(" "));
-      checkMetadataSplits(6, opts);
-      opts.merge(MetadataTable.NAME, new Text("6"), new Text("9"));
-      checkMetadataSplits(4, opts);
-      addSplits(opts, "44 55 66 77 88".split(" "));
-      checkMetadataSplits(9, opts);
-      opts.merge(MetadataTable.NAME, new Text("5"), new Text("7"));
-      checkMetadataSplits(6, opts);
-      opts.merge(MetadataTable.NAME, null, null);
-      checkMetadataSplits(0, opts);
-    } finally {
+    try (AccumuloClient client = getAccumuloClient()) {
+      TableOperations opts = client.tableOperations();
       for (int i = 1; i <= 10; i++) {
-        opts.delete(Integer.toString(i));
+        opts.create(Integer.toString(i));
+      }
+      try {
+        opts.merge(MetadataTable.NAME, new Text("01"), new Text("02"));
+        checkMetadataSplits(1, opts);
+        addSplits(opts, "4 5 6 7 8".split(" "));
+        checkMetadataSplits(6, opts);
+        opts.merge(MetadataTable.NAME, new Text("6"), new Text("9"));
+        checkMetadataSplits(4, opts);
+        addSplits(opts, "44 55 66 77 88".split(" "));
+        checkMetadataSplits(9, opts);
+        opts.merge(MetadataTable.NAME, new Text("5"), new Text("7"));
+        checkMetadataSplits(6, opts);
+        opts.merge(MetadataTable.NAME, null, null);
+        checkMetadataSplits(0, opts);
+      } finally {
+        for (int i = 1; i <= 10; i++) {
+          opts.delete(Integer.toString(i));
+        }
       }
     }
   }
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 6180060950..72a5b9e925 100644
--- a/test/src/main/java/org/apache/accumulo/test/MissingWalHeaderCompletesRecoveryIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/MissingWalHeaderCompletesRecoveryIT.java
@@ -78,146 +78,150 @@ public void configure(MiniAccumuloConfigImpl cfg, Configuration conf) {
 
   @Before
   public void setupMetadataPermission() throws Exception {
-    AccumuloClient client = getClient();
-    rootHasWritePermission = client.securityOperations().hasTablePermission("root",
-        MetadataTable.NAME, TablePermission.WRITE);
-    if (!rootHasWritePermission) {
-      client.securityOperations().grantTablePermission("root", MetadataTable.NAME,
-          TablePermission.WRITE);
-      // Make sure it propagates through ZK
-      Thread.sleep(5000);
+    try (AccumuloClient client = getClient()) {
+      rootHasWritePermission = client.securityOperations().hasTablePermission("root",
+          MetadataTable.NAME, TablePermission.WRITE);
+      if (!rootHasWritePermission) {
+        client.securityOperations().grantTablePermission("root", MetadataTable.NAME,
+            TablePermission.WRITE);
+        // Make sure it propagates through ZK
+        Thread.sleep(5000);
+      }
     }
   }
 
   @After
   public void resetMetadataPermission() throws Exception {
-    AccumuloClient client = getClient();
-    // Final state doesn't match the original
-    if (rootHasWritePermission != client.securityOperations().hasTablePermission("root",
-        MetadataTable.NAME, TablePermission.WRITE)) {
-      if (rootHasWritePermission) {
-        // root had write permission when starting, ensure root still does
-        client.securityOperations().grantTablePermission("root", MetadataTable.NAME,
-            TablePermission.WRITE);
-      } else {
-        // root did not have write permission when starting, ensure that it does not
-        client.securityOperations().revokeTablePermission("root", MetadataTable.NAME,
-            TablePermission.WRITE);
+    try (AccumuloClient client = getClient()) {
+      // Final state doesn't match the original
+      if (rootHasWritePermission != client.securityOperations().hasTablePermission("root",
+          MetadataTable.NAME, TablePermission.WRITE)) {
+        if (rootHasWritePermission) {
+          // root had write permission when starting, ensure root still does
+          client.securityOperations().grantTablePermission("root", MetadataTable.NAME,
+              TablePermission.WRITE);
+        } else {
+          // root did not have write permission when starting, ensure that it does not
+          client.securityOperations().revokeTablePermission("root", MetadataTable.NAME,
+              TablePermission.WRITE);
+        }
       }
     }
   }
 
   @Test
   public void testEmptyWalRecoveryCompletes() throws Exception {
-    AccumuloClient client = getClient();
-    MiniAccumuloClusterImpl cluster = getCluster();
-    FileSystem fs = cluster.getFileSystem();
+    try (AccumuloClient client = getClient()) {
+      MiniAccumuloClusterImpl cluster = getCluster();
+      FileSystem fs = cluster.getFileSystem();
 
-    // Fake out something that looks like host:port, it's irrelevant
-    String fakeServer = "127.0.0.1:12345";
+      // Fake out something that looks like host:port, it's irrelevant
+      String fakeServer = "127.0.0.1:12345";
 
-    File walogs = new File(cluster.getConfig().getAccumuloDir(), ServerConstants.WAL_DIR);
-    File walogServerDir = new File(walogs, fakeServer.replace(':', '+'));
-    File emptyWalog = new File(walogServerDir, UUID.randomUUID().toString());
+      File walogs = new File(cluster.getConfig().getAccumuloDir(), ServerConstants.WAL_DIR);
+      File walogServerDir = new File(walogs, fakeServer.replace(':', '+'));
+      File emptyWalog = new File(walogServerDir, UUID.randomUUID().toString());
 
-    log.info("Created empty WAL at {}", emptyWalog.toURI());
+      log.info("Created empty WAL at {}", emptyWalog.toURI());
 
-    fs.create(new Path(emptyWalog.toURI())).close();
+      fs.create(new Path(emptyWalog.toURI())).close();
 
-    assertTrue("root user did not have write permission to metadata table",
-        client.securityOperations().hasTablePermission("root", MetadataTable.NAME,
-            TablePermission.WRITE));
+      assertTrue("root user did not have write permission to metadata table",
+          client.securityOperations().hasTablePermission("root", MetadataTable.NAME,
+              TablePermission.WRITE));
 
-    String tableName = getUniqueNames(1)[0];
-    client.tableOperations().create(tableName);
+      String tableName = getUniqueNames(1)[0];
+      client.tableOperations().create(tableName);
 
-    Table.ID tableId = Table.ID.of(client.tableOperations().tableIdMap().get(tableName));
-    assertNotNull("Table ID was null", tableId);
+      Table.ID tableId = Table.ID.of(client.tableOperations().tableIdMap().get(tableName));
+      assertNotNull("Table ID was null", tableId);
 
-    LogEntry logEntry = new LogEntry(new KeyExtent(tableId, null, null), 0, "127.0.0.1:12345",
-        emptyWalog.toURI().toString());
+      LogEntry logEntry = new LogEntry(new KeyExtent(tableId, null, null), 0, "127.0.0.1:12345",
+          emptyWalog.toURI().toString());
 
-    log.info("Taking {} offline", tableName);
-    client.tableOperations().offline(tableName, true);
+      log.info("Taking {} offline", tableName);
+      client.tableOperations().offline(tableName, true);
 
-    log.info("{} is offline", tableName);
+      log.info("{} is offline", tableName);
 
-    Text row = MetadataSchema.TabletsSection.getRow(tableId, null);
-    Mutation m = new Mutation(row);
-    m.put(logEntry.getColumnFamily(), logEntry.getColumnQualifier(), logEntry.getValue());
+      Text row = MetadataSchema.TabletsSection.getRow(tableId, null);
+      Mutation m = new Mutation(row);
+      m.put(logEntry.getColumnFamily(), logEntry.getColumnQualifier(), logEntry.getValue());
 
-    BatchWriter bw = client.createBatchWriter(MetadataTable.NAME, new BatchWriterConfig());
-    bw.addMutation(m);
-    bw.close();
+      BatchWriter bw = client.createBatchWriter(MetadataTable.NAME, new BatchWriterConfig());
+      bw.addMutation(m);
+      bw.close();
 
-    log.info("Bringing {} online", tableName);
-    client.tableOperations().online(tableName, true);
+      log.info("Bringing {} online", tableName);
+      client.tableOperations().online(tableName, true);
 
-    log.info("{} is online", tableName);
+      log.info("{} is online", tableName);
 
-    // 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.
-    try (Scanner s = client.createScanner(tableName, Authorizations.EMPTY)) {
-      assertEquals(0, Iterables.size(s));
+      // 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.
+      try (Scanner s = client.createScanner(tableName, Authorizations.EMPTY)) {
+        assertEquals(0, Iterables.size(s));
+      }
     }
   }
 
   @Test
   public void testPartialHeaderWalRecoveryCompletes() throws Exception {
-    AccumuloClient client = getClient();
-    MiniAccumuloClusterImpl cluster = getCluster();
-    FileSystem fs = getCluster().getFileSystem();
+    try (AccumuloClient client = getClient()) {
+      MiniAccumuloClusterImpl cluster = getCluster();
+      FileSystem fs = getCluster().getFileSystem();
 
-    // Fake out something that looks like host:port, it's irrelevant
-    String fakeServer = "127.0.0.1:12345";
+      // Fake out something that looks like host:port, it's irrelevant
+      String fakeServer = "127.0.0.1:12345";
 
-    File walogs = new File(cluster.getConfig().getAccumuloDir(), ServerConstants.WAL_DIR);
-    File walogServerDir = new File(walogs, fakeServer.replace(':', '+'));
-    File partialHeaderWalog = new File(walogServerDir, UUID.randomUUID().toString());
+      File walogs = new File(cluster.getConfig().getAccumuloDir(), ServerConstants.WAL_DIR);
+      File walogServerDir = new File(walogs, fakeServer.replace(':', '+'));
+      File partialHeaderWalog = new File(walogServerDir, UUID.randomUUID().toString());
 
-    log.info("Created WAL with malformed header at {}", partialHeaderWalog.toURI());
+      log.info("Created WAL with malformed header at {}", partialHeaderWalog.toURI());
 
-    // Write half of the header
-    FSDataOutputStream wal = fs.create(new Path(partialHeaderWalog.toURI()));
-    wal.write(DfsLogger.LOG_FILE_HEADER_V4.getBytes(UTF_8), 0,
-        DfsLogger.LOG_FILE_HEADER_V4.length() / 2);
-    wal.close();
+      // Write half of the header
+      FSDataOutputStream wal = fs.create(new Path(partialHeaderWalog.toURI()));
+      wal.write(DfsLogger.LOG_FILE_HEADER_V4.getBytes(UTF_8), 0,
+          DfsLogger.LOG_FILE_HEADER_V4.length() / 2);
+      wal.close();
 
-    assertTrue("root user did not have write permission to metadata table",
-        client.securityOperations().hasTablePermission("root", MetadataTable.NAME,
-            TablePermission.WRITE));
+      assertTrue("root user did not have write permission to metadata table",
+          client.securityOperations().hasTablePermission("root", MetadataTable.NAME,
+              TablePermission.WRITE));
 
-    String tableName = getUniqueNames(1)[0];
-    client.tableOperations().create(tableName);
+      String tableName = getUniqueNames(1)[0];
+      client.tableOperations().create(tableName);
 
-    Table.ID tableId = Table.ID.of(client.tableOperations().tableIdMap().get(tableName));
-    assertNotNull("Table ID was null", tableId);
+      Table.ID tableId = Table.ID.of(client.tableOperations().tableIdMap().get(tableName));
+      assertNotNull("Table ID was null", tableId);
 
-    LogEntry logEntry = new LogEntry(null, 0, "127.0.0.1:12345",
-        partialHeaderWalog.toURI().toString());
+      LogEntry logEntry = new LogEntry(null, 0, "127.0.0.1:12345",
+          partialHeaderWalog.toURI().toString());
 
-    log.info("Taking {} offline", tableName);
-    client.tableOperations().offline(tableName, true);
+      log.info("Taking {} offline", tableName);
+      client.tableOperations().offline(tableName, true);
 
-    log.info("{} is offline", tableName);
+      log.info("{} is offline", tableName);
 
-    Text row = MetadataSchema.TabletsSection.getRow(tableId, null);
-    Mutation m = new Mutation(row);
-    m.put(logEntry.getColumnFamily(), logEntry.getColumnQualifier(), logEntry.getValue());
+      Text row = MetadataSchema.TabletsSection.getRow(tableId, null);
+      Mutation m = new Mutation(row);
+      m.put(logEntry.getColumnFamily(), logEntry.getColumnQualifier(), logEntry.getValue());
 
-    BatchWriter bw = client.createBatchWriter(MetadataTable.NAME, new BatchWriterConfig());
-    bw.addMutation(m);
-    bw.close();
+      BatchWriter bw = client.createBatchWriter(MetadataTable.NAME, new BatchWriterConfig());
+      bw.addMutation(m);
+      bw.close();
 
-    log.info("Bringing {} online", tableName);
-    client.tableOperations().online(tableName, true);
+      log.info("Bringing {} online", tableName);
+      client.tableOperations().online(tableName, true);
 
-    log.info("{} is online", tableName);
+      log.info("{} is online", tableName);
 
-    // 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.
-    try (Scanner s = client.createScanner(tableName, Authorizations.EMPTY)) {
-      assertEquals(0, Iterables.size(s));
+      // 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.
+      try (Scanner s = client.createScanner(tableName, Authorizations.EMPTY)) {
+        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 1b33a4dfef..e1b0a9c50d 100644
--- a/test/src/main/java/org/apache/accumulo/test/MultiTableBatchWriterIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/MultiTableBatchWriterIT.java
@@ -29,20 +29,18 @@
 import org.apache.accumulo.core.client.AccumuloException;
 import org.apache.accumulo.core.client.AccumuloSecurityException;
 import org.apache.accumulo.core.client.BatchWriter;
-import org.apache.accumulo.core.client.BatchWriterConfig;
 import org.apache.accumulo.core.client.MultiTableBatchWriter;
 import org.apache.accumulo.core.client.MutationsRejectedException;
 import org.apache.accumulo.core.client.Scanner;
 import org.apache.accumulo.core.client.TableNotFoundException;
 import org.apache.accumulo.core.client.admin.TableOperations;
-import org.apache.accumulo.core.client.impl.ClientContext;
-import org.apache.accumulo.core.client.impl.MultiTableBatchWriterImpl;
 import org.apache.accumulo.core.data.Key;
 import org.apache.accumulo.core.data.Mutation;
 import org.apache.accumulo.core.data.Range;
 import org.apache.accumulo.core.data.Value;
 import org.apache.accumulo.core.security.Authorizations;
 import org.apache.accumulo.harness.AccumuloClusterHarness;
+import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 
@@ -64,9 +62,13 @@ public void setUpArgs() throws AccumuloException, AccumuloSecurityException {
     mtbw = getMultiTableBatchWriter();
   }
 
+  @After
+  public void closeClient() {
+    accumuloClient.close();
+  }
+
   public MultiTableBatchWriter getMultiTableBatchWriter() {
-    ClientContext context = getClientContext();
-    return new MultiTableBatchWriterImpl(context, new BatchWriterConfig());
+    return accumuloClient.createMultiTableBatchWriter();
   }
 
   @Test
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 12763df582..a7295884ae 100644
--- a/test/src/main/java/org/apache/accumulo/test/MultiTableRecoveryIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/MultiTableRecoveryIT.java
@@ -57,65 +57,66 @@ protected void configure(MiniAccumuloConfigImpl cfg, Configuration hadoopCoreSit
   @Test(timeout = 4 * 60 * 1000)
   public void testRecoveryOverMultipleTables() throws Exception {
     final int N = 3;
-    final AccumuloClient c = getClient();
-    final String[] tables = getUniqueNames(N);
-    final BatchWriter[] writers = new BatchWriter[N];
-    final byte[][] values = new byte[N][];
-    int i = 0;
-    System.out.println("Creating tables");
-    for (String tableName : tables) {
-      c.tableOperations().create(tableName);
-      values[i] = Integer.toString(i).getBytes();
-      writers[i] = c.createBatchWriter(tableName, null);
-      i++;
-    }
-    System.out.println("Creating agitator");
-    final AtomicBoolean stop = new AtomicBoolean(false);
-    final Thread agitator = agitator(stop);
-    agitator.start();
-    System.out.println("writing");
-    final Random random = new SecureRandom();
-    for (i = 0; i < 1_000_000; i++) {
-      // make non-negative avoiding Math.abs, because that can still be negative
-      long randomRow = random.nextLong() & Long.MAX_VALUE;
-      assertTrue(randomRow >= 0);
-      final int table = (int) (randomRow % N);
-      final Mutation m = new Mutation(Long.toHexString(randomRow));
-      m.put(new byte[0], new byte[0], values[table]);
-      writers[table].addMutation(m);
-      if (i % 10_000 == 0) {
-        System.out.println("flushing");
-        for (int w = 0; w < N; w++) {
-          writers[w].flush();
+    try (AccumuloClient c = getClient()) {
+      final String[] tables = getUniqueNames(N);
+      final BatchWriter[] writers = new BatchWriter[N];
+      final byte[][] values = new byte[N][];
+      int i = 0;
+      System.out.println("Creating tables");
+      for (String tableName : tables) {
+        c.tableOperations().create(tableName);
+        values[i] = Integer.toString(i).getBytes();
+        writers[i] = c.createBatchWriter(tableName, null);
+        i++;
+      }
+      System.out.println("Creating agitator");
+      final AtomicBoolean stop = new AtomicBoolean(false);
+      final Thread agitator = agitator(stop);
+      agitator.start();
+      System.out.println("writing");
+      final Random random = new SecureRandom();
+      for (i = 0; i < 1_000_000; i++) {
+        // make non-negative avoiding Math.abs, because that can still be negative
+        long randomRow = random.nextLong() & Long.MAX_VALUE;
+        assertTrue(randomRow >= 0);
+        final int table = (int) (randomRow % N);
+        final Mutation m = new Mutation(Long.toHexString(randomRow));
+        m.put(new byte[0], new byte[0], values[table]);
+        writers[table].addMutation(m);
+        if (i % 10_000 == 0) {
+          System.out.println("flushing");
+          for (int w = 0; w < N; w++) {
+            writers[w].flush();
+          }
         }
       }
-    }
-    System.out.println("closing");
-    for (int w = 0; w < N; w++) {
-      writers[w].close();
-    }
-    System.out.println("stopping the agitator");
-    stop.set(true);
-    agitator.join();
-    System.out.println("checking the data");
-    long count = 0;
-    for (int w = 0; w < N; w++) {
-      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++;
+      System.out.println("closing");
+      for (int w = 0; w < N; w++) {
+        writers[w].close();
+      }
+      System.out.println("stopping the agitator");
+      stop.set(true);
+      agitator.join();
+      System.out.println("checking the data");
+      long count = 0;
+      for (int w = 0; w < N; w++) {
+        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++;
+          }
         }
       }
+      assertEquals(1_000_000, count);
     }
-    assertEquals(1_000_000, count);
   }
 
   private Thread agitator(final AtomicBoolean stop) {
     return new Thread() {
       @Override
       public void run() {
-        try {
+        try (AccumuloClient client = getClient()) {
           int i = 0;
           while (!stop.get()) {
             sleepUninterruptibly(10, TimeUnit.SECONDS);
@@ -123,8 +124,8 @@ public void run() {
             getCluster().getClusterControl().stop(ServerType.TABLET_SERVER);
             getCluster().start();
             // read the metadata table to know everything is back up
-            Iterators.size(
-                getClient().createScanner(MetadataTable.NAME, Authorizations.EMPTY).iterator());
+            Iterators
+                .size(client.createScanner(MetadataTable.NAME, Authorizations.EMPTY).iterator());
             i++;
           }
           System.out.println("Restarted " + i + " times");
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 80c17ca4ed..246466960d 100644
--- a/test/src/main/java/org/apache/accumulo/test/NamespacesIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/NamespacesIT.java
@@ -127,6 +127,8 @@ public void setupConnectorAndNamespace() throws Exception {
       if (!getAdminPrincipal().equals(u))
         c.securityOperations().dropLocalUser(u);
     assertEquals(1, c.securityOperations().listLocalUsers().size());
+
+    c.close();
   }
 
   @Test
@@ -677,193 +679,195 @@ public void testPermissions() throws Exception {
     c.securityOperations().createLocalUser(u1, pass);
 
     loginAs(user1);
-    AccumuloClient user1Con = c.changeUser(u1, user1.getToken());
+    try (AccumuloClient user1Con = c.changeUser(u1, user1.getToken())) {
 
-    try {
+      try {
+        user1Con.tableOperations().create(t2);
+        fail();
+      } catch (AccumuloSecurityException e) {
+        expectPermissionDenied(e);
+      }
+
+      loginAs(root);
+      c.securityOperations().grantNamespacePermission(u1, n1, NamespacePermission.CREATE_TABLE);
+      loginAs(user1);
       user1Con.tableOperations().create(t2);
-      fail();
-    } catch (AccumuloSecurityException e) {
-      expectPermissionDenied(e);
-    }
+      loginAs(root);
+      assertTrue(c.tableOperations().list().contains(t2));
+      c.securityOperations().revokeNamespacePermission(u1, n1, NamespacePermission.CREATE_TABLE);
 
-    loginAs(root);
-    c.securityOperations().grantNamespacePermission(u1, n1, NamespacePermission.CREATE_TABLE);
-    loginAs(user1);
-    user1Con.tableOperations().create(t2);
-    loginAs(root);
-    assertTrue(c.tableOperations().list().contains(t2));
-    c.securityOperations().revokeNamespacePermission(u1, n1, NamespacePermission.CREATE_TABLE);
+      loginAs(user1);
+      try {
+        user1Con.tableOperations().delete(t1);
+        fail();
+      } catch (AccumuloSecurityException e) {
+        expectPermissionDenied(e);
+      }
 
-    loginAs(user1);
-    try {
+      loginAs(root);
+      c.securityOperations().grantNamespacePermission(u1, n1, NamespacePermission.DROP_TABLE);
+      loginAs(user1);
       user1Con.tableOperations().delete(t1);
-      fail();
-    } catch (AccumuloSecurityException e) {
-      expectPermissionDenied(e);
-    }
-
-    loginAs(root);
-    c.securityOperations().grantNamespacePermission(u1, n1, NamespacePermission.DROP_TABLE);
-    loginAs(user1);
-    user1Con.tableOperations().delete(t1);
-    loginAs(root);
-    assertTrue(!c.tableOperations().list().contains(t1));
-    c.securityOperations().revokeNamespacePermission(u1, n1, NamespacePermission.DROP_TABLE);
+      loginAs(root);
+      assertTrue(!c.tableOperations().list().contains(t1));
+      c.securityOperations().revokeNamespacePermission(u1, n1, NamespacePermission.DROP_TABLE);
+
+      c.tableOperations().create(t3);
+      BatchWriter bw = c.createBatchWriter(t3, null);
+      Mutation m = new Mutation("row");
+      m.put("cf", "cq", "value");
+      bw.addMutation(m);
+      bw.close();
 
-    c.tableOperations().create(t3);
-    BatchWriter bw = c.createBatchWriter(t3, null);
-    Mutation m = new Mutation("row");
-    m.put("cf", "cq", "value");
-    bw.addMutation(m);
-    bw.close();
+      loginAs(user1);
+      Iterator<Entry<Key,Value>> i = user1Con.createScanner(t3, new Authorizations()).iterator();
+      try {
+        i.next();
+        fail();
+      } catch (RuntimeException e) {
+        assertEquals(AccumuloSecurityException.class.getName(), e.getCause().getClass().getName());
+        expectPermissionDenied((AccumuloSecurityException) e.getCause());
+      }
 
-    loginAs(user1);
-    Iterator<Entry<Key,Value>> i = user1Con.createScanner(t3, new Authorizations()).iterator();
-    try {
-      i.next();
-      fail();
-    } catch (RuntimeException e) {
-      assertEquals(AccumuloSecurityException.class.getName(), e.getCause().getClass().getName());
-      expectPermissionDenied((AccumuloSecurityException) e.getCause());
-    }
+      loginAs(user1);
+      m = new Mutation(u1);
+      m.put("cf", "cq", "turtles");
+      bw = user1Con.createBatchWriter(t3, null);
+      try {
+        bw.addMutation(m);
+        bw.close();
+        fail();
+      } catch (MutationsRejectedException e) {
+        assertEquals(1, e.getSecurityErrorCodes().size());
+        assertEquals(1, e.getSecurityErrorCodes().entrySet().iterator().next().getValue().size());
+        switch (e.getSecurityErrorCodes().entrySet().iterator().next().getValue().iterator()
+            .next()) {
+          case PERMISSION_DENIED:
+            break;
+          default:
+            fail();
+        }
+      }
 
-    loginAs(user1);
-    m = new Mutation(u1);
-    m.put("cf", "cq", "turtles");
-    bw = user1Con.createBatchWriter(t3, null);
-    try {
+      loginAs(root);
+      c.securityOperations().grantNamespacePermission(u1, n1, NamespacePermission.READ);
+      loginAs(user1);
+      i = user1Con.createScanner(t3, new Authorizations()).iterator();
+      assertTrue(i.hasNext());
+      loginAs(root);
+      c.securityOperations().revokeNamespacePermission(u1, n1, NamespacePermission.READ);
+      c.securityOperations().grantNamespacePermission(u1, n1, NamespacePermission.WRITE);
+
+      loginAs(user1);
+      m = new Mutation(u1);
+      m.put("cf", "cq", "turtles");
+      bw = user1Con.createBatchWriter(t3, null);
       bw.addMutation(m);
       bw.close();
-      fail();
-    } catch (MutationsRejectedException e) {
-      assertEquals(1, e.getSecurityErrorCodes().size());
-      assertEquals(1, e.getSecurityErrorCodes().entrySet().iterator().next().getValue().size());
-      switch (e.getSecurityErrorCodes().entrySet().iterator().next().getValue().iterator().next()) {
-        case PERMISSION_DENIED:
-          break;
-        default:
-          fail();
-      }
-    }
-
-    loginAs(root);
-    c.securityOperations().grantNamespacePermission(u1, n1, NamespacePermission.READ);
-    loginAs(user1);
-    i = user1Con.createScanner(t3, new Authorizations()).iterator();
-    assertTrue(i.hasNext());
-    loginAs(root);
-    c.securityOperations().revokeNamespacePermission(u1, n1, NamespacePermission.READ);
-    c.securityOperations().grantNamespacePermission(u1, n1, NamespacePermission.WRITE);
+      loginAs(root);
+      c.securityOperations().revokeNamespacePermission(u1, n1, NamespacePermission.WRITE);
 
-    loginAs(user1);
-    m = new Mutation(u1);
-    m.put("cf", "cq", "turtles");
-    bw = user1Con.createBatchWriter(t3, null);
-    bw.addMutation(m);
-    bw.close();
-    loginAs(root);
-    c.securityOperations().revokeNamespacePermission(u1, n1, NamespacePermission.WRITE);
+      loginAs(user1);
+      try {
+        user1Con.tableOperations().setProperty(t3, Property.TABLE_FILE_MAX.getKey(), "42");
+        fail();
+      } catch (AccumuloSecurityException e) {
+        expectPermissionDenied(e);
+      }
 
-    loginAs(user1);
-    try {
+      loginAs(root);
+      c.securityOperations().grantNamespacePermission(u1, n1, NamespacePermission.ALTER_TABLE);
+      loginAs(user1);
       user1Con.tableOperations().setProperty(t3, Property.TABLE_FILE_MAX.getKey(), "42");
-      fail();
-    } catch (AccumuloSecurityException e) {
-      expectPermissionDenied(e);
-    }
-
-    loginAs(root);
-    c.securityOperations().grantNamespacePermission(u1, n1, NamespacePermission.ALTER_TABLE);
-    loginAs(user1);
-    user1Con.tableOperations().setProperty(t3, Property.TABLE_FILE_MAX.getKey(), "42");
-    user1Con.tableOperations().removeProperty(t3, Property.TABLE_FILE_MAX.getKey());
-    loginAs(root);
-    c.securityOperations().revokeNamespacePermission(u1, n1, NamespacePermission.ALTER_TABLE);
+      user1Con.tableOperations().removeProperty(t3, Property.TABLE_FILE_MAX.getKey());
+      loginAs(root);
+      c.securityOperations().revokeNamespacePermission(u1, n1, NamespacePermission.ALTER_TABLE);
 
-    loginAs(user1);
-    try {
-      user1Con.namespaceOperations().setProperty(n1, Property.TABLE_FILE_MAX.getKey(), "55");
-      fail();
-    } catch (AccumuloSecurityException e) {
-      expectPermissionDenied(e);
-    }
+      loginAs(user1);
+      try {
+        user1Con.namespaceOperations().setProperty(n1, Property.TABLE_FILE_MAX.getKey(), "55");
+        fail();
+      } catch (AccumuloSecurityException e) {
+        expectPermissionDenied(e);
+      }
 
-    loginAs(root);
-    c.securityOperations().grantNamespacePermission(u1, n1, NamespacePermission.ALTER_NAMESPACE);
-    loginAs(user1);
-    user1Con.namespaceOperations().setProperty(n1, Property.TABLE_FILE_MAX.getKey(), "42");
-    user1Con.namespaceOperations().removeProperty(n1, Property.TABLE_FILE_MAX.getKey());
-    loginAs(root);
-    c.securityOperations().revokeNamespacePermission(u1, n1, NamespacePermission.ALTER_NAMESPACE);
+      loginAs(root);
+      c.securityOperations().grantNamespacePermission(u1, n1, NamespacePermission.ALTER_NAMESPACE);
+      loginAs(user1);
+      user1Con.namespaceOperations().setProperty(n1, Property.TABLE_FILE_MAX.getKey(), "42");
+      user1Con.namespaceOperations().removeProperty(n1, Property.TABLE_FILE_MAX.getKey());
+      loginAs(root);
+      c.securityOperations().revokeNamespacePermission(u1, n1, NamespacePermission.ALTER_NAMESPACE);
+
+      loginAs(root);
+      c.securityOperations().createLocalUser(u2,
+          (root.getPassword() == null ? null : new PasswordToken(user2.getPassword())));
+      loginAs(user1);
+      try {
+        user1Con.securityOperations().grantNamespacePermission(u2, n1,
+            NamespacePermission.ALTER_NAMESPACE);
+        fail();
+      } catch (AccumuloSecurityException e) {
+        expectPermissionDenied(e);
+      }
 
-    loginAs(root);
-    c.securityOperations().createLocalUser(u2,
-        (root.getPassword() == null ? null : new PasswordToken(user2.getPassword())));
-    loginAs(user1);
-    try {
+      loginAs(root);
+      c.securityOperations().grantNamespacePermission(u1, n1, NamespacePermission.GRANT);
+      loginAs(user1);
       user1Con.securityOperations().grantNamespacePermission(u2, n1,
           NamespacePermission.ALTER_NAMESPACE);
-      fail();
-    } catch (AccumuloSecurityException e) {
-      expectPermissionDenied(e);
-    }
+      user1Con.securityOperations().revokeNamespacePermission(u2, n1,
+          NamespacePermission.ALTER_NAMESPACE);
+      loginAs(root);
+      c.securityOperations().revokeNamespacePermission(u1, n1, NamespacePermission.GRANT);
 
-    loginAs(root);
-    c.securityOperations().grantNamespacePermission(u1, n1, NamespacePermission.GRANT);
-    loginAs(user1);
-    user1Con.securityOperations().grantNamespacePermission(u2, n1,
-        NamespacePermission.ALTER_NAMESPACE);
-    user1Con.securityOperations().revokeNamespacePermission(u2, n1,
-        NamespacePermission.ALTER_NAMESPACE);
-    loginAs(root);
-    c.securityOperations().revokeNamespacePermission(u1, n1, NamespacePermission.GRANT);
+      loginAs(user1);
+      try {
+        user1Con.namespaceOperations().create(n2);
+        fail();
+      } catch (AccumuloSecurityException e) {
+        expectPermissionDenied(e);
+      }
 
-    loginAs(user1);
-    try {
+      loginAs(root);
+      c.securityOperations().grantSystemPermission(u1, SystemPermission.CREATE_NAMESPACE);
+      loginAs(user1);
       user1Con.namespaceOperations().create(n2);
-      fail();
-    } catch (AccumuloSecurityException e) {
-      expectPermissionDenied(e);
-    }
+      loginAs(root);
+      c.securityOperations().revokeSystemPermission(u1, SystemPermission.CREATE_NAMESPACE);
 
-    loginAs(root);
-    c.securityOperations().grantSystemPermission(u1, SystemPermission.CREATE_NAMESPACE);
-    loginAs(user1);
-    user1Con.namespaceOperations().create(n2);
-    loginAs(root);
-    c.securityOperations().revokeSystemPermission(u1, SystemPermission.CREATE_NAMESPACE);
+      c.securityOperations().revokeNamespacePermission(u1, n2, NamespacePermission.DROP_NAMESPACE);
+      loginAs(user1);
+      try {
+        user1Con.namespaceOperations().delete(n2);
+        fail();
+      } catch (AccumuloSecurityException e) {
+        expectPermissionDenied(e);
+      }
 
-    c.securityOperations().revokeNamespacePermission(u1, n2, NamespacePermission.DROP_NAMESPACE);
-    loginAs(user1);
-    try {
+      loginAs(root);
+      c.securityOperations().grantSystemPermission(u1, SystemPermission.DROP_NAMESPACE);
+      loginAs(user1);
       user1Con.namespaceOperations().delete(n2);
-      fail();
-    } catch (AccumuloSecurityException e) {
-      expectPermissionDenied(e);
-    }
+      loginAs(root);
+      c.securityOperations().revokeSystemPermission(u1, SystemPermission.DROP_NAMESPACE);
 
-    loginAs(root);
-    c.securityOperations().grantSystemPermission(u1, SystemPermission.DROP_NAMESPACE);
-    loginAs(user1);
-    user1Con.namespaceOperations().delete(n2);
-    loginAs(root);
-    c.securityOperations().revokeSystemPermission(u1, SystemPermission.DROP_NAMESPACE);
+      loginAs(user1);
+      try {
+        user1Con.namespaceOperations().setProperty(n1, Property.TABLE_FILE_MAX.getKey(), "33");
+        fail();
+      } catch (AccumuloSecurityException e) {
+        expectPermissionDenied(e);
+      }
 
-    loginAs(user1);
-    try {
+      loginAs(root);
+      c.securityOperations().grantSystemPermission(u1, SystemPermission.ALTER_NAMESPACE);
+      loginAs(user1);
       user1Con.namespaceOperations().setProperty(n1, Property.TABLE_FILE_MAX.getKey(), "33");
-      fail();
-    } catch (AccumuloSecurityException e) {
-      expectPermissionDenied(e);
+      user1Con.namespaceOperations().removeProperty(n1, Property.TABLE_FILE_MAX.getKey());
+      loginAs(root);
+      c.securityOperations().revokeSystemPermission(u1, SystemPermission.ALTER_NAMESPACE);
     }
-
-    loginAs(root);
-    c.securityOperations().grantSystemPermission(u1, SystemPermission.ALTER_NAMESPACE);
-    loginAs(user1);
-    user1Con.namespaceOperations().setProperty(n1, Property.TABLE_FILE_MAX.getKey(), "33");
-    user1Con.namespaceOperations().removeProperty(n1, Property.TABLE_FILE_MAX.getKey());
-    loginAs(root);
-    c.securityOperations().revokeSystemPermission(u1, SystemPermission.ALTER_NAMESPACE);
   }
 
   @Test
diff --git a/test/src/main/java/org/apache/accumulo/test/NewTableConfigurationIT.java b/test/src/main/java/org/apache/accumulo/test/NewTableConfigurationIT.java
index c2e092ca28..72bf554828 100644
--- a/test/src/main/java/org/apache/accumulo/test/NewTableConfigurationIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/NewTableConfigurationIT.java
@@ -67,27 +67,28 @@ public static void teardown() throws Exception {
   @Test
   public void testSetPropertiesOverwriteOlderProperties() throws AccumuloSecurityException,
       AccumuloException, TableExistsException, TableNotFoundException {
-    AccumuloClient client = getClient();
-    String tableName = getUniqueNames(2)[0];
-    NewTableConfiguration ntc = new NewTableConfiguration();
-    Map<String,String> initialProps = new HashMap<>();
-    initialProps.put(Property.TABLE_ARBITRARY_PROP_PREFIX.getKey() + "prop1", "val1");
-    initialProps.put(Property.TABLE_ARBITRARY_PROP_PREFIX.getKey() + "prop2", "val2");
-    ntc.setProperties(initialProps);
-    // Create a new set of properties and set them with setProperties
-    Map<String,String> updatedProps = new HashMap<>();
-    updatedProps.put(Property.TABLE_ARBITRARY_PROP_PREFIX.getKey() + "newerprop1", "newerval1");
-    updatedProps.put(Property.TABLE_ARBITRARY_PROP_PREFIX.getKey() + "newerprop2", "newerval2");
-    ntc.setProperties(updatedProps);
-    client.tableOperations().create(tableName, ntc);
-    // verify
-    Map<String,String> props = ntc.getProperties();
-    assertEquals(props.get(Property.TABLE_ARBITRARY_PROP_PREFIX.getKey() + "newerprop1"),
-        "newerval1");
-    assertEquals(props.get(Property.TABLE_ARBITRARY_PROP_PREFIX.getKey() + "newerprop2"),
-        "newerval2");
-    assertFalse(props.keySet().contains(Property.TABLE_ARBITRARY_PROP_PREFIX.getKey() + "prop1"));
-    assertFalse(props.keySet().contains(Property.TABLE_ARBITRARY_PROP_PREFIX.getKey() + "prop2"));
+    try (AccumuloClient client = getClient()) {
+      String tableName = getUniqueNames(2)[0];
+      NewTableConfiguration ntc = new NewTableConfiguration();
+      Map<String,String> initialProps = new HashMap<>();
+      initialProps.put(Property.TABLE_ARBITRARY_PROP_PREFIX.getKey() + "prop1", "val1");
+      initialProps.put(Property.TABLE_ARBITRARY_PROP_PREFIX.getKey() + "prop2", "val2");
+      ntc.setProperties(initialProps);
+      // Create a new set of properties and set them with setProperties
+      Map<String,String> updatedProps = new HashMap<>();
+      updatedProps.put(Property.TABLE_ARBITRARY_PROP_PREFIX.getKey() + "newerprop1", "newerval1");
+      updatedProps.put(Property.TABLE_ARBITRARY_PROP_PREFIX.getKey() + "newerprop2", "newerval2");
+      ntc.setProperties(updatedProps);
+      client.tableOperations().create(tableName, ntc);
+      // verify
+      Map<String,String> props = ntc.getProperties();
+      assertEquals(props.get(Property.TABLE_ARBITRARY_PROP_PREFIX.getKey() + "newerprop1"),
+          "newerval1");
+      assertEquals(props.get(Property.TABLE_ARBITRARY_PROP_PREFIX.getKey() + "newerprop2"),
+          "newerval2");
+      assertFalse(props.keySet().contains(Property.TABLE_ARBITRARY_PROP_PREFIX.getKey() + "prop1"));
+      assertFalse(props.keySet().contains(Property.TABLE_ARBITRARY_PROP_PREFIX.getKey() + "prop2"));
+    }
   }
 
   /**
@@ -112,24 +113,25 @@ public void testOverlappingGroupsFail()
   @Test
   public void testSimpleLocalityGroupCreation() throws AccumuloSecurityException, AccumuloException,
       TableExistsException, TableNotFoundException {
-    AccumuloClient client = getClient();
-    String tableName = getUniqueNames(2)[0];
-    NewTableConfiguration ntc = new NewTableConfiguration();
-    // set locality groups map
-    Map<String,Set<Text>> lgroups = new HashMap<>();
-    lgroups.put("lg1", ImmutableSet.of(new Text("dog"), new Text("cat")));
-    lgroups.put("lg2", ImmutableSet.of(new Text("lion"), new Text("tiger")));
-    // set groups via NewTableConfiguration
-    ntc.setLocalityGroups(lgroups);
-    client.tableOperations().create(tableName, ntc);
-    // verify
-    Map<String,Set<Text>> createdLocalityGroups = client.tableOperations()
-        .getLocalityGroups(tableName);
-    assertEquals(2, createdLocalityGroups.size());
-    assertEquals(createdLocalityGroups.get("lg1"),
-        ImmutableSet.of(new Text("dog"), new Text("cat")));
-    assertEquals(createdLocalityGroups.get("lg2"),
-        ImmutableSet.of(new Text("lion"), new Text("tiger")));
+    try (AccumuloClient client = getClient()) {
+      String tableName = getUniqueNames(2)[0];
+      NewTableConfiguration ntc = new NewTableConfiguration();
+      // set locality groups map
+      Map<String,Set<Text>> lgroups = new HashMap<>();
+      lgroups.put("lg1", ImmutableSet.of(new Text("dog"), new Text("cat")));
+      lgroups.put("lg2", ImmutableSet.of(new Text("lion"), new Text("tiger")));
+      // set groups via NewTableConfiguration
+      ntc.setLocalityGroups(lgroups);
+      client.tableOperations().create(tableName, ntc);
+      // verify
+      Map<String,Set<Text>> createdLocalityGroups = client.tableOperations()
+          .getLocalityGroups(tableName);
+      assertEquals(2, createdLocalityGroups.size());
+      assertEquals(createdLocalityGroups.get("lg1"),
+          ImmutableSet.of(new Text("dog"), new Text("cat")));
+      assertEquals(createdLocalityGroups.get("lg2"),
+          ImmutableSet.of(new Text("lion"), new Text("tiger")));
+    }
   }
 
   /**
@@ -138,24 +140,25 @@ public void testSimpleLocalityGroupCreation() throws AccumuloSecurityException,
   @Test
   public void testMulitpleCallsToSetLocalityGroups() throws AccumuloSecurityException,
       AccumuloException, TableExistsException, TableNotFoundException {
-    AccumuloClient client = getClient();
-    String tableName = getUniqueNames(2)[0];
-    NewTableConfiguration ntc = new NewTableConfiguration();
-    // set first locality groups map
-    Map<String,Set<Text>> initalGroup = new HashMap<>();
-    initalGroup.put("lg1", ImmutableSet.of(new Text("dog"), new Text("cat")));
-    ntc.setLocalityGroups(initalGroup);
-    // set a second locality groups map and set in method call
-    Map<String,Set<Text>> secondGroup = new HashMap<>();
-    secondGroup.put("lg1", ImmutableSet.of(new Text("blue"), new Text("red")));
-    ntc.setLocalityGroups(secondGroup);
-    client.tableOperations().create(tableName, ntc);
-    // verify
-    Map<String,Set<Text>> createdLocalityGroups = client.tableOperations()
-        .getLocalityGroups(tableName);
-    assertEquals(1, createdLocalityGroups.size());
-    assertEquals(createdLocalityGroups.get("lg1"),
-        ImmutableSet.of(new Text("red"), new Text("blue")));
+    try (AccumuloClient client = getClient()) {
+      String tableName = getUniqueNames(2)[0];
+      NewTableConfiguration ntc = new NewTableConfiguration();
+      // set first locality groups map
+      Map<String,Set<Text>> initalGroup = new HashMap<>();
+      initalGroup.put("lg1", ImmutableSet.of(new Text("dog"), new Text("cat")));
+      ntc.setLocalityGroups(initalGroup);
+      // set a second locality groups map and set in method call
+      Map<String,Set<Text>> secondGroup = new HashMap<>();
+      secondGroup.put("lg1", ImmutableSet.of(new Text("blue"), new Text("red")));
+      ntc.setLocalityGroups(secondGroup);
+      client.tableOperations().create(tableName, ntc);
+      // verify
+      Map<String,Set<Text>> createdLocalityGroups = client.tableOperations()
+          .getLocalityGroups(tableName);
+      assertEquals(1, createdLocalityGroups.size());
+      assertEquals(createdLocalityGroups.get("lg1"),
+          ImmutableSet.of(new Text("red"), new Text("blue")));
+    }
   }
 
   /**
@@ -164,44 +167,45 @@ public void testMulitpleCallsToSetLocalityGroups() throws AccumuloSecurityExcept
   @Test
   public void testSetPropertiesAndGroups() throws AccumuloSecurityException, AccumuloException,
       TableExistsException, TableNotFoundException {
-    AccumuloClient client = getClient();
-    String tableName = getUniqueNames(2)[0];
-    NewTableConfiguration ntc = new NewTableConfiguration();
-
-    Map<String,String> props = new HashMap<>();
-    props.put(Property.TABLE_ARBITRARY_PROP_PREFIX.getKey() + "prop1", "val1");
-    props.put(Property.TABLE_ARBITRARY_PROP_PREFIX.getKey() + "prop2", "val2");
-    ntc.setProperties(props);
-
-    Map<String,Set<Text>> lgroups = new HashMap<>();
-    lgroups.put("lg1", ImmutableSet.of(new Text("dog")));
-    ntc.setLocalityGroups(lgroups);
-    client.tableOperations().create(tableName, ntc);
-    // verify
-    int count = 0;
-    for (Entry<String,String> property : client.tableOperations().getProperties(tableName)) {
-      if (property.getKey().equals("table.group.lg1")) {
-        assertEquals(property.getValue(), "dog");
-        count++;
-      }
-      if (property.getKey().equals("table.groups.enabled")) {
-        assertEquals(property.getValue(), "lg1");
-        count++;
-      }
-      if (property.getKey().equals(Property.TABLE_ARBITRARY_PROP_PREFIX.getKey() + "prop1")) {
-        assertEquals(property.getValue(), "val1");
-        count++;
-      }
-      if (property.getKey().equals(Property.TABLE_ARBITRARY_PROP_PREFIX.getKey() + "prop2")) {
-        assertEquals(property.getValue(), "val2");
-        count++;
+    try (AccumuloClient client = getClient()) {
+      String tableName = getUniqueNames(2)[0];
+      NewTableConfiguration ntc = new NewTableConfiguration();
+
+      Map<String,String> props = new HashMap<>();
+      props.put(Property.TABLE_ARBITRARY_PROP_PREFIX.getKey() + "prop1", "val1");
+      props.put(Property.TABLE_ARBITRARY_PROP_PREFIX.getKey() + "prop2", "val2");
+      ntc.setProperties(props);
+
+      Map<String,Set<Text>> lgroups = new HashMap<>();
+      lgroups.put("lg1", ImmutableSet.of(new Text("dog")));
+      ntc.setLocalityGroups(lgroups);
+      client.tableOperations().create(tableName, ntc);
+      // verify
+      int count = 0;
+      for (Entry<String,String> property : client.tableOperations().getProperties(tableName)) {
+        if (property.getKey().equals("table.group.lg1")) {
+          assertEquals(property.getValue(), "dog");
+          count++;
+        }
+        if (property.getKey().equals("table.groups.enabled")) {
+          assertEquals(property.getValue(), "lg1");
+          count++;
+        }
+        if (property.getKey().equals(Property.TABLE_ARBITRARY_PROP_PREFIX.getKey() + "prop1")) {
+          assertEquals(property.getValue(), "val1");
+          count++;
+        }
+        if (property.getKey().equals(Property.TABLE_ARBITRARY_PROP_PREFIX.getKey() + "prop2")) {
+          assertEquals(property.getValue(), "val2");
+          count++;
+        }
       }
+      assertEquals(4, count);
+      Map<String,Set<Text>> createdLocalityGroups = client.tableOperations()
+          .getLocalityGroups(tableName);
+      assertEquals(1, createdLocalityGroups.size());
+      assertEquals(createdLocalityGroups.get("lg1"), ImmutableSet.of(new Text("dog")));
     }
-    assertEquals(4, count);
-    Map<String,Set<Text>> createdLocalityGroups = client.tableOperations()
-        .getLocalityGroups(tableName);
-    assertEquals(1, createdLocalityGroups.size());
-    assertEquals(createdLocalityGroups.get("lg1"), ImmutableSet.of(new Text("dog")));
   }
 
   /**
@@ -230,22 +234,23 @@ public void testInvalidTablePropertiesSet() throws AccumuloSecurityException, Ac
   @Test
   public void testSetGroupsWithoutDefaultIterators() throws AccumuloSecurityException,
       AccumuloException, TableExistsException, TableNotFoundException {
-    AccumuloClient client = getClient();
-    String tableName = getUniqueNames(2)[0];
-    NewTableConfiguration ntc = new NewTableConfiguration().withoutDefaultIterators();
-
-    Map<String,Set<Text>> lgroups = new HashMap<>();
-    lgroups.put("lg1", ImmutableSet.of(new Text("colF")));
-    ntc.setLocalityGroups(lgroups);
-    client.tableOperations().create(tableName, ntc);
-    // verify groups and verify no iterators
-    Map<String,Set<Text>> createdLocalityGroups = client.tableOperations()
-        .getLocalityGroups(tableName);
-    assertEquals(1, createdLocalityGroups.size());
-    assertEquals(createdLocalityGroups.get("lg1"), ImmutableSet.of(new Text("colF")));
-    Map<String,EnumSet<IteratorScope>> iterators = client.tableOperations()
-        .listIterators(tableName);
-    assertEquals(0, iterators.size());
+    try (AccumuloClient client = getClient()) {
+      String tableName = getUniqueNames(2)[0];
+      NewTableConfiguration ntc = new NewTableConfiguration().withoutDefaultIterators();
+
+      Map<String,Set<Text>> lgroups = new HashMap<>();
+      lgroups.put("lg1", ImmutableSet.of(new Text("colF")));
+      ntc.setLocalityGroups(lgroups);
+      client.tableOperations().create(tableName, ntc);
+      // verify groups and verify no iterators
+      Map<String,Set<Text>> createdLocalityGroups = client.tableOperations()
+          .getLocalityGroups(tableName);
+      assertEquals(1, createdLocalityGroups.size());
+      assertEquals(createdLocalityGroups.get("lg1"), ImmutableSet.of(new Text("colF")));
+      Map<String,EnumSet<IteratorScope>> iterators = client.tableOperations()
+          .listIterators(tableName);
+      assertEquals(0, iterators.size());
+    }
   }
 
   /**
@@ -255,25 +260,26 @@ public void testSetGroupsWithoutDefaultIterators() throws AccumuloSecurityExcept
   @Test
   public void testPreconfigureIteratorWithDefaultIterator1() throws AccumuloException,
       TableNotFoundException, AccumuloSecurityException, TableExistsException {
-    AccumuloClient client = getClient();
-    String tableName = getUniqueNames(2)[0];
-
-    NewTableConfiguration ntc = new NewTableConfiguration();
-    ntc.attachIterator(new IteratorSetting(10, "anIterator", "it.class", Collections.emptyMap()),
-        EnumSet.of(IteratorScope.scan));
-    client.tableOperations().create(tableName, ntc);
-
-    Map<String,EnumSet<IteratorScope>> iteratorList = client.tableOperations()
-        .listIterators(tableName);
-    // should count the created iterator plus the default iterator
-    assertEquals(2, iteratorList.size());
-    verifyIterators(client, tableName, new String[] {"table.iterator.scan.anIterator=10,it.class"},
-        true);
-    client.tableOperations().removeIterator(tableName, "anIterator",
-        EnumSet.of(IteratorScope.scan));
-    verifyIterators(client, tableName, new String[] {}, true);
-    iteratorList = client.tableOperations().listIterators(tableName);
-    assertEquals(1, iteratorList.size());
+    try (AccumuloClient client = getClient()) {
+      String tableName = getUniqueNames(2)[0];
+
+      NewTableConfiguration ntc = new NewTableConfiguration();
+      ntc.attachIterator(new IteratorSetting(10, "anIterator", "it.class", Collections.emptyMap()),
+          EnumSet.of(IteratorScope.scan));
+      client.tableOperations().create(tableName, ntc);
+
+      Map<String,EnumSet<IteratorScope>> iteratorList = client.tableOperations()
+          .listIterators(tableName);
+      // should count the created iterator plus the default iterator
+      assertEquals(2, iteratorList.size());
+      verifyIterators(client, tableName,
+          new String[] {"table.iterator.scan.anIterator=10,it.class"}, true);
+      client.tableOperations().removeIterator(tableName, "anIterator",
+          EnumSet.of(IteratorScope.scan));
+      verifyIterators(client, tableName, new String[] {}, true);
+      iteratorList = client.tableOperations().listIterators(tableName);
+      assertEquals(1, iteratorList.size());
+    }
   }
 
   /**
@@ -283,26 +289,27 @@ public void testPreconfigureIteratorWithDefaultIterator1() throws AccumuloExcept
   @Test
   public void testPreconfiguredIteratorWithDefaultIterator2() throws AccumuloException,
       TableNotFoundException, AccumuloSecurityException, TableExistsException {
-    AccumuloClient client = getClient();
-    String tableName = getUniqueNames(2)[0];
-
-    NewTableConfiguration ntc = new NewTableConfiguration();
-    IteratorSetting setting = new IteratorSetting(10, "someName", "foo.bar");
-    ntc.attachIterator(setting);
-    client.tableOperations().create(tableName, ntc);
-
-    Map<String,EnumSet<IteratorScope>> iteratorList = client.tableOperations()
-        .listIterators(tableName);
-    // should count the created iterator plus the default iterator
-    assertEquals(2, iteratorList.size());
-    verifyIterators(client, tableName, new String[] {"table.iterator.scan.someName=10,foo.bar"},
-        true);
-    client.tableOperations().removeIterator(tableName, "someName",
-        EnumSet.allOf((IteratorScope.class)));
-    verifyIterators(client, tableName, new String[] {}, true);
-    Map<String,EnumSet<IteratorScope>> iteratorList2 = client.tableOperations()
-        .listIterators(tableName);
-    assertEquals(1, iteratorList2.size());
+    try (AccumuloClient client = getClient()) {
+      String tableName = getUniqueNames(2)[0];
+
+      NewTableConfiguration ntc = new NewTableConfiguration();
+      IteratorSetting setting = new IteratorSetting(10, "someName", "foo.bar");
+      ntc.attachIterator(setting);
+      client.tableOperations().create(tableName, ntc);
+
+      Map<String,EnumSet<IteratorScope>> iteratorList = client.tableOperations()
+          .listIterators(tableName);
+      // should count the created iterator plus the default iterator
+      assertEquals(2, iteratorList.size());
+      verifyIterators(client, tableName, new String[] {"table.iterator.scan.someName=10,foo.bar"},
+          true);
+      client.tableOperations().removeIterator(tableName, "someName",
+          EnumSet.allOf((IteratorScope.class)));
+      verifyIterators(client, tableName, new String[] {}, true);
+      Map<String,EnumSet<IteratorScope>> iteratorList2 = client.tableOperations()
+          .listIterators(tableName);
+      assertEquals(1, iteratorList2.size());
+    }
   }
 
   /**
@@ -312,24 +319,26 @@ public void testPreconfiguredIteratorWithDefaultIterator2() throws AccumuloExcep
   @Test
   public void testPreconfiguredIteratorWithDefaultIterator3() throws AccumuloException,
       TableNotFoundException, AccumuloSecurityException, TableExistsException {
-    AccumuloClient client = getClient();
-    String tableName = getUniqueNames(2)[0];
-
-    NewTableConfiguration ntc = new NewTableConfiguration();
-    IteratorSetting setting = new IteratorSetting(10, "someName", "foo.bar");
-    ntc.attachIterator(setting, EnumSet.of(IteratorScope.scan));
-    client.tableOperations().create(tableName, ntc);
-
-    verifyIterators(client, tableName, new String[] {"table.iterator.scan.someName=10,foo.bar"},
-        true);
-    Map<String,EnumSet<IteratorScope>> iteratorList = client.tableOperations()
-        .listIterators(tableName);
-    assertEquals(2, iteratorList.size());
-    assertEquals(iteratorList.get("someName"), EnumSet.of(IteratorScope.scan));
-    client.tableOperations().removeIterator(tableName, "someName", EnumSet.of(IteratorScope.scan));
-    verifyIterators(client, tableName, new String[] {}, true);
-    iteratorList = client.tableOperations().listIterators(tableName);
-    assertEquals(1, iteratorList.size());
+    try (AccumuloClient client = getClient()) {
+      String tableName = getUniqueNames(2)[0];
+
+      NewTableConfiguration ntc = new NewTableConfiguration();
+      IteratorSetting setting = new IteratorSetting(10, "someName", "foo.bar");
+      ntc.attachIterator(setting, EnumSet.of(IteratorScope.scan));
+      client.tableOperations().create(tableName, ntc);
+
+      verifyIterators(client, tableName, new String[] {"table.iterator.scan.someName=10,foo.bar"},
+          true);
+      Map<String,EnumSet<IteratorScope>> iteratorList = client.tableOperations()
+          .listIterators(tableName);
+      assertEquals(2, iteratorList.size());
+      assertEquals(iteratorList.get("someName"), EnumSet.of(IteratorScope.scan));
+      client.tableOperations().removeIterator(tableName, "someName",
+          EnumSet.of(IteratorScope.scan));
+      verifyIterators(client, tableName, new String[] {}, true);
+      iteratorList = client.tableOperations().listIterators(tableName);
+      assertEquals(1, iteratorList.size());
+    }
   }
 
   /**
@@ -338,19 +347,21 @@ public void testPreconfiguredIteratorWithDefaultIterator3() throws AccumuloExcep
   @Test
   public void testSettingInitialIteratorWithAdditionalIteratorOptions() throws AccumuloException,
       TableNotFoundException, AccumuloSecurityException, TableExistsException {
-    AccumuloClient client = getClient();
-    String tableName = getUniqueNames(2)[0];
-
-    NewTableConfiguration ntc = new NewTableConfiguration();
-    IteratorSetting setting = new IteratorSetting(10, "someName", "foo.bar");
-    setting.addOptions(Collections.singletonMap("key", "value"));
-    ntc.attachIterator(setting);
-
-    client.tableOperations().create(tableName, ntc);
-    verifyIterators(client, tableName, new String[] {"table.iterator.scan.someName=10,foo.bar",
-        "table.iterator.scan.someName.opt.key=value"}, true);
-    client.tableOperations().removeIterator(tableName, "someName", EnumSet.of(IteratorScope.scan));
-    verifyIterators(client, tableName, new String[] {}, true);
+    try (AccumuloClient client = getClient()) {
+      String tableName = getUniqueNames(2)[0];
+
+      NewTableConfiguration ntc = new NewTableConfiguration();
+      IteratorSetting setting = new IteratorSetting(10, "someName", "foo.bar");
+      setting.addOptions(Collections.singletonMap("key", "value"));
+      ntc.attachIterator(setting);
+
+      client.tableOperations().create(tableName, ntc);
+      verifyIterators(client, tableName, new String[] {"table.iterator.scan.someName=10,foo.bar",
+          "table.iterator.scan.someName.opt.key=value"}, true);
+      client.tableOperations().removeIterator(tableName, "someName",
+          EnumSet.of(IteratorScope.scan));
+      verifyIterators(client, tableName, new String[] {}, true);
+    }
   }
 
   /**
@@ -359,25 +370,26 @@ public void testSettingInitialIteratorWithAdditionalIteratorOptions() throws Acc
   @Test
   public void testSetIteratorWithoutDefaultIterators() throws AccumuloException,
       TableNotFoundException, AccumuloSecurityException, TableExistsException {
-    AccumuloClient client = getClient();
-    String tableName = getUniqueNames(2)[0];
-
-    NewTableConfiguration ntc = new NewTableConfiguration().withoutDefaultIterators();
-    IteratorSetting setting = new IteratorSetting(10, "myIterator", "my.class");
-    ntc.attachIterator(setting);
-    client.tableOperations().create(tableName, ntc);
-
-    Map<String,EnumSet<IteratorScope>> iteratorList = client.tableOperations()
-        .listIterators(tableName);
-    assertEquals(1, iteratorList.size());
-    verifyIterators(client, tableName, new String[] {"table.iterator.scan.myIterator=10,my.class"},
-        false);
-    client.tableOperations().removeIterator(tableName, "myIterator",
-        EnumSet.allOf(IteratorScope.class));
-    verifyIterators(client, tableName, new String[] {}, false);
-    Map<String,EnumSet<IteratorScope>> iteratorList2 = client.tableOperations()
-        .listIterators(tableName);
-    assertEquals(0, iteratorList2.size());
+    try (AccumuloClient client = getClient()) {
+      String tableName = getUniqueNames(2)[0];
+
+      NewTableConfiguration ntc = new NewTableConfiguration().withoutDefaultIterators();
+      IteratorSetting setting = new IteratorSetting(10, "myIterator", "my.class");
+      ntc.attachIterator(setting);
+      client.tableOperations().create(tableName, ntc);
+
+      Map<String,EnumSet<IteratorScope>> iteratorList = client.tableOperations()
+          .listIterators(tableName);
+      assertEquals(1, iteratorList.size());
+      verifyIterators(client, tableName,
+          new String[] {"table.iterator.scan.myIterator=10,my.class"}, false);
+      client.tableOperations().removeIterator(tableName, "myIterator",
+          EnumSet.allOf(IteratorScope.class));
+      verifyIterators(client, tableName, new String[] {}, false);
+      Map<String,EnumSet<IteratorScope>> iteratorList2 = client.tableOperations()
+          .listIterators(tableName);
+      assertEquals(0, iteratorList2.size());
+    }
   }
 
   /**
@@ -386,36 +398,38 @@ public void testSetIteratorWithoutDefaultIterators() throws AccumuloException,
   @Test
   public void testSettingIteratorAndProperties() throws AccumuloException, TableNotFoundException,
       AccumuloSecurityException, TableExistsException {
-    AccumuloClient client = getClient();
-    String tableName = getUniqueNames(2)[0];
-
-    NewTableConfiguration ntc = new NewTableConfiguration();
-    IteratorSetting setting = new IteratorSetting(10, "someName", "foo.bar");
-    ntc.attachIterator(setting);
-
-    Map<String,String> props = new HashMap<>();
-    props.put(Property.TABLE_ARBITRARY_PROP_PREFIX.getKey() + "prop1", "val1");
-    props.put(Property.TABLE_ARBITRARY_PROP_PREFIX.getKey() + "prop2", "val2");
-    ntc.setProperties(props);
-
-    client.tableOperations().create(tableName, ntc);
-
-    int count = 0;
-    for (Entry<String,String> property : client.tableOperations().getProperties(tableName)) {
-      if (property.getKey().equals(Property.TABLE_ARBITRARY_PROP_PREFIX.getKey() + "prop1")) {
-        assertEquals(property.getValue(), "val1");
-        count++;
-      }
-      if (property.getKey().equals(Property.TABLE_ARBITRARY_PROP_PREFIX.getKey() + "prop2")) {
-        assertEquals(property.getValue(), "val2");
-        count++;
+    try (AccumuloClient client = getClient()) {
+      String tableName = getUniqueNames(2)[0];
+
+      NewTableConfiguration ntc = new NewTableConfiguration();
+      IteratorSetting setting = new IteratorSetting(10, "someName", "foo.bar");
+      ntc.attachIterator(setting);
+
+      Map<String,String> props = new HashMap<>();
+      props.put(Property.TABLE_ARBITRARY_PROP_PREFIX.getKey() + "prop1", "val1");
+      props.put(Property.TABLE_ARBITRARY_PROP_PREFIX.getKey() + "prop2", "val2");
+      ntc.setProperties(props);
+
+      client.tableOperations().create(tableName, ntc);
+
+      int count = 0;
+      for (Entry<String,String> property : client.tableOperations().getProperties(tableName)) {
+        if (property.getKey().equals(Property.TABLE_ARBITRARY_PROP_PREFIX.getKey() + "prop1")) {
+          assertEquals(property.getValue(), "val1");
+          count++;
+        }
+        if (property.getKey().equals(Property.TABLE_ARBITRARY_PROP_PREFIX.getKey() + "prop2")) {
+          assertEquals(property.getValue(), "val2");
+          count++;
+        }
       }
+      assertEquals(2, count);
+      verifyIterators(client, tableName, new String[] {"table.iterator.scan.someName=10,foo.bar"},
+          true);
+      client.tableOperations().removeIterator(tableName, "someName",
+          EnumSet.of(IteratorScope.scan));
+      verifyIterators(client, tableName, new String[] {}, true);
     }
-    assertEquals(2, count);
-    verifyIterators(client, tableName, new String[] {"table.iterator.scan.someName=10,foo.bar"},
-        true);
-    client.tableOperations().removeIterator(tableName, "someName", EnumSet.of(IteratorScope.scan));
-    verifyIterators(client, tableName, new String[] {}, true);
   }
 
   /**
@@ -424,43 +438,46 @@ public void testSettingIteratorAndProperties() throws AccumuloException, TableNo
   @Test(expected = IllegalArgumentException.class)
   public void testIteratorConflictFound1() throws AccumuloException, TableNotFoundException,
       AccumuloSecurityException, TableExistsException {
-    AccumuloClient client = getClient();
-    String tableName = getUniqueNames(2)[0];
-
-    NewTableConfiguration ntc = new NewTableConfiguration();
-    IteratorSetting setting = new IteratorSetting(10, "someName", "foo.bar");
-    ntc.attachIterator(setting, EnumSet.of(IteratorScope.scan));
-    setting = new IteratorSetting(12, "someName", "foo2.bar");
-    ntc.attachIterator(setting, EnumSet.of(IteratorScope.scan));
-    client.tableOperations().create(tableName, ntc);
+    try (AccumuloClient client = getClient()) {
+      String tableName = getUniqueNames(2)[0];
+
+      NewTableConfiguration ntc = new NewTableConfiguration();
+      IteratorSetting setting = new IteratorSetting(10, "someName", "foo.bar");
+      ntc.attachIterator(setting, EnumSet.of(IteratorScope.scan));
+      setting = new IteratorSetting(12, "someName", "foo2.bar");
+      ntc.attachIterator(setting, EnumSet.of(IteratorScope.scan));
+      client.tableOperations().create(tableName, ntc);
+    }
   }
 
   @Test(expected = IllegalArgumentException.class)
   public void testIteratorConflictFound2() throws AccumuloException, TableNotFoundException,
       AccumuloSecurityException, TableExistsException {
-    AccumuloClient client = getClient();
-    String tableName = getUniqueNames(2)[0];
-
-    NewTableConfiguration ntc = new NewTableConfiguration();
-    IteratorSetting setting = new IteratorSetting(10, "someName", "foo.bar");
-    ntc.attachIterator(setting, EnumSet.of(IteratorScope.scan));
-    setting = new IteratorSetting(10, "anotherName", "foo2.bar");
-    ntc.attachIterator(setting, EnumSet.of(IteratorScope.scan));
-    client.tableOperations().create(tableName, ntc);
+    try (AccumuloClient client = getClient()) {
+      String tableName = getUniqueNames(2)[0];
+
+      NewTableConfiguration ntc = new NewTableConfiguration();
+      IteratorSetting setting = new IteratorSetting(10, "someName", "foo.bar");
+      ntc.attachIterator(setting, EnumSet.of(IteratorScope.scan));
+      setting = new IteratorSetting(10, "anotherName", "foo2.bar");
+      ntc.attachIterator(setting, EnumSet.of(IteratorScope.scan));
+      client.tableOperations().create(tableName, ntc);
+    }
   }
 
   @Test(expected = IllegalArgumentException.class)
   public void testIteratorConflictFound3() throws AccumuloException, TableNotFoundException,
       AccumuloSecurityException, TableExistsException {
-    AccumuloClient client = getClient();
-    String tableName = getUniqueNames(2)[0];
-
-    NewTableConfiguration ntc = new NewTableConfiguration();
-    IteratorSetting setting = new IteratorSetting(10, "someName", "foo.bar");
-    ntc.attachIterator(setting, EnumSet.of(IteratorScope.scan));
-    setting = new IteratorSetting(12, "someName", "foo.bar");
-    ntc.attachIterator(setting, EnumSet.of(IteratorScope.scan));
-    client.tableOperations().create(tableName, ntc);
+    try (AccumuloClient client = getClient()) {
+      String tableName = getUniqueNames(2)[0];
+
+      NewTableConfiguration ntc = new NewTableConfiguration();
+      IteratorSetting setting = new IteratorSetting(10, "someName", "foo.bar");
+      ntc.attachIterator(setting, EnumSet.of(IteratorScope.scan));
+      setting = new IteratorSetting(12, "someName", "foo.bar");
+      ntc.attachIterator(setting, EnumSet.of(IteratorScope.scan));
+      client.tableOperations().create(tableName, ntc);
+    }
   }
 
   /**
@@ -470,27 +487,28 @@ public void testIteratorConflictFound3() throws AccumuloException, TableNotFound
   @Test
   public void testMultipleIteratorValid() throws AccumuloException, TableNotFoundException,
       AccumuloSecurityException, TableExistsException {
-    AccumuloClient client = getClient();
-    String tableName = getUniqueNames(2)[0];
-
-    NewTableConfiguration ntc = new NewTableConfiguration();
-    IteratorSetting setting = new IteratorSetting(10, "firstIterator", "first.class");
-    ntc.attachIterator(setting, EnumSet.of(IteratorScope.scan));
-    setting = new IteratorSetting(11, "secondIterator", "second.class");
-    ntc.attachIterator(setting, EnumSet.of(IteratorScope.scan));
-
-    client.tableOperations().create(tableName, ntc);
-    verifyIterators(client, tableName,
-        new String[] {"table.iterator.scan.firstIterator=10,first.class",
-            "table.iterator.scan.secondIterator=11,second.class"},
-        true);
-    client.tableOperations().removeIterator(tableName, "firstIterator",
-        EnumSet.of(IteratorScope.scan));
-    verifyIterators(client, tableName,
-        new String[] {"table.iterator.scan.secondIterator=11,second.class"}, true);
-    client.tableOperations().removeIterator(tableName, "secondIterator",
-        EnumSet.of(IteratorScope.scan));
-    verifyIterators(client, tableName, new String[] {}, true);
+    try (AccumuloClient client = getClient()) {
+      String tableName = getUniqueNames(2)[0];
+
+      NewTableConfiguration ntc = new NewTableConfiguration();
+      IteratorSetting setting = new IteratorSetting(10, "firstIterator", "first.class");
+      ntc.attachIterator(setting, EnumSet.of(IteratorScope.scan));
+      setting = new IteratorSetting(11, "secondIterator", "second.class");
+      ntc.attachIterator(setting, EnumSet.of(IteratorScope.scan));
+
+      client.tableOperations().create(tableName, ntc);
+      verifyIterators(client, tableName,
+          new String[] {"table.iterator.scan.firstIterator=10,first.class",
+              "table.iterator.scan.secondIterator=11,second.class"},
+          true);
+      client.tableOperations().removeIterator(tableName, "firstIterator",
+          EnumSet.of(IteratorScope.scan));
+      verifyIterators(client, tableName,
+          new String[] {"table.iterator.scan.secondIterator=11,second.class"}, true);
+      client.tableOperations().removeIterator(tableName, "secondIterator",
+          EnumSet.of(IteratorScope.scan));
+      verifyIterators(client, tableName, new String[] {}, true);
+    }
   }
 
   /**
@@ -499,38 +517,40 @@ public void testMultipleIteratorValid() throws AccumuloException, TableNotFoundE
   @Test
   public void testGroupsIteratorAndPropsTogether() throws AccumuloException, TableNotFoundException,
       AccumuloSecurityException, TableExistsException {
-    AccumuloClient client = getClient();
-    String tableName = getUniqueNames(2)[0];
-
-    NewTableConfiguration ntc = new NewTableConfiguration();
-    IteratorSetting setting = new IteratorSetting(10, "someName", "foo.bar");
-    ntc.attachIterator(setting, EnumSet.of(IteratorScope.scan));
-    Map<String,String> props = new HashMap<>();
-    props.put(Property.TABLE_ARBITRARY_PROP_PREFIX.getKey() + "prop1", "val1");
-    ntc.setProperties(props);
-    Map<String,Set<Text>> lgroups = new HashMap<>();
-    lgroups.put("lg1", ImmutableSet.of(new Text("colF")));
-    ntc.setLocalityGroups(lgroups);
-    client.tableOperations().create(tableName, ntc);
-    // verify user table properties
-    int count = 0;
-    for (Entry<String,String> property : client.tableOperations().getProperties(tableName)) {
-      if (property.getKey().equals(Property.TABLE_ARBITRARY_PROP_PREFIX.getKey() + "prop1")) {
-        assertEquals(property.getValue(), "val1");
-        count++;
+    try (AccumuloClient client = getClient()) {
+      String tableName = getUniqueNames(2)[0];
+
+      NewTableConfiguration ntc = new NewTableConfiguration();
+      IteratorSetting setting = new IteratorSetting(10, "someName", "foo.bar");
+      ntc.attachIterator(setting, EnumSet.of(IteratorScope.scan));
+      Map<String,String> props = new HashMap<>();
+      props.put(Property.TABLE_ARBITRARY_PROP_PREFIX.getKey() + "prop1", "val1");
+      ntc.setProperties(props);
+      Map<String,Set<Text>> lgroups = new HashMap<>();
+      lgroups.put("lg1", ImmutableSet.of(new Text("colF")));
+      ntc.setLocalityGroups(lgroups);
+      client.tableOperations().create(tableName, ntc);
+      // verify user table properties
+      int count = 0;
+      for (Entry<String,String> property : client.tableOperations().getProperties(tableName)) {
+        if (property.getKey().equals(Property.TABLE_ARBITRARY_PROP_PREFIX.getKey() + "prop1")) {
+          assertEquals(property.getValue(), "val1");
+          count++;
+        }
       }
+      assertEquals(1, count);
+      // verify locality groups
+      Map<String,Set<Text>> createdLocalityGroups = client.tableOperations()
+          .getLocalityGroups(tableName);
+      assertEquals(1, createdLocalityGroups.size());
+      assertEquals(createdLocalityGroups.get("lg1"), ImmutableSet.of(new Text("colF")));
+      // verify iterators
+      verifyIterators(client, tableName, new String[] {"table.iterator.scan.someName=10,foo.bar"},
+          true);
+      client.tableOperations().removeIterator(tableName, "someName",
+          EnumSet.of(IteratorScope.scan));
+      verifyIterators(client, tableName, new String[] {}, true);
     }
-    assertEquals(1, count);
-    // verify locality groups
-    Map<String,Set<Text>> createdLocalityGroups = client.tableOperations()
-        .getLocalityGroups(tableName);
-    assertEquals(1, createdLocalityGroups.size());
-    assertEquals(createdLocalityGroups.get("lg1"), ImmutableSet.of(new Text("colF")));
-    // verify iterators
-    verifyIterators(client, tableName, new String[] {"table.iterator.scan.someName=10,foo.bar"},
-        true);
-    client.tableOperations().removeIterator(tableName, "someName", EnumSet.of(IteratorScope.scan));
-    verifyIterators(client, tableName, new String[] {}, true);
   }
 
   /**
@@ -539,46 +559,47 @@ public void testGroupsIteratorAndPropsTogether() throws AccumuloException, Table
   @Test
   public void testNtcChaining() throws AccumuloException, AccumuloSecurityException,
       TableExistsException, TableNotFoundException {
-    AccumuloClient client = getClient();
-    String tableName = getUniqueNames(2)[0];
-
-    IteratorSetting setting = new IteratorSetting(10, "anIterator", "it.class",
-        Collections.emptyMap());
-    Map<String,Set<Text>> lgroups = new HashMap<>();
-    lgroups.put("lgp", ImmutableSet.of(new Text("col")));
-
-    NewTableConfiguration ntc = new NewTableConfiguration().withoutDefaultIterators()
-        .attachIterator(setting, EnumSet.of(IteratorScope.scan)).setLocalityGroups(lgroups);
-
-    client.tableOperations().create(tableName, ntc);
-
-    Map<String,EnumSet<IteratorScope>> iteratorList = client.tableOperations()
-        .listIterators(tableName);
-    assertEquals(1, iteratorList.size());
-    verifyIterators(client, tableName, new String[] {"table.iterator.scan.anIterator=10,it.class"},
-        false);
-    client.tableOperations().removeIterator(tableName, "anIterator",
-        EnumSet.of(IteratorScope.scan));
-    verifyIterators(client, tableName, new String[] {}, false);
-    iteratorList = client.tableOperations().listIterators(tableName);
-    assertEquals(0, iteratorList.size());
-
-    int count = 0;
-    for (Entry<String,String> property : client.tableOperations().getProperties(tableName)) {
-      if (property.getKey().equals("table.group.lgp")) {
-        assertEquals(property.getValue(), "col");
-        count++;
-      }
-      if (property.getKey().equals("table.groups.enabled")) {
-        assertEquals(property.getValue(), "lgp");
-        count++;
+    try (AccumuloClient client = getClient()) {
+      String tableName = getUniqueNames(2)[0];
+
+      IteratorSetting setting = new IteratorSetting(10, "anIterator", "it.class",
+          Collections.emptyMap());
+      Map<String,Set<Text>> lgroups = new HashMap<>();
+      lgroups.put("lgp", ImmutableSet.of(new Text("col")));
+
+      NewTableConfiguration ntc = new NewTableConfiguration().withoutDefaultIterators()
+          .attachIterator(setting, EnumSet.of(IteratorScope.scan)).setLocalityGroups(lgroups);
+
+      client.tableOperations().create(tableName, ntc);
+
+      Map<String,EnumSet<IteratorScope>> iteratorList = client.tableOperations()
+          .listIterators(tableName);
+      assertEquals(1, iteratorList.size());
+      verifyIterators(client, tableName,
+          new String[] {"table.iterator.scan.anIterator=10,it.class"}, false);
+      client.tableOperations().removeIterator(tableName, "anIterator",
+          EnumSet.of(IteratorScope.scan));
+      verifyIterators(client, tableName, new String[] {}, false);
+      iteratorList = client.tableOperations().listIterators(tableName);
+      assertEquals(0, iteratorList.size());
+
+      int count = 0;
+      for (Entry<String,String> property : client.tableOperations().getProperties(tableName)) {
+        if (property.getKey().equals("table.group.lgp")) {
+          assertEquals(property.getValue(), "col");
+          count++;
+        }
+        if (property.getKey().equals("table.groups.enabled")) {
+          assertEquals(property.getValue(), "lgp");
+          count++;
+        }
       }
+      assertEquals(2, count);
+      Map<String,Set<Text>> createdLocalityGroups = client.tableOperations()
+          .getLocalityGroups(tableName);
+      assertEquals(1, createdLocalityGroups.size());
+      assertEquals(createdLocalityGroups.get("lgp"), ImmutableSet.of(new Text("col")));
     }
-    assertEquals(2, count);
-    Map<String,Set<Text>> createdLocalityGroups = client.tableOperations()
-        .getLocalityGroups(tableName);
-    assertEquals(1, createdLocalityGroups.size());
-    assertEquals(createdLocalityGroups.get("lgp"), ImmutableSet.of(new Text("col")));
   }
 
   /**
diff --git a/test/src/main/java/org/apache/accumulo/test/OrIteratorIT.java b/test/src/main/java/org/apache/accumulo/test/OrIteratorIT.java
index dc8140d9aa..1e9ce63fde 100644
--- a/test/src/main/java/org/apache/accumulo/test/OrIteratorIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/OrIteratorIT.java
@@ -59,266 +59,272 @@ public int defaultTimeoutSeconds() {
 
   @Test
   public void testMultipleRowsInTablet() throws Exception {
-    final AccumuloClient client = getAccumuloClient();
-    final String tableName = getUniqueNames(1)[0];
-    client.tableOperations().create(tableName);
-
-    try (BatchWriter bw = client.createBatchWriter(tableName, new BatchWriterConfig())) {
-      Mutation m = new Mutation("row1");
-      m.put("bob", "2", EMPTY);
-      m.put("frank", "3", EMPTY);
-      m.put("steve", "1", EMPTY);
-      bw.addMutation(m);
-
-      m = new Mutation("row2");
-      m.put("bob", "7", EMPTY);
-      m.put("eddie", "4", EMPTY);
-      m.put("mort", "6", EMPTY);
-      m.put("zed", "5", EMPTY);
-      bw.addMutation(m);
-    }
+    try (AccumuloClient client = getAccumuloClient()) {
+      final String tableName = getUniqueNames(1)[0];
+      client.tableOperations().create(tableName);
+
+      try (BatchWriter bw = client.createBatchWriter(tableName, new BatchWriterConfig())) {
+        Mutation m = new Mutation("row1");
+        m.put("bob", "2", EMPTY);
+        m.put("frank", "3", EMPTY);
+        m.put("steve", "1", EMPTY);
+        bw.addMutation(m);
+
+        m = new Mutation("row2");
+        m.put("bob", "7", EMPTY);
+        m.put("eddie", "4", EMPTY);
+        m.put("mort", "6", EMPTY);
+        m.put("zed", "5", EMPTY);
+        bw.addMutation(m);
+      }
 
-    IteratorSetting is = new IteratorSetting(50, OrIterator.class);
-    is.addOption(OrIterator.COLUMNS_KEY, "mort,frank");
-    Map<String,String> expectedData = new HashMap<>();
-    expectedData.put("frank", "3");
-    expectedData.put("mort", "6");
-
-    try (BatchScanner bs = client.createBatchScanner(tableName, Authorizations.EMPTY, 1)) {
-      Set<Range> ranges = new HashSet<>(Arrays.asList(Range.exact("row1"), Range.exact("row2")));
-      bs.setRanges(ranges);
-      bs.addScanIterator(is);
-      for (Entry<Key,Value> entry : bs) {
-        String term = entry.getKey().getColumnFamily().toString();
-        String expectedDocId = expectedData.remove(term);
-        assertNotNull("Found unexpected term: " + term, expectedDocId);
-        assertEquals(expectedDocId, entry.getKey().getColumnQualifier().toString());
+      IteratorSetting is = new IteratorSetting(50, OrIterator.class);
+      is.addOption(OrIterator.COLUMNS_KEY, "mort,frank");
+      Map<String,String> expectedData = new HashMap<>();
+      expectedData.put("frank", "3");
+      expectedData.put("mort", "6");
+
+      try (BatchScanner bs = client.createBatchScanner(tableName, Authorizations.EMPTY, 1)) {
+        Set<Range> ranges = new HashSet<>(Arrays.asList(Range.exact("row1"), Range.exact("row2")));
+        bs.setRanges(ranges);
+        bs.addScanIterator(is);
+        for (Entry<Key,Value> entry : bs) {
+          String term = entry.getKey().getColumnFamily().toString();
+          String expectedDocId = expectedData.remove(term);
+          assertNotNull("Found unexpected term: " + term, expectedDocId);
+          assertEquals(expectedDocId, entry.getKey().getColumnQualifier().toString());
+        }
+        assertTrue("Expected no leftover entries but saw " + expectedData, expectedData.isEmpty());
       }
-      assertTrue("Expected no leftover entries but saw " + expectedData, expectedData.isEmpty());
     }
   }
 
   @Test
   public void testMultipleTablets() throws Exception {
-    final AccumuloClient client = getAccumuloClient();
-    final String tableName = getUniqueNames(1)[0];
-    client.tableOperations().create(tableName);
-
-    try (BatchWriter bw = client.createBatchWriter(tableName, new BatchWriterConfig())) {
-      Mutation m = new Mutation("row1");
-      m.put("bob", "2", EMPTY);
-      m.put("frank", "3", EMPTY);
-      m.put("steve", "1", EMPTY);
-      bw.addMutation(m);
-
-      m = new Mutation("row2");
-      m.put("bob", "7", EMPTY);
-      m.put("eddie", "4", EMPTY);
-      m.put("mort", "6", EMPTY);
-      m.put("zed", "5", EMPTY);
-      bw.addMutation(m);
-
-      m = new Mutation("row3");
-      m.put("carl", "9", EMPTY);
-      m.put("george", "8", EMPTY);
-      m.put("nick", "3", EMPTY);
-      m.put("zed", "1", EMPTY);
-      bw.addMutation(m);
-    }
+    try (AccumuloClient client = getAccumuloClient()) {
+      final String tableName = getUniqueNames(1)[0];
+      client.tableOperations().create(tableName);
+
+      try (BatchWriter bw = client.createBatchWriter(tableName, new BatchWriterConfig())) {
+        Mutation m = new Mutation("row1");
+        m.put("bob", "2", EMPTY);
+        m.put("frank", "3", EMPTY);
+        m.put("steve", "1", EMPTY);
+        bw.addMutation(m);
+
+        m = new Mutation("row2");
+        m.put("bob", "7", EMPTY);
+        m.put("eddie", "4", EMPTY);
+        m.put("mort", "6", EMPTY);
+        m.put("zed", "5", EMPTY);
+        bw.addMutation(m);
+
+        m = new Mutation("row3");
+        m.put("carl", "9", EMPTY);
+        m.put("george", "8", EMPTY);
+        m.put("nick", "3", EMPTY);
+        m.put("zed", "1", EMPTY);
+        bw.addMutation(m);
+      }
 
-    client.tableOperations().addSplits(tableName,
-        new TreeSet<>(Arrays.asList(new Text("row2"), new Text("row3"))));
-
-    IteratorSetting is = new IteratorSetting(50, OrIterator.class);
-    is.addOption(OrIterator.COLUMNS_KEY, "mort,frank,nick");
-    Map<String,String> expectedData = new HashMap<>();
-    expectedData.put("frank", "3");
-    expectedData.put("mort", "6");
-    expectedData.put("nick", "3");
-
-    try (BatchScanner bs = client.createBatchScanner(tableName, Authorizations.EMPTY, 1)) {
-      bs.setRanges(Collections.singleton(new Range()));
-      bs.addScanIterator(is);
-      for (Entry<Key,Value> entry : bs) {
-        String term = entry.getKey().getColumnFamily().toString();
-        String expectedDocId = expectedData.remove(term);
-        assertNotNull("Found unexpected term: " + term, expectedDocId);
-        assertEquals(expectedDocId, entry.getKey().getColumnQualifier().toString());
+      client.tableOperations().addSplits(tableName,
+          new TreeSet<>(Arrays.asList(new Text("row2"), new Text("row3"))));
+
+      IteratorSetting is = new IteratorSetting(50, OrIterator.class);
+      is.addOption(OrIterator.COLUMNS_KEY, "mort,frank,nick");
+      Map<String,String> expectedData = new HashMap<>();
+      expectedData.put("frank", "3");
+      expectedData.put("mort", "6");
+      expectedData.put("nick", "3");
+
+      try (BatchScanner bs = client.createBatchScanner(tableName, Authorizations.EMPTY, 1)) {
+        bs.setRanges(Collections.singleton(new Range()));
+        bs.addScanIterator(is);
+        for (Entry<Key,Value> entry : bs) {
+          String term = entry.getKey().getColumnFamily().toString();
+          String expectedDocId = expectedData.remove(term);
+          assertNotNull("Found unexpected term: " + term, expectedDocId);
+          assertEquals(expectedDocId, entry.getKey().getColumnQualifier().toString());
+        }
+        assertTrue("Expected no leftover entries but saw " + expectedData, expectedData.isEmpty());
       }
-      assertTrue("Expected no leftover entries but saw " + expectedData, expectedData.isEmpty());
     }
   }
 
   @Test
   public void testSingleLargeRow() throws Exception {
-    final AccumuloClient client = getAccumuloClient();
-    final String tableName = getUniqueNames(1)[0];
-    client.tableOperations().create(tableName);
-    client.tableOperations().setProperty(tableName, Property.TABLE_SCAN_MAXMEM.getKey(), "1");
-
-    try (BatchWriter bw = client.createBatchWriter(tableName, new BatchWriterConfig())) {
-      Mutation m = new Mutation("row1");
-      m.put("bob", "02", EMPTY);
-      m.put("carl", "07", EMPTY);
-      m.put("eddie", "04", EMPTY);
-      m.put("frank", "03", EMPTY);
-      m.put("greg", "15", EMPTY);
-      m.put("mort", "06", EMPTY);
-      m.put("nick", "12", EMPTY);
-      m.put("richard", "18", EMPTY);
-      m.put("steve", "01", EMPTY);
-      m.put("ted", "11", EMPTY);
-      m.put("zed", "05", EMPTY);
-      bw.addMutation(m);
-    }
+    try (AccumuloClient client = getAccumuloClient()) {
+      final String tableName = getUniqueNames(1)[0];
+      client.tableOperations().create(tableName);
+      client.tableOperations().setProperty(tableName, Property.TABLE_SCAN_MAXMEM.getKey(), "1");
+
+      try (BatchWriter bw = client.createBatchWriter(tableName, new BatchWriterConfig())) {
+        Mutation m = new Mutation("row1");
+        m.put("bob", "02", EMPTY);
+        m.put("carl", "07", EMPTY);
+        m.put("eddie", "04", EMPTY);
+        m.put("frank", "03", EMPTY);
+        m.put("greg", "15", EMPTY);
+        m.put("mort", "06", EMPTY);
+        m.put("nick", "12", EMPTY);
+        m.put("richard", "18", EMPTY);
+        m.put("steve", "01", EMPTY);
+        m.put("ted", "11", EMPTY);
+        m.put("zed", "05", EMPTY);
+        bw.addMutation(m);
+      }
 
-    IteratorSetting is = new IteratorSetting(50, OrIterator.class);
-    is.addOption(OrIterator.COLUMNS_KEY, "richard,carl,frank,nick,eddie,zed");
-    Map<String,String> expectedData = new HashMap<>();
-    expectedData.put("frank", "03");
-    expectedData.put("eddie", "04");
-    expectedData.put("zed", "05");
-    expectedData.put("carl", "07");
-    expectedData.put("nick", "12");
-    expectedData.put("richard", "18");
-
-    try (BatchScanner bs = client.createBatchScanner(tableName, Authorizations.EMPTY, 1)) {
-      bs.setRanges(Collections.singleton(new Range()));
-      bs.addScanIterator(is);
-      for (Entry<Key,Value> entry : bs) {
-        String term = entry.getKey().getColumnFamily().toString();
-        String expectedDocId = expectedData.remove(term);
-        assertNotNull("Found unexpected term: " + term + " or the docId was unexpectedly null",
-            expectedDocId);
-        assertEquals(expectedDocId, entry.getKey().getColumnQualifier().toString());
+      IteratorSetting is = new IteratorSetting(50, OrIterator.class);
+      is.addOption(OrIterator.COLUMNS_KEY, "richard,carl,frank,nick,eddie,zed");
+      Map<String,String> expectedData = new HashMap<>();
+      expectedData.put("frank", "03");
+      expectedData.put("eddie", "04");
+      expectedData.put("zed", "05");
+      expectedData.put("carl", "07");
+      expectedData.put("nick", "12");
+      expectedData.put("richard", "18");
+
+      try (BatchScanner bs = client.createBatchScanner(tableName, Authorizations.EMPTY, 1)) {
+        bs.setRanges(Collections.singleton(new Range()));
+        bs.addScanIterator(is);
+        for (Entry<Key,Value> entry : bs) {
+          String term = entry.getKey().getColumnFamily().toString();
+          String expectedDocId = expectedData.remove(term);
+          assertNotNull("Found unexpected term: " + term + " or the docId was unexpectedly null",
+              expectedDocId);
+          assertEquals(expectedDocId, entry.getKey().getColumnQualifier().toString());
+        }
+        assertTrue("Expected no leftover entries but saw " + expectedData, expectedData.isEmpty());
       }
-      assertTrue("Expected no leftover entries but saw " + expectedData, expectedData.isEmpty());
     }
   }
 
   @Test
   public void testNoMatchesForTable() throws Exception {
-    final AccumuloClient client = getAccumuloClient();
-    final String tableName = getUniqueNames(1)[0];
-    client.tableOperations().create(tableName);
-
-    try (BatchWriter bw = client.createBatchWriter(tableName, new BatchWriterConfig())) {
-      Mutation m = new Mutation("row1");
-      m.put("bob", "02", EMPTY);
-      m.put("carl", "07", EMPTY);
-      m.put("eddie", "04", EMPTY);
-      m.put("frank", "03", EMPTY);
-      m.put("greg", "15", EMPTY);
-      m.put("mort", "06", EMPTY);
-      m.put("nick", "12", EMPTY);
-      m.put("richard", "18", EMPTY);
-      m.put("steve", "01", EMPTY);
-      m.put("ted", "11", EMPTY);
-      m.put("zed", "05", EMPTY);
-      bw.addMutation(m);
-    }
+    try (AccumuloClient client = getAccumuloClient()) {
+      final String tableName = getUniqueNames(1)[0];
+      client.tableOperations().create(tableName);
+
+      try (BatchWriter bw = client.createBatchWriter(tableName, new BatchWriterConfig())) {
+        Mutation m = new Mutation("row1");
+        m.put("bob", "02", EMPTY);
+        m.put("carl", "07", EMPTY);
+        m.put("eddie", "04", EMPTY);
+        m.put("frank", "03", EMPTY);
+        m.put("greg", "15", EMPTY);
+        m.put("mort", "06", EMPTY);
+        m.put("nick", "12", EMPTY);
+        m.put("richard", "18", EMPTY);
+        m.put("steve", "01", EMPTY);
+        m.put("ted", "11", EMPTY);
+        m.put("zed", "05", EMPTY);
+        bw.addMutation(m);
+      }
 
-    IteratorSetting is = new IteratorSetting(50, OrIterator.class);
-    is.addOption(OrIterator.COLUMNS_KEY, "theresa,sally");
-    Map<String,String> expectedData = Collections.emptyMap();
-
-    try (BatchScanner bs = client.createBatchScanner(tableName, Authorizations.EMPTY, 1)) {
-      bs.setRanges(Collections.singleton(new Range()));
-      bs.addScanIterator(is);
-      for (Entry<Key,Value> entry : bs) {
-        String term = entry.getKey().getColumnFamily().toString();
-        String expectedDocId = expectedData.remove(term);
-        assertNotNull("Found unexpected term: " + term + " or the docId was unexpectedly null",
-            expectedDocId);
-        assertEquals(expectedDocId, entry.getKey().getColumnQualifier().toString());
+      IteratorSetting is = new IteratorSetting(50, OrIterator.class);
+      is.addOption(OrIterator.COLUMNS_KEY, "theresa,sally");
+      Map<String,String> expectedData = Collections.emptyMap();
+
+      try (BatchScanner bs = client.createBatchScanner(tableName, Authorizations.EMPTY, 1)) {
+        bs.setRanges(Collections.singleton(new Range()));
+        bs.addScanIterator(is);
+        for (Entry<Key,Value> entry : bs) {
+          String term = entry.getKey().getColumnFamily().toString();
+          String expectedDocId = expectedData.remove(term);
+          assertNotNull("Found unexpected term: " + term + " or the docId was unexpectedly null",
+              expectedDocId);
+          assertEquals(expectedDocId, entry.getKey().getColumnQualifier().toString());
+        }
+        assertTrue("Expected no leftover entries but saw " + expectedData, expectedData.isEmpty());
       }
-      assertTrue("Expected no leftover entries but saw " + expectedData, expectedData.isEmpty());
     }
   }
 
   @Test
   public void testNoMatchesInSingleTablet() throws Exception {
-    final AccumuloClient client = getAccumuloClient();
-    final String tableName = getUniqueNames(1)[0];
-    client.tableOperations().create(tableName);
-
-    try (BatchWriter bw = client.createBatchWriter(tableName, new BatchWriterConfig())) {
-      Mutation m = new Mutation("row1");
-      m.put("bob", "02", EMPTY);
-      m.put("carl", "07", EMPTY);
-      m.put("eddie", "04", EMPTY);
-      bw.addMutation(m);
-
-      m = new Mutation("row2");
-      m.put("frank", "03", EMPTY);
-      m.put("greg", "15", EMPTY);
-      m.put("mort", "06", EMPTY);
-      m.put("nick", "12", EMPTY);
-      bw.addMutation(m);
-
-      m = new Mutation("row3");
-      m.put("richard", "18", EMPTY);
-      m.put("steve", "01", EMPTY);
-      m.put("ted", "11", EMPTY);
-      m.put("zed", "05", EMPTY);
-      bw.addMutation(m);
-    }
+    try (AccumuloClient client = getAccumuloClient()) {
+      final String tableName = getUniqueNames(1)[0];
+      client.tableOperations().create(tableName);
+
+      try (BatchWriter bw = client.createBatchWriter(tableName, new BatchWriterConfig())) {
+        Mutation m = new Mutation("row1");
+        m.put("bob", "02", EMPTY);
+        m.put("carl", "07", EMPTY);
+        m.put("eddie", "04", EMPTY);
+        bw.addMutation(m);
+
+        m = new Mutation("row2");
+        m.put("frank", "03", EMPTY);
+        m.put("greg", "15", EMPTY);
+        m.put("mort", "06", EMPTY);
+        m.put("nick", "12", EMPTY);
+        bw.addMutation(m);
+
+        m = new Mutation("row3");
+        m.put("richard", "18", EMPTY);
+        m.put("steve", "01", EMPTY);
+        m.put("ted", "11", EMPTY);
+        m.put("zed", "05", EMPTY);
+        bw.addMutation(m);
+      }
 
-    IteratorSetting is = new IteratorSetting(50, OrIterator.class);
-    is.addOption(OrIterator.COLUMNS_KEY, "bob,eddie,steve,zed");
-    Map<String,String> expectedData = new HashMap<>();
-    expectedData.put("bob", "02");
-    expectedData.put("eddie", "04");
-    expectedData.put("zed", "05");
-    expectedData.put("steve", "01");
-
-    // Split each row into its own tablet
-    client.tableOperations().addSplits(tableName,
-        new TreeSet<>(Arrays.asList(new Text("row2"), new Text("row3"))));
-
-    try (BatchScanner bs = client.createBatchScanner(tableName, Authorizations.EMPTY, 1)) {
-      bs.setRanges(Collections.singleton(new Range()));
-      bs.addScanIterator(is);
-      for (Entry<Key,Value> entry : bs) {
-        String term = entry.getKey().getColumnFamily().toString();
-        String expectedDocId = expectedData.remove(term);
-        assertNotNull("Found unexpected term: " + term + " or the docId was unexpectedly null",
-            expectedDocId);
-        assertEquals(expectedDocId, entry.getKey().getColumnQualifier().toString());
+      IteratorSetting is = new IteratorSetting(50, OrIterator.class);
+      is.addOption(OrIterator.COLUMNS_KEY, "bob,eddie,steve,zed");
+      Map<String,String> expectedData = new HashMap<>();
+      expectedData.put("bob", "02");
+      expectedData.put("eddie", "04");
+      expectedData.put("zed", "05");
+      expectedData.put("steve", "01");
+
+      // Split each row into its own tablet
+      client.tableOperations().addSplits(tableName,
+          new TreeSet<>(Arrays.asList(new Text("row2"), new Text("row3"))));
+
+      try (BatchScanner bs = client.createBatchScanner(tableName, Authorizations.EMPTY, 1)) {
+        bs.setRanges(Collections.singleton(new Range()));
+        bs.addScanIterator(is);
+        for (Entry<Key,Value> entry : bs) {
+          String term = entry.getKey().getColumnFamily().toString();
+          String expectedDocId = expectedData.remove(term);
+          assertNotNull("Found unexpected term: " + term + " or the docId was unexpectedly null",
+              expectedDocId);
+          assertEquals(expectedDocId, entry.getKey().getColumnQualifier().toString());
+        }
+        assertTrue("Expected no leftover entries but saw " + expectedData, expectedData.isEmpty());
       }
-      assertTrue("Expected no leftover entries but saw " + expectedData, expectedData.isEmpty());
     }
   }
 
   @Test
   public void testResultOrder() throws Exception {
-    final AccumuloClient client = getAccumuloClient();
-    final String tableName = getUniqueNames(1)[0];
-    client.tableOperations().create(tableName);
-
-    try (BatchWriter bw = client.createBatchWriter(tableName, new BatchWriterConfig())) {
-      Mutation m = new Mutation("row1");
-      m.put("bob", "2", EMPTY);
-      m.put("frank", "3", EMPTY);
-      m.put("steve", "1", EMPTY);
-      bw.addMutation(m);
-    }
+    try (AccumuloClient client = getAccumuloClient()) {
+      final String tableName = getUniqueNames(1)[0];
+      client.tableOperations().create(tableName);
+
+      try (BatchWriter bw = client.createBatchWriter(tableName, new BatchWriterConfig())) {
+        Mutation m = new Mutation("row1");
+        m.put("bob", "2", EMPTY);
+        m.put("frank", "3", EMPTY);
+        m.put("steve", "1", EMPTY);
+        bw.addMutation(m);
+      }
 
-    IteratorSetting is = new IteratorSetting(50, OrIterator.class);
-    is.addOption(OrIterator.COLUMNS_KEY, "bob,steve");
-
-    try (Scanner s = client.createScanner(tableName, Authorizations.EMPTY)) {
-      s.addScanIterator(is);
-      Iterator<Entry<Key,Value>> iter = s.iterator();
-      assertTrue(iter.hasNext());
-      Key k = iter.next().getKey();
-      assertEquals("Actual key was " + k, 0,
-          k.compareTo(new Key("row1", "steve", "1"), PartialKey.ROW_COLFAM_COLQUAL));
-      assertTrue(iter.hasNext());
-      k = iter.next().getKey();
-      assertEquals("Actual key was " + k, 0,
-          k.compareTo(new Key("row1", "bob", "2"), PartialKey.ROW_COLFAM_COLQUAL));
-      assertFalse(iter.hasNext());
+      IteratorSetting is = new IteratorSetting(50, OrIterator.class);
+      is.addOption(OrIterator.COLUMNS_KEY, "bob,steve");
+
+      try (Scanner s = client.createScanner(tableName, Authorizations.EMPTY)) {
+        s.addScanIterator(is);
+        Iterator<Entry<Key,Value>> iter = s.iterator();
+        assertTrue(iter.hasNext());
+        Key k = iter.next().getKey();
+        assertEquals("Actual key was " + k, 0,
+            k.compareTo(new Key("row1", "steve", "1"), PartialKey.ROW_COLFAM_COLQUAL));
+        assertTrue(iter.hasNext());
+        k = iter.next().getKey();
+        assertEquals("Actual key was " + k, 0,
+            k.compareTo(new Key("row1", "bob", "2"), PartialKey.ROW_COLFAM_COLQUAL));
+        assertFalse(iter.hasNext());
+      }
     }
   }
 }
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 077f2852c7..8f08a184b4 100644
--- a/test/src/main/java/org/apache/accumulo/test/RecoveryCompactionsAreFlushesIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/RecoveryCompactionsAreFlushesIT.java
@@ -61,43 +61,43 @@ public void configureMiniCluster(MiniAccumuloConfigImpl cfg, Configuration hadoo
   public void test() throws Exception {
     // create a table
     String tableName = getUniqueNames(1)[0];
-    AccumuloClient c = getAccumuloClient();
-    c.tableOperations().create(tableName);
-    c.tableOperations().setProperty(tableName, Property.TABLE_MAJC_RATIO.getKey(), "100");
-    c.tableOperations().setProperty(tableName, Property.TABLE_FILE_MAX.getKey(), "3");
-    // create 3 flush files
-    BatchWriter bw = c.createBatchWriter(tableName, new BatchWriterConfig());
-    Mutation m = new Mutation("a");
-    m.put("b", "c", new Value("v".getBytes()));
-    for (int i = 0; i < 3; i++) {
+    try (AccumuloClient c = getAccumuloClient()) {
+      c.tableOperations().create(tableName);
+      c.tableOperations().setProperty(tableName, Property.TABLE_MAJC_RATIO.getKey(), "100");
+      c.tableOperations().setProperty(tableName, Property.TABLE_FILE_MAX.getKey(), "3");
+      // create 3 flush files
+      BatchWriter bw = c.createBatchWriter(tableName, new BatchWriterConfig());
+      Mutation m = new Mutation("a");
+      m.put("b", "c", new Value("v".getBytes()));
+      for (int i = 0; i < 3; i++) {
+        bw.addMutation(m);
+        bw.flush();
+        c.tableOperations().flush(tableName, null, null, true);
+      }
+      // create an unsaved mutation
       bw.addMutation(m);
-      bw.flush();
-      c.tableOperations().flush(tableName, null, null, true);
-    }
-    // create an unsaved mutation
-    bw.addMutation(m);
-    bw.close();
+      bw.close();
 
-    ClusterControl control = cluster.getClusterControl();
+      ClusterControl control = cluster.getClusterControl();
 
-    // kill the tablet servers
-    control.stopAllServers(ServerType.TABLET_SERVER);
+      // kill the tablet servers
+      control.stopAllServers(ServerType.TABLET_SERVER);
 
-    // recover
-    control.startAllServers(ServerType.TABLET_SERVER);
+      // recover
+      control.startAllServers(ServerType.TABLET_SERVER);
 
-    // ensure the table is readable
-    Iterators.size(c.createScanner(tableName, Authorizations.EMPTY).iterator());
+      // ensure the table is readable
+      Iterators.size(c.createScanner(tableName, Authorizations.EMPTY).iterator());
 
-    // ensure that the recovery was not a merging minor compaction
-    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("/");
-        assertFalse(parts[parts.length - 1].startsWith("M"));
+      // ensure that the recovery was not a merging minor compaction
+      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("/");
+          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 394a16767e..331c7b273a 100644
--- a/test/src/main/java/org/apache/accumulo/test/RewriteTabletDirectoriesIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/RewriteTabletDirectoriesIT.java
@@ -80,94 +80,95 @@ public void configure(MiniAccumuloConfigImpl cfg, Configuration hadoopCoreSite)
 
   @Test
   public void test() throws Exception {
-    AccumuloClient c = getClient();
-    c.securityOperations().grantTablePermission(c.whoami(), MetadataTable.NAME,
-        TablePermission.WRITE);
-    final String tableName = getUniqueNames(1)[0];
-    c.tableOperations().create(tableName);
-
-    // Write some data to a table and add some splits
-    BatchWriter bw = c.createBatchWriter(tableName, null);
-    final SortedSet<Text> splits = new TreeSet<>();
-    for (String split : "a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z".split(",")) {
-      splits.add(new Text(split));
-      Mutation m = new Mutation(new Text(split));
-      m.put(new byte[] {}, new byte[] {}, new byte[] {});
-      bw.addMutation(m);
-    }
-    bw.close();
-    c.tableOperations().addSplits(tableName, splits);
-
-    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);
-        }
+    try (AccumuloClient c = getClient()) {
+      c.securityOperations().grantTablePermission(c.whoami(), MetadataTable.NAME,
+          TablePermission.WRITE);
+      final String tableName = getUniqueNames(1)[0];
+      c.tableOperations().create(tableName);
+
+      // Write some data to a table and add some splits
+      BatchWriter bw = c.createBatchWriter(tableName, null);
+      final SortedSet<Text> splits = new TreeSet<>();
+      for (String split : "a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z".split(",")) {
+        splits.add(new Text(split));
+        Mutation m = new Mutation(new Text(split));
+        m.put(new byte[] {}, new byte[] {}, new byte[] {});
+        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.info().getInstanceName(), "-t", tableName).waitFor());
-
-      cluster.stop();
-
-      // add the 2nd volume
-      PropertiesConfiguration conf = new PropertiesConfiguration();
-      conf.load(cluster.getAccumuloPropertiesPath());
-      conf.setProperty(Property.INSTANCE_VOLUMES.getKey(), v1 + "," + v2);
-      conf.save(cluster.getAccumuloPropertiesPath());
-
-      // initialize volume
-      assertEquals(0, cluster.exec(Initialize.class, "--add-volumes").waitFor());
-      cluster.start();
-      c = getClient();
-
-      // 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++;
+      c.tableOperations().addSplits(tableName, splits);
+
+      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);
+          }
         }
-        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.info().getInstanceName(), "-t", tableName).waitFor());
+
+        cluster.stop();
+
+        // add the 2nd volume
+        PropertiesConfiguration conf = new PropertiesConfiguration();
+        conf.load(cluster.getAccumuloPropertiesPath());
+        conf.setProperty(Property.INSTANCE_VOLUMES.getKey(), v1 + "," + v2);
+        conf.save(cluster.getAccumuloPropertiesPath());
+
+        // initialize volume
+        assertEquals(0, cluster.exec(Initialize.class, "--add-volumes").waitFor());
+        cluster.start();
+
+        // 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 c6c22bf807..cfd62e52d4 100644
--- a/test/src/main/java/org/apache/accumulo/test/SampleIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/SampleIT.java
@@ -124,84 +124,86 @@ public void init(SortedKeyValueIterator<Key,Value> source, Map<String,String> op
   @Test
   public void testBasic() throws Exception {
 
-    AccumuloClient client = getAccumuloClient();
-    String tableName = getUniqueNames(1)[0];
-    String clone = tableName + "_clone";
+    try (AccumuloClient client = getAccumuloClient()) {
+      String tableName = getUniqueNames(1)[0];
+      String clone = tableName + "_clone";
 
-    client.tableOperations().create(tableName, new NewTableConfiguration().enableSampling(SC1));
+      client.tableOperations().create(tableName, new NewTableConfiguration().enableSampling(SC1));
 
-    BatchWriter bw = client.createBatchWriter(tableName, new BatchWriterConfig());
+      BatchWriter bw = client.createBatchWriter(tableName, new BatchWriterConfig());
 
-    TreeMap<Key,Value> expected = new TreeMap<>();
-    String someRow = writeData(bw, SC1, expected);
-    assertEquals(20, expected.size());
+      TreeMap<Key,Value> expected = new TreeMap<>();
+      String someRow = writeData(bw, SC1, expected);
+      assertEquals(20, expected.size());
 
-    Scanner scanner = client.createScanner(tableName, Authorizations.EMPTY);
-    Scanner isoScanner = new IsolatedScanner(client.createScanner(tableName, Authorizations.EMPTY));
-    Scanner csiScanner = new ClientSideIteratorScanner(
-        client.createScanner(tableName, Authorizations.EMPTY));
-    scanner.setSamplerConfiguration(SC1);
-    csiScanner.setSamplerConfiguration(SC1);
-    isoScanner.setSamplerConfiguration(SC1);
-    isoScanner.setBatchSize(10);
+      Scanner scanner = client.createScanner(tableName, Authorizations.EMPTY);
+      Scanner isoScanner = new IsolatedScanner(
+          client.createScanner(tableName, Authorizations.EMPTY));
+      Scanner csiScanner = new ClientSideIteratorScanner(
+          client.createScanner(tableName, Authorizations.EMPTY));
+      scanner.setSamplerConfiguration(SC1);
+      csiScanner.setSamplerConfiguration(SC1);
+      isoScanner.setSamplerConfiguration(SC1);
+      isoScanner.setBatchSize(10);
 
-    BatchScanner bScanner = client.createBatchScanner(tableName, Authorizations.EMPTY, 2);
-    bScanner.setSamplerConfiguration(SC1);
-    bScanner.setRanges(Arrays.asList(new Range()));
+      BatchScanner bScanner = client.createBatchScanner(tableName, Authorizations.EMPTY, 2);
+      bScanner.setSamplerConfiguration(SC1);
+      bScanner.setRanges(Arrays.asList(new Range()));
 
-    check(expected, scanner, bScanner, isoScanner, csiScanner);
+      check(expected, scanner, bScanner, isoScanner, csiScanner);
 
-    client.tableOperations().flush(tableName, null, null, true);
+      client.tableOperations().flush(tableName, null, null, true);
 
-    Scanner oScanner = newOfflineScanner(client, tableName, clone, SC1);
-    check(expected, scanner, bScanner, isoScanner, csiScanner, oScanner);
+      Scanner oScanner = newOfflineScanner(client, tableName, clone, SC1);
+      check(expected, scanner, bScanner, isoScanner, csiScanner, oScanner);
 
-    // ensure non sample data can be scanned after scanning sample data
-    for (ScannerBase sb : Arrays.asList(scanner, bScanner, isoScanner, csiScanner, oScanner)) {
-      sb.clearSamplerConfiguration();
-      assertEquals(20000, Iterables.size(sb));
-      sb.setSamplerConfiguration(SC1);
-    }
+      // ensure non sample data can be scanned after scanning sample data
+      for (ScannerBase sb : Arrays.asList(scanner, bScanner, isoScanner, csiScanner, oScanner)) {
+        sb.clearSamplerConfiguration();
+        assertEquals(20000, Iterables.size(sb));
+        sb.setSamplerConfiguration(SC1);
+      }
 
-    Iterator<Key> it = expected.keySet().iterator();
-    while (it.hasNext()) {
-      Key k = it.next();
-      if (k.getRow().toString().equals(someRow)) {
-        it.remove();
+      Iterator<Key> it = expected.keySet().iterator();
+      while (it.hasNext()) {
+        Key k = it.next();
+        if (k.getRow().toString().equals(someRow)) {
+          it.remove();
+        }
       }
-    }
 
-    expected.put(new Key(someRow, "cf1", "cq1", 8), new Value("42".getBytes()));
-    expected.put(new Key(someRow, "cf1", "cq3", 8), new Value("suprise".getBytes()));
+      expected.put(new Key(someRow, "cf1", "cq1", 8), new Value("42".getBytes()));
+      expected.put(new Key(someRow, "cf1", "cq3", 8), new Value("suprise".getBytes()));
 
-    Mutation m = new Mutation(someRow);
+      Mutation m = new Mutation(someRow);
 
-    m.put("cf1", "cq1", 8, "42");
-    m.putDelete("cf1", "cq2", 8);
-    m.put("cf1", "cq3", 8, "suprise");
+      m.put("cf1", "cq1", 8, "42");
+      m.putDelete("cf1", "cq2", 8);
+      m.put("cf1", "cq3", 8, "suprise");
 
-    bw.addMutation(m);
-    bw.close();
+      bw.addMutation(m);
+      bw.close();
 
-    check(expected, scanner, bScanner, isoScanner, csiScanner);
+      check(expected, scanner, bScanner, isoScanner, csiScanner);
 
-    client.tableOperations().flush(tableName, null, null, true);
+      client.tableOperations().flush(tableName, null, null, true);
 
-    oScanner = newOfflineScanner(client, tableName, clone, SC1);
-    check(expected, scanner, bScanner, isoScanner, csiScanner, oScanner);
+      oScanner = newOfflineScanner(client, tableName, clone, SC1);
+      check(expected, scanner, bScanner, isoScanner, csiScanner, oScanner);
 
-    scanner.setRange(new Range(someRow));
-    isoScanner.setRange(new Range(someRow));
-    csiScanner.setRange(new Range(someRow));
-    oScanner.setRange(new Range(someRow));
-    bScanner.setRanges(Arrays.asList(new Range(someRow)));
+      scanner.setRange(new Range(someRow));
+      isoScanner.setRange(new Range(someRow));
+      csiScanner.setRange(new Range(someRow));
+      oScanner.setRange(new Range(someRow));
+      bScanner.setRanges(Arrays.asList(new Range(someRow)));
 
-    expected.clear();
+      expected.clear();
 
-    expected.put(new Key(someRow, "cf1", "cq1", 8), new Value("42".getBytes()));
-    expected.put(new Key(someRow, "cf1", "cq3", 8), new Value("suprise".getBytes()));
+      expected.put(new Key(someRow, "cf1", "cq1", 8), new Value("42".getBytes()));
+      expected.put(new Key(someRow, "cf1", "cq3", 8), new Value("suprise".getBytes()));
 
-    check(expected, scanner, bScanner, isoScanner, csiScanner, oScanner);
+      check(expected, scanner, bScanner, isoScanner, csiScanner, oScanner);
+    }
   }
 
   private Scanner newOfflineScanner(AccumuloClient client, String tableName, String clone,
@@ -306,105 +308,106 @@ private void setRange(Range range, List<? extends ScannerBase> scanners) {
 
   @Test
   public void testIterator() throws Exception {
-    AccumuloClient client = getAccumuloClient();
-    String tableName = getUniqueNames(1)[0];
-    String clone = tableName + "_clone";
+    try (AccumuloClient client = getAccumuloClient()) {
+      String tableName = getUniqueNames(1)[0];
+      String clone = tableName + "_clone";
 
-    client.tableOperations().create(tableName, new NewTableConfiguration().enableSampling(SC1));
+      client.tableOperations().create(tableName, new NewTableConfiguration().enableSampling(SC1));
 
-    BatchWriter bw = client.createBatchWriter(tableName, new BatchWriterConfig());
+      BatchWriter bw = client.createBatchWriter(tableName, new BatchWriterConfig());
 
-    TreeMap<Key,Value> expected = new TreeMap<>();
-    writeData(bw, SC1, expected);
+      TreeMap<Key,Value> expected = new TreeMap<>();
+      writeData(bw, SC1, expected);
 
-    ArrayList<Key> keys = new ArrayList<>(expected.keySet());
+      ArrayList<Key> keys = new ArrayList<>(expected.keySet());
 
-    Range range1 = new Range(keys.get(6), true, keys.get(11), true);
+      Range range1 = new Range(keys.get(6), true, keys.get(11), true);
 
-    Scanner scanner = null;
-    Scanner isoScanner = null;
-    ClientSideIteratorScanner csiScanner = null;
-    BatchScanner bScanner = null;
-    Scanner oScanner = null;
-    try {
-      scanner = client.createScanner(tableName, Authorizations.EMPTY);
-      isoScanner = new IsolatedScanner(client.createScanner(tableName, Authorizations.EMPTY));
-      csiScanner = new ClientSideIteratorScanner(
-          client.createScanner(tableName, Authorizations.EMPTY));
-      bScanner = client.createBatchScanner(tableName, Authorizations.EMPTY, 2);
+      Scanner scanner = null;
+      Scanner isoScanner = null;
+      ClientSideIteratorScanner csiScanner = null;
+      BatchScanner bScanner = null;
+      Scanner oScanner = null;
+      try {
+        scanner = client.createScanner(tableName, Authorizations.EMPTY);
+        isoScanner = new IsolatedScanner(client.createScanner(tableName, Authorizations.EMPTY));
+        csiScanner = new ClientSideIteratorScanner(
+            client.createScanner(tableName, Authorizations.EMPTY));
+        bScanner = client.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) {
-        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) {
+          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) {
-        assertEquals(0, countEntries(s));
-      }
+        // the iterator should see more than 10 entries in sample data, and return no data
+        for (ScannerBase s : scanners) {
+          assertEquals(0, countEntries(s));
+        }
 
-      // flush an rerun same test against files
-      client.tableOperations().flush(tableName, null, null, true);
+        // flush an rerun same test against files
+        client.tableOperations().flush(tableName, null, null, true);
 
-      oScanner = newOfflineScanner(client, tableName, clone, null);
-      oScanner.addScanIterator(new IteratorSetting(100, IteratorThatUsesSample.class));
-      scanners = Arrays.asList(scanner, isoScanner, bScanner, csiScanner, oScanner);
+        oScanner = newOfflineScanner(client, 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) {
-        assertEquals(2954, countEntries(s));
-      }
+        setRange(range1, scanners);
+        for (ScannerBase s : scanners) {
+          assertEquals(2954, countEntries(s));
+        }
 
-      setRange(range2, scanners);
-      for (ScannerBase s : scanners) {
-        assertEquals(0, countEntries(s));
-      }
+        setRange(range2, scanners);
+        for (ScannerBase s : scanners) {
+          assertEquals(0, countEntries(s));
+        }
 
-      updateSamplingConfig(client, tableName, SC2);
+        updateSamplingConfig(client, tableName, SC2);
 
-      csiScanner.setIteratorSamplerConfiguration(SC2);
+        csiScanner.setIteratorSamplerConfiguration(SC2);
 
-      oScanner = newOfflineScanner(client, tableName, clone, null);
-      oScanner.addScanIterator(new IteratorSetting(100, IteratorThatUsesSample.class));
-      scanners = Arrays.asList(scanner, isoScanner, bScanner, csiScanner, oScanner);
+        oScanner = newOfflineScanner(client, 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);
-          fail("Expected SampleNotPresentException, but it did not happen : "
-              + s.getClass().getSimpleName());
-        } catch (SampleNotPresentException e) {
+        for (ScannerBase s : scanners) {
+          try {
+            countEntries(s);
+            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();
         }
-      }
-    } 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();
       }
     }
   }
@@ -418,68 +421,70 @@ private void setSamplerConfig(SamplerConfiguration sc, ScannerBase... scanners)
   @Test
   public void testSampleNotPresent() throws Exception {
 
-    AccumuloClient client = getAccumuloClient();
-    String tableName = getUniqueNames(1)[0];
-    String clone = tableName + "_clone";
+    try (AccumuloClient client = getAccumuloClient()) {
+      String tableName = getUniqueNames(1)[0];
+      String clone = tableName + "_clone";
 
-    client.tableOperations().create(tableName);
+      client.tableOperations().create(tableName);
 
-    BatchWriter bw = client.createBatchWriter(tableName, new BatchWriterConfig());
-
-    TreeMap<Key,Value> expected = new TreeMap<>();
-    writeData(bw, SC1, expected);
+      TreeMap<Key,Value> expected = new TreeMap<>();
+      try (BatchWriter bw = client.createBatchWriter(tableName, new BatchWriterConfig())) {
+        writeData(bw, SC1, expected);
+      }
 
-    Scanner scanner = client.createScanner(tableName, Authorizations.EMPTY);
-    Scanner isoScanner = new IsolatedScanner(client.createScanner(tableName, Authorizations.EMPTY));
-    isoScanner.setBatchSize(10);
-    Scanner csiScanner = new ClientSideIteratorScanner(
-        client.createScanner(tableName, Authorizations.EMPTY));
-    BatchScanner bScanner = client.createBatchScanner(tableName, Authorizations.EMPTY, 2);
-    bScanner.setRanges(Arrays.asList(new Range()));
+      Scanner scanner = client.createScanner(tableName, Authorizations.EMPTY);
+      Scanner isoScanner = new IsolatedScanner(
+          client.createScanner(tableName, Authorizations.EMPTY));
+      isoScanner.setBatchSize(10);
+      Scanner csiScanner = new ClientSideIteratorScanner(
+          client.createScanner(tableName, Authorizations.EMPTY));
+      BatchScanner bScanner = client.createBatchScanner(tableName, Authorizations.EMPTY, 2);
+      bScanner.setRanges(Arrays.asList(new Range()));
 
-    // ensure sample not present exception occurs when sampling is not configured
-    assertSampleNotPresent(SC1, scanner, isoScanner, bScanner, csiScanner);
+      // ensure sample not present exception occurs when sampling is not configured
+      assertSampleNotPresent(SC1, scanner, isoScanner, bScanner, csiScanner);
 
-    client.tableOperations().flush(tableName, null, null, true);
+      client.tableOperations().flush(tableName, null, null, true);
 
-    Scanner oScanner = newOfflineScanner(client, tableName, clone, SC1);
-    assertSampleNotPresent(SC1, scanner, isoScanner, bScanner, csiScanner, oScanner);
+      Scanner oScanner = newOfflineScanner(client, tableName, clone, SC1);
+      assertSampleNotPresent(SC1, scanner, isoScanner, bScanner, csiScanner, oScanner);
 
-    // configure sampling, however there exist an rfile w/o sample data... so should still see
-    // sample not present exception
+      // configure sampling, however there exist an rfile w/o sample data... so should still see
+      // sample not present exception
 
-    updateSamplingConfig(client, tableName, SC1);
+      updateSamplingConfig(client, tableName, SC1);
 
-    // create clone with new config
-    oScanner = newOfflineScanner(client, tableName, clone, SC1);
+      // create clone with new config
+      oScanner = newOfflineScanner(client, tableName, clone, SC1);
 
-    assertSampleNotPresent(SC1, scanner, isoScanner, bScanner, csiScanner, oScanner);
+      assertSampleNotPresent(SC1, scanner, isoScanner, bScanner, csiScanner, oScanner);
 
-    // create rfile with sample data present
-    client.tableOperations().compact(tableName, new CompactionConfig().setWait(true));
+      // create rfile with sample data present
+      client.tableOperations().compact(tableName, new CompactionConfig().setWait(true));
 
-    // should be able to scan sample now
-    oScanner = newOfflineScanner(client, tableName, clone, SC1);
-    setSamplerConfig(SC1, scanner, csiScanner, isoScanner, bScanner, oScanner);
-    check(expected, scanner, isoScanner, bScanner, csiScanner, oScanner);
+      // should be able to scan sample now
+      oScanner = newOfflineScanner(client, tableName, clone, SC1);
+      setSamplerConfig(SC1, scanner, csiScanner, isoScanner, bScanner, oScanner);
+      check(expected, scanner, isoScanner, bScanner, csiScanner, oScanner);
 
-    // change sampling config
-    updateSamplingConfig(client, tableName, SC2);
+      // change sampling config
+      updateSamplingConfig(client, tableName, SC2);
 
-    // create clone with new config
-    oScanner = newOfflineScanner(client, tableName, clone, SC2);
+      // create clone with new config
+      oScanner = newOfflineScanner(client, tableName, clone, SC2);
 
-    // rfile should have different sample config than table, and scan should not work
-    assertSampleNotPresent(SC2, scanner, isoScanner, bScanner, csiScanner, oScanner);
+      // rfile should have different sample config than table, and scan should not work
+      assertSampleNotPresent(SC2, scanner, isoScanner, bScanner, csiScanner, oScanner);
 
-    // create rfile that has same sample data as table config
-    client.tableOperations().compact(tableName, new CompactionConfig().setWait(true));
+      // create rfile that has same sample data as table config
+      client.tableOperations().compact(tableName, new CompactionConfig().setWait(true));
 
-    // should be able to scan sample now
-    updateExpected(SC2, expected);
-    oScanner = newOfflineScanner(client, tableName, clone, SC2);
-    setSamplerConfig(SC2, scanner, csiScanner, isoScanner, bScanner, oScanner);
-    check(expected, scanner, isoScanner, bScanner, csiScanner, oScanner);
+      // should be able to scan sample now
+      updateExpected(SC2, expected);
+      oScanner = newOfflineScanner(client, tableName, clone, SC2);
+      setSamplerConfig(SC2, scanner, csiScanner, isoScanner, bScanner, oScanner);
+      check(expected, scanner, isoScanner, bScanner, csiScanner, oScanner);
+    }
   }
 
   private void updateSamplingConfig(AccumuloClient client, String tableName,
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 1e97576004..e13a671f25 100644
--- a/test/src/main/java/org/apache/accumulo/test/ScanFlushWithTimeIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/ScanFlushWithTimeIT.java
@@ -49,45 +49,46 @@
   public void test() throws Exception {
     log.info("Creating table");
     String tableName = getUniqueNames(1)[0];
-    AccumuloClient c = getAccumuloClient();
-    c.tableOperations().create(tableName);
-    log.info("Adding slow iterator");
-    IteratorSetting setting = new IteratorSetting(50, SlowIterator.class);
-    SlowIterator.setSleepTime(setting, 1000);
-    c.tableOperations().attachIterator(tableName, setting);
-    log.info("Splitting the table");
-    SortedSet<Text> partitionKeys = new TreeSet<>();
-    partitionKeys.add(new Text("5"));
-    c.tableOperations().addSplits(tableName, partitionKeys);
-    log.info("waiting for zookeeper propagation");
-    UtilWaitThread.sleep(5 * 1000);
-    log.info("Adding a few entries");
-    BatchWriter bw = c.createBatchWriter(tableName, null);
-    for (int i = 0; i < 10; i++) {
-      Mutation m = new Mutation("" + i);
-      m.put("", "", "");
-      bw.addMutation(m);
-    }
-    bw.close();
-    log.info("Fetching some entries: should timeout and return something");
+    try (AccumuloClient c = getAccumuloClient()) {
+      c.tableOperations().create(tableName);
+      log.info("Adding slow iterator");
+      IteratorSetting setting = new IteratorSetting(50, SlowIterator.class);
+      SlowIterator.setSleepTime(setting, 1000);
+      c.tableOperations().attachIterator(tableName, setting);
+      log.info("Splitting the table");
+      SortedSet<Text> partitionKeys = new TreeSet<>();
+      partitionKeys.add(new Text("5"));
+      c.tableOperations().addSplits(tableName, partitionKeys);
+      log.info("waiting for zookeeper propagation");
+      UtilWaitThread.sleep(5 * 1000);
+      log.info("Adding a few entries");
+      BatchWriter bw = c.createBatchWriter(tableName, null);
+      for (int i = 0; i < 10; i++) {
+        Mutation m = new Mutation("" + i);
+        m.put("", "", "");
+        bw.addMutation(m);
+      }
+      bw.close();
+      log.info("Fetching some entries: should timeout and return something");
 
-    log.info("Scanner");
-    try (Scanner s = c.createScanner(tableName, Authorizations.EMPTY)) {
-      s.setBatchTimeout(500, TimeUnit.MILLISECONDS);
-      testScanner(s, 1200);
+      log.info("Scanner");
+      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");
-    try (BatchScanner bs = c.createBatchScanner(tableName, Authorizations.EMPTY, 5)) {
-      bs.setBatchTimeout(500, TimeUnit.MILLISECONDS);
-      bs.setRanges(Collections.singletonList(new Range()));
-      testScanner(bs, 1200);
+      log.info("BatchScanner");
+      try (BatchScanner bs = c.createBatchScanner(tableName, Authorizations.EMPTY, 5)) {
+        bs.setBatchTimeout(500, TimeUnit.MILLISECONDS);
+        bs.setRanges(Collections.singletonList(new Range()));
+        testScanner(bs, 1200);
+      }
     }
   }
 
diff --git a/test/src/main/java/org/apache/accumulo/test/ShellConfigIT.java b/test/src/main/java/org/apache/accumulo/test/ShellConfigIT.java
index 2258db380d..ff3dd2c51b 100644
--- a/test/src/main/java/org/apache/accumulo/test/ShellConfigIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/ShellConfigIT.java
@@ -48,23 +48,25 @@ public int defaultTimeoutSeconds() {
 
   @Before
   public void checkProperty() throws Exception {
-    AccumuloClient client = getAccumuloClient();
-    // TABLE_VOLUME_CHOOSER is a valid property that can be updated in ZK, whereas the crypto
-    // properties are not.
-    // This lets us run this test more generically rather than forcibly needing to update some
-    // property in accumulo.properties
-    origPropValue = client.instanceOperations().getSystemConfiguration()
-        .get(PerTableVolumeChooser.TABLE_VOLUME_CHOOSER);
-    client.instanceOperations().setProperty(PerTableVolumeChooser.TABLE_VOLUME_CHOOSER,
-        FairVolumeChooser.class.getName());
+    try (AccumuloClient client = getAccumuloClient()) {
+      // TABLE_VOLUME_CHOOSER is a valid property that can be updated in ZK, whereas the crypto
+      // properties are not.
+      // This lets us run this test more generically rather than forcibly needing to update some
+      // property in accumulo.properties
+      origPropValue = client.instanceOperations().getSystemConfiguration()
+          .get(PerTableVolumeChooser.TABLE_VOLUME_CHOOSER);
+      client.instanceOperations().setProperty(PerTableVolumeChooser.TABLE_VOLUME_CHOOSER,
+          FairVolumeChooser.class.getName());
+    }
   }
 
   @After
   public void resetProperty() throws Exception {
     if (null != origPropValue) {
-      AccumuloClient client = getAccumuloClient();
-      client.instanceOperations().setProperty(PerTableVolumeChooser.TABLE_VOLUME_CHOOSER,
-          origPropValue);
+      try (AccumuloClient client = getAccumuloClient()) {
+        client.instanceOperations().setProperty(PerTableVolumeChooser.TABLE_VOLUME_CHOOSER,
+            origPropValue);
+      }
     }
   }
 
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 55cb011d59..cf08e06968 100644
--- a/test/src/main/java/org/apache/accumulo/test/ShellServerIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/ShellServerIT.java
@@ -331,14 +331,15 @@ public static void tearDownAfterClass() throws Exception {
 
   @After
   public void deleteTables() throws Exception {
-    AccumuloClient c = getClient();
-    for (String table : c.tableOperations().list()) {
-      if (!table.startsWith(Namespace.ACCUMULO + ".") && !table.equals("trace"))
-        try {
-          c.tableOperations().delete(table);
-        } catch (TableNotFoundException e) {
-          // don't care
-        }
+    try (AccumuloClient c = getClient()) {
+      for (String table : c.tableOperations().list()) {
+        if (!table.startsWith(Namespace.ACCUMULO + ".") && !table.equals("trace"))
+          try {
+            c.tableOperations().delete(table);
+          } catch (TableNotFoundException e) {
+            // don't care
+          }
+      }
     }
   }
 
@@ -610,74 +611,75 @@ public void iter() throws Exception {
 
   @Test
   public void setIterOptionPrompt() throws Exception {
-    AccumuloClient client = getClient();
-    String tableName = name.getMethodName();
+    try (AccumuloClient client = getClient()) {
+      String tableName = name.getMethodName();
 
-    ts.exec("createtable " + tableName);
-    ts.input.set("\n\n");
-    // Setting a non-optiondescriber with no name should fail
-    ts.exec("setiter -scan -class " + COLUMN_FAMILY_COUNTER_ITERATOR + " -p 30", false);
+      ts.exec("createtable " + tableName);
+      ts.input.set("\n\n");
+      // Setting a non-optiondescriber with no name should fail
+      ts.exec("setiter -scan -class " + COLUMN_FAMILY_COUNTER_ITERATOR + " -p 30", false);
 
-    // Name as option will work
-    ts.exec("setiter -scan -class " + COLUMN_FAMILY_COUNTER_ITERATOR + " -p 30 -name cfcounter",
-        true);
+      // Name as option will work
+      ts.exec("setiter -scan -class " + COLUMN_FAMILY_COUNTER_ITERATOR + " -p 30 -name cfcounter",
+          true);
 
-    String expectedKey = "table.iterator.scan.cfcounter";
-    String expectedValue = "30," + COLUMN_FAMILY_COUNTER_ITERATOR;
-    TableOperations tops = client.tableOperations();
-    checkTableForProperty(tops, tableName, expectedKey, expectedValue);
+      String expectedKey = "table.iterator.scan.cfcounter";
+      String expectedValue = "30," + COLUMN_FAMILY_COUNTER_ITERATOR;
+      TableOperations tops = client.tableOperations();
+      checkTableForProperty(tops, tableName, expectedKey, expectedValue);
 
-    ts.exec("deletetable " + tableName, true);
-    tableName = tableName + "1";
+      ts.exec("deletetable " + tableName, true);
+      tableName = tableName + "1";
 
-    ts.exec("createtable " + tableName, true);
+      ts.exec("createtable " + tableName, true);
 
-    ts.input.set("customcfcounter\n\n");
+      ts.input.set("customcfcounter\n\n");
 
-    // Name on the CLI should override OptionDescriber (or user input name, in this case)
-    ts.exec("setiter -scan -class " + COLUMN_FAMILY_COUNTER_ITERATOR + " -p 30", true);
-    expectedKey = "table.iterator.scan.customcfcounter";
-    expectedValue = "30," + COLUMN_FAMILY_COUNTER_ITERATOR;
-    checkTableForProperty(tops, tableName, expectedKey, expectedValue);
+      // Name on the CLI should override OptionDescriber (or user input name, in this case)
+      ts.exec("setiter -scan -class " + COLUMN_FAMILY_COUNTER_ITERATOR + " -p 30", true);
+      expectedKey = "table.iterator.scan.customcfcounter";
+      expectedValue = "30," + COLUMN_FAMILY_COUNTER_ITERATOR;
+      checkTableForProperty(tops, tableName, expectedKey, expectedValue);
 
-    ts.exec("deletetable " + tableName, true);
-    tableName = tableName + "1";
+      ts.exec("deletetable " + tableName, true);
+      tableName = tableName + "1";
 
-    ts.exec("createtable " + tableName, true);
+      ts.exec("createtable " + tableName, true);
 
-    ts.input.set("customcfcounter\nname1 value1\nname2 value2\n\n");
+      ts.input.set("customcfcounter\nname1 value1\nname2 value2\n\n");
 
-    // Name on the CLI should override OptionDescriber (or user input name, in this case)
-    ts.exec("setiter -scan -class " + COLUMN_FAMILY_COUNTER_ITERATOR + " -p 30", true);
-    expectedKey = "table.iterator.scan.customcfcounter";
-    expectedValue = "30," + COLUMN_FAMILY_COUNTER_ITERATOR;
-    checkTableForProperty(tops, tableName, expectedKey, expectedValue);
-    expectedKey = "table.iterator.scan.customcfcounter.opt.name1";
-    expectedValue = "value1";
-    checkTableForProperty(tops, tableName, expectedKey, expectedValue);
-    expectedKey = "table.iterator.scan.customcfcounter.opt.name2";
-    expectedValue = "value2";
-    checkTableForProperty(tops, tableName, expectedKey, expectedValue);
+      // Name on the CLI should override OptionDescriber (or user input name, in this case)
+      ts.exec("setiter -scan -class " + COLUMN_FAMILY_COUNTER_ITERATOR + " -p 30", true);
+      expectedKey = "table.iterator.scan.customcfcounter";
+      expectedValue = "30," + COLUMN_FAMILY_COUNTER_ITERATOR;
+      checkTableForProperty(tops, tableName, expectedKey, expectedValue);
+      expectedKey = "table.iterator.scan.customcfcounter.opt.name1";
+      expectedValue = "value1";
+      checkTableForProperty(tops, tableName, expectedKey, expectedValue);
+      expectedKey = "table.iterator.scan.customcfcounter.opt.name2";
+      expectedValue = "value2";
+      checkTableForProperty(tops, tableName, expectedKey, expectedValue);
 
-    ts.exec("deletetable " + tableName, true);
-    tableName = tableName + "1";
+      ts.exec("deletetable " + tableName, true);
+      tableName = tableName + "1";
 
-    ts.exec("createtable " + tableName, true);
+      ts.exec("createtable " + tableName, true);
 
-    ts.input.set("\nname1 value1.1,value1.2,value1.3\nname2 value2\n\n");
+      ts.input.set("\nname1 value1.1,value1.2,value1.3\nname2 value2\n\n");
 
-    // Name on the CLI should override OptionDescriber (or user input name, in this case)
-    ts.exec("setiter -scan -class " + COLUMN_FAMILY_COUNTER_ITERATOR + " -p 30 -name cfcounter",
-        true);
-    expectedKey = "table.iterator.scan.cfcounter";
-    expectedValue = "30," + COLUMN_FAMILY_COUNTER_ITERATOR;
-    checkTableForProperty(tops, tableName, expectedKey, expectedValue);
-    expectedKey = "table.iterator.scan.cfcounter.opt.name1";
-    expectedValue = "value1.1,value1.2,value1.3";
-    checkTableForProperty(tops, tableName, expectedKey, expectedValue);
-    expectedKey = "table.iterator.scan.cfcounter.opt.name2";
-    expectedValue = "value2";
-    checkTableForProperty(tops, tableName, expectedKey, expectedValue);
+      // Name on the CLI should override OptionDescriber (or user input name, in this case)
+      ts.exec("setiter -scan -class " + COLUMN_FAMILY_COUNTER_ITERATOR + " -p 30 -name cfcounter",
+          true);
+      expectedKey = "table.iterator.scan.cfcounter";
+      expectedValue = "30," + COLUMN_FAMILY_COUNTER_ITERATOR;
+      checkTableForProperty(tops, tableName, expectedKey, expectedValue);
+      expectedKey = "table.iterator.scan.cfcounter.opt.name1";
+      expectedValue = "value1.1,value1.2,value1.3";
+      checkTableForProperty(tops, tableName, expectedKey, expectedValue);
+      expectedKey = "table.iterator.scan.cfcounter.opt.name2";
+      expectedValue = "value2";
+      checkTableForProperty(tops, tableName, expectedKey, expectedValue);
+    }
   }
 
   protected void checkTableForProperty(TableOperations tops, String tableName, String expectedKey,
@@ -733,8 +735,7 @@ public void addauths() throws Exception {
             new ErrorMessageCallback() {
               @Override
               public String getErrorMessage() {
-                try {
-                  AccumuloClient c = getClient();
+                try (AccumuloClient c = getClient()) {
                   return "Current auths for root are: "
                       + c.securityOperations().getUserAuthorizations("root");
                 } catch (Exception e) {
@@ -871,17 +872,18 @@ public void createTableWithProperties() throws Exception {
     ts.exec("insert a b c value", true);
     ts.exec("scan", true, "value", true);
 
-    AccumuloClient accumuloClient = getClient();
-    for (Entry<String,String> entry : accumuloClient.tableOperations().getProperties(table)) {
-      if (entry.getKey().equals("table.custom.description"))
-        assertEquals("Initial property was not set correctly", "description", entry.getValue());
+    try (AccumuloClient accumuloClient = getClient()) {
+      for (Entry<String,String> entry : accumuloClient.tableOperations().getProperties(table)) {
+        if (entry.getKey().equals("table.custom.description"))
+          assertEquals("Initial property was not set correctly", "description", entry.getValue());
 
-      if (entry.getKey().equals("table.custom.testProp"))
-        assertEquals("Initial property was not set correctly", "testProp", entry.getValue());
+        if (entry.getKey().equals("table.custom.testProp"))
+          assertEquals("Initial property was not set correctly", "testProp", entry.getValue());
 
-      if (entry.getKey().equals(Property.TABLE_SPLIT_THRESHOLD.getKey()))
-        assertEquals("Initial property was not set correctly", "10K", entry.getValue());
+        if (entry.getKey().equals(Property.TABLE_SPLIT_THRESHOLD.getKey()))
+          assertEquals("Initial property was not set correctly", "10K", entry.getValue());
 
+      }
     }
     ts.exec("deletetable -f " + table);
   }
@@ -1558,8 +1560,9 @@ public void listscans() throws Exception {
     for (int i = 0; i < 6; i++) {
       ts.exec("insert " + i + " cf cq value", true);
     }
-    AccumuloClient accumuloClient = getClient();
-    try (Scanner s = accumuloClient.createScanner(table, Authorizations.EMPTY)) {
+
+    try (AccumuloClient accumuloClient = getClient();
+        Scanner s = accumuloClient.createScanner(table, Authorizations.EMPTY)) {
       IteratorSetting cfg = new IteratorSetting(30, SlowIterator.class);
       SlowIterator.setSleepTime(cfg, 500);
       s.addScanIterator(cfg);
@@ -1610,7 +1613,7 @@ public void run() {
         // loopback...?
         String hostPortPattern = ".+:\\d+";
         assertTrue(tserver.matches(hostPortPattern));
-        assertTrue(getClient().instanceOperations().getTabletServers().contains(tserver));
+        assertTrue(accumuloClient.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)
@@ -2006,20 +2009,21 @@ private int countFiles(String tableId) throws IOException {
   }
 
   private String getTableId(String tableName) throws Exception {
-    AccumuloClient client = getClient();
-
-    for (int i = 0; i < 5; i++) {
-      Map<String,String> nameToId = client.tableOperations().tableIdMap();
-      if (nameToId.containsKey(tableName)) {
-        return nameToId.get(tableName);
-      } else {
-        Thread.sleep(1000);
+    try (AccumuloClient client = getClient()) {
+
+      for (int i = 0; i < 5; i++) {
+        Map<String,String> nameToId = client.tableOperations().tableIdMap();
+        if (nameToId.containsKey(tableName)) {
+          return nameToId.get(tableName);
+        } else {
+          Thread.sleep(1000);
+        }
       }
-    }
 
-    fail("Could not find ID for table: " + tableName);
-    // Will never get here
-    return null;
+      fail("Could not find ID for table: " + tableName);
+      // Will never get here
+      return null;
+    }
   }
 
   private static void assertMatches(String output, String pattern) {
@@ -2153,14 +2157,15 @@ public void testSummarySelection() throws Exception {
   public void testCreateTableWithLocalityGroups() throws Exception {
     final String table = name.getMethodName();
     ts.exec("createtable " + table + " -l locg1=fam1,fam2", true);
-    AccumuloClient accumuloClient = getClient();
-    Map<String,Set<Text>> lMap = accumuloClient.tableOperations().getLocalityGroups(table);
-    Set<Text> expectedColFams = new HashSet<>(Arrays.asList(new Text("fam1"), new Text("fam2")));
-    for (Entry<String,Set<Text>> entry : lMap.entrySet()) {
-      assertEquals("locg1", entry.getKey());
-      assertTrue(entry.getValue().containsAll(expectedColFams));
+    try (AccumuloClient accumuloClient = getClient()) {
+      Map<String,Set<Text>> lMap = accumuloClient.tableOperations().getLocalityGroups(table);
+      Set<Text> expectedColFams = new HashSet<>(Arrays.asList(new Text("fam1"), new Text("fam2")));
+      for (Entry<String,Set<Text>> entry : lMap.entrySet()) {
+        assertEquals("locg1", entry.getKey());
+        assertTrue(entry.getValue().containsAll(expectedColFams));
+      }
+      ts.exec("deletetable -f " + table);
     }
-    ts.exec("deletetable -f " + table);
   }
 
   /**
@@ -2172,15 +2177,16 @@ public void testCreateTableWithLocalityGroups() throws Exception {
   public void testCreateTableWithMultipleLocalityGroups() throws Exception {
     final String table = name.getMethodName();
     ts.exec("createtable " + table + " -l locg1=fam1,fam2 locg2=colfam1", true);
-    AccumuloClient accumuloClient = getClient();
-    Map<String,Set<Text>> lMap = accumuloClient.tableOperations().getLocalityGroups(table);
-    assertTrue(lMap.keySet().contains("locg1"));
-    assertTrue(lMap.keySet().contains("locg2"));
-    Set<Text> expectedColFams1 = new HashSet<>(Arrays.asList(new Text("fam1"), new Text("fam2")));
-    Set<Text> expectedColFams2 = new HashSet<>(Arrays.asList(new Text("colfam1")));
-    assertTrue(lMap.get("locg1").containsAll(expectedColFams1));
-    assertTrue(lMap.get("locg2").containsAll(expectedColFams2));
-    ts.exec("deletetable -f " + table);
+    try (AccumuloClient accumuloClient = getClient()) {
+      Map<String,Set<Text>> lMap = accumuloClient.tableOperations().getLocalityGroups(table);
+      assertTrue(lMap.keySet().contains("locg1"));
+      assertTrue(lMap.keySet().contains("locg2"));
+      Set<Text> expectedColFams1 = new HashSet<>(Arrays.asList(new Text("fam1"), new Text("fam2")));
+      Set<Text> expectedColFams2 = new HashSet<>(Arrays.asList(new Text("colfam1")));
+      assertTrue(lMap.get("locg1").containsAll(expectedColFams1));
+      assertTrue(lMap.get("locg2").containsAll(expectedColFams2));
+      ts.exec("deletetable -f " + table);
+    }
   }
 
   @Test
@@ -2332,13 +2338,13 @@ public void testCreateTableOffline() throws IOException {
   public void testCreateTableWithSplitsFile1()
       throws IOException, AccumuloSecurityException, TableNotFoundException, AccumuloException {
     String splitsFile = null;
-    try {
+    try (AccumuloClient client = getClient()) {
       splitsFile = System.getProperty("user.dir") + "/target/splitFile";
       generateSplitsFile(splitsFile, 1000, 12, false, false, true, false, false);
       SortedSet<Text> expectedSplits = readSplitsFromFile(splitsFile, false);
       final String tableName = name.getMethodName() + "_table";
       ts.exec("createtable " + tableName + " -sf " + splitsFile, true);
-      Collection<Text> createdSplits = getClient().tableOperations().listSplits(tableName);
+      Collection<Text> createdSplits = client.tableOperations().listSplits(tableName);
       assertEquals(expectedSplits, new TreeSet<>(createdSplits));
     } finally {
       Files.delete(Paths.get(splitsFile));
@@ -2354,13 +2360,13 @@ public void testCreateTableWithSplitsFile1()
   public void testCreateTableWithSplitsFile2()
       throws IOException, AccumuloSecurityException, TableNotFoundException, AccumuloException {
     String splitsFile = null;
-    try {
+    try (AccumuloClient client = getClient()) {
       splitsFile = System.getProperty("user.dir") + "/target/splitFile";
       generateSplitsFile(splitsFile, 300, 12, false, false, false, false, false);
       SortedSet<Text> expectedSplits = readSplitsFromFile(splitsFile, false);
       final String tableName = name.getMethodName() + "_table";
       ts.exec("createtable " + tableName + " -sf " + splitsFile, true);
-      Collection<Text> createdSplits = getClient().tableOperations().listSplits(tableName);
+      Collection<Text> createdSplits = client.tableOperations().listSplits(tableName);
       assertEquals(expectedSplits, new TreeSet<>(createdSplits));
     } finally {
       Files.delete(Paths.get(splitsFile));
@@ -2376,13 +2382,13 @@ public void testCreateTableWithSplitsFile2()
   public void testCreateTableWithSplitsFile3()
       throws IOException, AccumuloSecurityException, TableNotFoundException, AccumuloException {
     String splitsFile = null;
-    try {
+    try (AccumuloClient client = getClient()) {
       splitsFile = System.getProperty("user.dir") + "/target/splitFile";
       generateSplitsFile(splitsFile, 100, 23, false, true, true, false, false);
       SortedSet<Text> expectedSplits = readSplitsFromFile(splitsFile, false);
       final String tableName = name.getMethodName() + "_table";
       ts.exec("createtable " + tableName + " -sf " + splitsFile, true);
-      Collection<Text> createdSplits = getClient().tableOperations().listSplits(tableName);
+      Collection<Text> createdSplits = client.tableOperations().listSplits(tableName);
       assertEquals(expectedSplits, new TreeSet<>(createdSplits));
     } finally {
       Files.delete(Paths.get(splitsFile));
@@ -2398,13 +2404,13 @@ public void testCreateTableWithSplitsFile3()
   public void testCreateTableWithSplitsFile4()
       throws IOException, AccumuloSecurityException, TableNotFoundException, AccumuloException {
     String splitsFile = null;
-    try {
+    try (AccumuloClient client = getClient()) {
       splitsFile = System.getProperty("user.dir") + "/target/splitFile";
       generateSplitsFile(splitsFile, 100, 31, false, false, true, true, false);
       SortedSet<Text> expectedSplits = readSplitsFromFile(splitsFile, false);
       final String tableName = name.getMethodName() + "_table";
       ts.exec("createtable " + tableName + " -sf " + splitsFile, true);
-      Collection<Text> createdSplits = getClient().tableOperations().listSplits(tableName);
+      Collection<Text> createdSplits = client.tableOperations().listSplits(tableName);
       assertEquals(expectedSplits, new TreeSet<>(createdSplits));
     } finally {
       Files.delete(Paths.get(splitsFile));
@@ -2420,13 +2426,13 @@ public void testCreateTableWithSplitsFile4()
   public void testCreateTableWithSplitsFile5()
       throws IOException, AccumuloSecurityException, TableNotFoundException, AccumuloException {
     String splitsFile = null;
-    try {
+    try (AccumuloClient client = getClient()) {
       splitsFile = System.getProperty("user.dir") + "/target/splitFile";
       generateSplitsFile(splitsFile, 100, 32, false, false, true, false, true);
       SortedSet<Text> expectedSplits = readSplitsFromFile(splitsFile, false);
       final String tableName = name.getMethodName() + "_table";
       ts.exec("createtable " + tableName + " -sf " + splitsFile, true);
-      Collection<Text> createdSplits = getClient().tableOperations().listSplits(tableName);
+      Collection<Text> createdSplits = client.tableOperations().listSplits(tableName);
       assertEquals(expectedSplits, new TreeSet<>(createdSplits));
     } finally {
       Files.delete(Paths.get(splitsFile));
@@ -2442,13 +2448,13 @@ public void testCreateTableWithSplitsFile5()
   public void testCreateTableWithSplitsFile6()
       throws IOException, AccumuloSecurityException, TableNotFoundException, AccumuloException {
     String splitsFile = null;
-    try {
+    try (AccumuloClient client = getClient()) {
       splitsFile = System.getProperty("user.dir") + "/target/splitFile";
       generateSplitsFile(splitsFile, 100, 12, false, false, false, true, true);
       SortedSet<Text> expectedSplits = readSplitsFromFile(splitsFile, false);
       final String tableName = name.getMethodName() + "_table";
       ts.exec("createtable " + tableName + " -sf " + splitsFile, true);
-      Collection<Text> createdSplits = getClient().tableOperations().listSplits(tableName);
+      Collection<Text> createdSplits = client.tableOperations().listSplits(tableName);
       assertEquals(expectedSplits, new TreeSet<>(createdSplits));
     } finally {
       Files.delete(Paths.get(splitsFile));
@@ -2464,13 +2470,13 @@ public void testCreateTableWithSplitsFile6()
   public void testCreateTableWithSplitsFile7()
       throws IOException, AccumuloSecurityException, TableNotFoundException, AccumuloException {
     String splitsFile = null;
-    try {
+    try (AccumuloClient client = getClient()) {
       splitsFile = System.getProperty("user.dir") + "/target/splitFile";
       generateSplitsFile(splitsFile, 100, 12, false, false, true, true, true);
       SortedSet<Text> expectedSplits = readSplitsFromFile(splitsFile, false);
       final String tableName = name.getMethodName() + "_table";
       ts.exec("createtable " + tableName + " -sf " + splitsFile, true);
-      Collection<Text> createdSplits = getClient().tableOperations().listSplits(tableName);
+      Collection<Text> createdSplits = client.tableOperations().listSplits(tableName);
       assertEquals(expectedSplits, new TreeSet<>(createdSplits));
     } finally {
       Files.delete(Paths.get(splitsFile));
@@ -2486,13 +2492,13 @@ public void testCreateTableWithSplitsFile7()
   public void testCreateTableWithEmptySplitFile()
       throws IOException, AccumuloSecurityException, TableNotFoundException, AccumuloException {
     String splitsFile = null;
-    try {
+    try (AccumuloClient client = getClient()) {
       splitsFile = System.getProperty("user.dir") + "/target/splitFile";
       generateSplitsFile(splitsFile, 0, 0, false, false, false, false, false);
       SortedSet<Text> expectedSplits = readSplitsFromFile(splitsFile, false);
       final String tableName = name.getMethodName() + "_table";
       ts.exec("createtable " + tableName + " -sf " + splitsFile, false);
-      Collection<Text> createdSplits = getClient().tableOperations().listSplits(tableName);
+      Collection<Text> createdSplits = client.tableOperations().listSplits(tableName);
       assertEquals(expectedSplits, new TreeSet<>(createdSplits));
     } finally {
       Files.delete(Paths.get(splitsFile));
@@ -2506,30 +2512,32 @@ public void testCreateTableWithEmptySplitFile()
   public void testCreateTableWithCopySplitsFromOtherTable()
       throws IOException, AccumuloSecurityException, TableNotFoundException, AccumuloException {
     // create a table and add some splits
-    final String tableName1 = name.getMethodName() + "_table1";
-    ts.exec("createtable " + tableName1, true);
-    String output = ts.exec("tables", true);
-    assertTrue(output.contains(tableName1));
-    ts.exec("table " + tableName1, true);
-    // add splits to this table using the addsplits command.
-    List<Text> splits = new ArrayList<>();
-    splits.add(new Text("ccccc"));
-    splits.add(new Text("fffff"));
-    splits.add(new Text("mmmmm"));
-    splits.add(new Text("sssss"));
-    ts.exec("addsplits " + splits.get(0) + " " + splits.get(1) + " " + splits.get(2) + " "
-        + splits.get(3), true);
-    // Now create a table that will used the previous tables splits and create them at table
-    // creation
-    final String tableName2 = name.getMethodName() + "_table2";
-    ts.exec("createtable " + tableName2 + " --copy-splits " + tableName1, true);
-    ts.exec("table " + tableName1, true);
-    String tablesOutput = ts.exec("tables", true);
-    assertTrue(tablesOutput.contains(tableName2));
-    Collection<Text> createdSplits = getClient().tableOperations().listSplits(tableName2);
-    assertEquals(new TreeSet<>(splits), new TreeSet<>(createdSplits));
-    ts.exec("deletetable -f " + tableName1, true);
-    ts.exec("deletetable -f " + tableName2, true);
+    try (AccumuloClient client = getClient()) {
+      final String tableName1 = name.getMethodName() + "_table1";
+      ts.exec("createtable " + tableName1, true);
+      String output = ts.exec("tables", true);
+      assertTrue(output.contains(tableName1));
+      ts.exec("table " + tableName1, true);
+      // add splits to this table using the addsplits command.
+      List<Text> splits = new ArrayList<>();
+      splits.add(new Text("ccccc"));
+      splits.add(new Text("fffff"));
+      splits.add(new Text("mmmmm"));
+      splits.add(new Text("sssss"));
+      ts.exec("addsplits " + splits.get(0) + " " + splits.get(1) + " " + splits.get(2) + " "
+          + splits.get(3), true);
+      // Now create a table that will used the previous tables splits and create them at table
+      // creation
+      final String tableName2 = name.getMethodName() + "_table2";
+      ts.exec("createtable " + tableName2 + " --copy-splits " + tableName1, true);
+      ts.exec("table " + tableName1, true);
+      String tablesOutput = ts.exec("tables", true);
+      assertTrue(tablesOutput.contains(tableName2));
+      Collection<Text> createdSplits = client.tableOperations().listSplits(tableName2);
+      assertEquals(new TreeSet<>(splits), new TreeSet<>(createdSplits));
+      ts.exec("deletetable -f " + tableName1, true);
+      ts.exec("deletetable -f " + tableName2, true);
+    }
   }
 
   /**
@@ -2541,13 +2549,13 @@ public void testCreateTableWithCopySplitsFromOtherTable()
   public void testCreateTableWithBinarySplitsFile1()
       throws IOException, AccumuloSecurityException, TableNotFoundException, AccumuloException {
     String splitsFile = null;
-    try {
+    try (AccumuloClient client = getClient()) {
       splitsFile = System.getProperty("user.dir") + "/target/splitFile";
       generateSplitsFile(splitsFile, 200, 12, true, true, true, false, false);
       SortedSet<Text> expectedSplits = readSplitsFromFile(splitsFile, false);
       final String tableName = name.getMethodName() + "_table";
       ts.exec("createtable " + tableName + " -sf " + splitsFile, true);
-      Collection<Text> createdSplits = getClient().tableOperations().listSplits(tableName);
+      Collection<Text> createdSplits = client.tableOperations().listSplits(tableName);
       assertEquals(expectedSplits, new TreeSet<>(createdSplits));
     } finally {
       Files.delete(Paths.get(splitsFile));
@@ -2563,13 +2571,13 @@ public void testCreateTableWithBinarySplitsFile1()
   public void testCreateTableWithBinarySplitsFile2()
       throws IOException, AccumuloSecurityException, TableNotFoundException, AccumuloException {
     String splitsFile = null;
-    try {
+    try (AccumuloClient client = getClient()) {
       splitsFile = System.getProperty("user.dir") + "/target/splitFile";
       generateSplitsFile(splitsFile, 300, 12, true, true, false, false, false);
       SortedSet<Text> expectedSplits = readSplitsFromFile(splitsFile, false);
       final String tableName = name.getMethodName() + "_table";
       ts.exec("createtable " + tableName + " -sf " + splitsFile, true);
-      Collection<Text> createdSplits = getClient().tableOperations().listSplits(tableName);
+      Collection<Text> createdSplits = client.tableOperations().listSplits(tableName);
       assertEquals(expectedSplits, new TreeSet<>(createdSplits));
     } finally {
       Files.delete(Paths.get(splitsFile));
@@ -2585,13 +2593,13 @@ public void testCreateTableWithBinarySplitsFile2()
   public void testCreateTableWithBinarySplitsFile3()
       throws IOException, AccumuloSecurityException, TableNotFoundException, AccumuloException {
     String splitsFile = null;
-    try {
+    try (AccumuloClient client = getClient()) {
       splitsFile = System.getProperty("user.dir") + "/target/splitFile";
       generateSplitsFile(splitsFile, 100, 23, true, true, true, false, false);
       SortedSet<Text> expectedSplits = readSplitsFromFile(splitsFile, false);
       final String tableName = name.getMethodName() + "_table";
       ts.exec("createtable " + tableName + " -sf " + splitsFile, true);
-      Collection<Text> createdSplits = getClient().tableOperations().listSplits(tableName);
+      Collection<Text> createdSplits = client.tableOperations().listSplits(tableName);
       assertEquals(expectedSplits, new TreeSet<>(createdSplits));
     } finally {
       Files.delete(Paths.get(splitsFile));
@@ -2607,13 +2615,13 @@ public void testCreateTableWithBinarySplitsFile3()
   public void testCreateTableWithBinarySplitsFile4()
       throws IOException, AccumuloSecurityException, TableNotFoundException, AccumuloException {
     String splitsFile = null;
-    try {
+    try (AccumuloClient client = getClient()) {
       splitsFile = System.getProperty("user.dir") + "/target/splitFile";
       generateSplitsFile(splitsFile, 100, 31, true, true, true, true, false);
       SortedSet<Text> expectedSplits = readSplitsFromFile(splitsFile, false);
       final String tableName = name.getMethodName() + "_table";
       ts.exec("createtable " + tableName + " -sf " + splitsFile, true);
-      Collection<Text> createdSplits = getClient().tableOperations().listSplits(tableName);
+      Collection<Text> createdSplits = client.tableOperations().listSplits(tableName);
       assertEquals(expectedSplits, new TreeSet<>(createdSplits));
     } finally {
       Files.delete(Paths.get(splitsFile));
@@ -2629,13 +2637,13 @@ public void testCreateTableWithBinarySplitsFile4()
   public void testCreateTableWithBinarySplitsFile5()
       throws IOException, AccumuloSecurityException, TableNotFoundException, AccumuloException {
     String splitsFile = null;
-    try {
+    try (AccumuloClient client = getClient()) {
       splitsFile = System.getProperty("user.dir") + "/target/splitFile";
       generateSplitsFile(splitsFile, 100, 32, true, true, true, false, true);
       SortedSet<Text> expectedSplits = readSplitsFromFile(splitsFile, false);
       final String tableName = name.getMethodName() + "_table";
       ts.exec("createtable " + tableName + " -sf " + splitsFile, true);
-      Collection<Text> createdSplits = getClient().tableOperations().listSplits(tableName);
+      Collection<Text> createdSplits = client.tableOperations().listSplits(tableName);
       assertEquals(expectedSplits, new TreeSet<>(createdSplits));
     } finally {
       Files.delete(Paths.get(splitsFile));
@@ -2651,13 +2659,13 @@ public void testCreateTableWithBinarySplitsFile5()
   public void testCreateTableWithBinarySplitsFile6()
       throws IOException, AccumuloSecurityException, TableNotFoundException, AccumuloException {
     String splitsFile = null;
-    try {
+    try (AccumuloClient client = getClient()) {
       splitsFile = System.getProperty("user.dir") + "/target/splitFile";
       generateSplitsFile(splitsFile, 100, 12, true, true, false, true, true);
       SortedSet<Text> expectedSplits = readSplitsFromFile(splitsFile, false);
       final String tableName = name.getMethodName() + "_table";
       ts.exec("createtable " + tableName + " -sf " + splitsFile, true);
-      Collection<Text> createdSplits = getClient().tableOperations().listSplits(tableName);
+      Collection<Text> createdSplits = client.tableOperations().listSplits(tableName);
       assertEquals(expectedSplits, new TreeSet<>(createdSplits));
     } finally {
       Files.delete(Paths.get(splitsFile));
@@ -2673,13 +2681,13 @@ public void testCreateTableWithBinarySplitsFile6()
   public void testCreateTableWithBinarySplitsFile7()
       throws IOException, AccumuloSecurityException, TableNotFoundException, AccumuloException {
     String splitsFile = null;
-    try {
+    try (AccumuloClient client = getClient()) {
       splitsFile = System.getProperty("user.dir") + "/target/splitFile";
       generateSplitsFile(splitsFile, 100, 12, true, true, true, true, true);
       SortedSet<Text> expectedSplits = readSplitsFromFile(splitsFile, false);
       final String tableName = name.getMethodName() + "_table";
       ts.exec("createtable " + tableName + " -sf " + splitsFile, true);
-      Collection<Text> createdSplits = getClient().tableOperations().listSplits(tableName);
+      Collection<Text> createdSplits = client.tableOperations().listSplits(tableName);
       assertEquals(expectedSplits, new TreeSet<>(createdSplits));
     } finally {
       Files.delete(Paths.get(splitsFile));
diff --git a/test/src/main/java/org/apache/accumulo/test/SplitCancelsMajCIT.java b/test/src/main/java/org/apache/accumulo/test/SplitCancelsMajCIT.java
index 41100b8fba..529e76786a 100644
--- a/test/src/main/java/org/apache/accumulo/test/SplitCancelsMajCIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/SplitCancelsMajCIT.java
@@ -60,43 +60,45 @@ public static void teardown() throws Exception {
   @Test
   public void test() throws Exception {
     final String tableName = getUniqueNames(1)[0];
-    final AccumuloClient c = getClient();
-    c.tableOperations().create(tableName);
-    // majc should take 100 * .5 secs
-    IteratorSetting it = new IteratorSetting(100, SlowIterator.class);
-    SlowIterator.setSleepTime(it, 500);
-    c.tableOperations().attachIterator(tableName, it, EnumSet.of(IteratorScope.majc));
-    BatchWriter bw = c.createBatchWriter(tableName, new BatchWriterConfig());
-    for (int i = 0; i < 100; i++) {
-      Mutation m = new Mutation("" + i);
-      m.put("", "", new Value());
-      bw.addMutation(m);
-    }
-    bw.flush();
-    // start majc
-    final AtomicReference<Exception> ex = new AtomicReference<>();
-    Thread thread = new Thread() {
-      @Override
-      public void run() {
-        try {
-          c.tableOperations().compact(tableName, null, null, true, true);
-        } catch (Exception e) {
-          ex.set(e);
+    try (AccumuloClient c = getClient()) {
+      c.tableOperations().create(tableName);
+      // majc should take 100 * .5 secs
+      IteratorSetting it = new IteratorSetting(100, SlowIterator.class);
+      SlowIterator.setSleepTime(it, 500);
+      c.tableOperations().attachIterator(tableName, it, EnumSet.of(IteratorScope.majc));
+      try (BatchWriter bw = c.createBatchWriter(tableName, new BatchWriterConfig())) {
+        for (int i = 0; i < 100; i++) {
+          Mutation m = new Mutation("" + i);
+          m.put("", "", new Value());
+          bw.addMutation(m);
         }
+        bw.flush();
       }
-    };
-    thread.start();
+      // start majc
+      final AtomicReference<Exception> ex = new AtomicReference<>();
+      Thread thread = new Thread() {
+        @Override
+        public void run() {
+          try {
+            c.tableOperations().compact(tableName, null, null, true, true);
+          } catch (Exception e) {
+            ex.set(e);
+          }
+        }
+      };
+      thread.start();
 
-    long now = System.currentTimeMillis();
-    sleepUninterruptibly(10, TimeUnit.SECONDS);
-    // split the table, interrupts the compaction
-    SortedSet<Text> partitionKeys = new TreeSet<>();
-    partitionKeys.add(new Text("10"));
-    c.tableOperations().addSplits(tableName, partitionKeys);
-    thread.join();
-    // wait for the restarted compaction
-    assertTrue(System.currentTimeMillis() - now > 59 * 1000);
-    if (ex.get() != null)
-      throw ex.get();
+      long now = System.currentTimeMillis();
+      sleepUninterruptibly(10, TimeUnit.SECONDS);
+      // split the table, interrupts the compaction
+      SortedSet<Text> partitionKeys = new TreeSet<>();
+      partitionKeys.add(new Text("10"));
+      c.tableOperations().addSplits(tableName, partitionKeys);
+      thread.join();
+      // wait for the restarted compaction
+      assertTrue(System.currentTimeMillis() - now > 59 * 1000);
+      if (ex.get() != null)
+        throw ex.get();
+    }
   }
 }
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 8cd6e8b7ca..5c705e969f 100644
--- a/test/src/main/java/org/apache/accumulo/test/SplitRecoveryIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/SplitRecoveryIT.java
@@ -71,75 +71,76 @@ public void test() throws Exception {
 
     String tableName = getUniqueNames(1)[0];
 
-    for (int tn = 0; tn < 2; tn++) {
-
-      AccumuloClient accumuloClient = getAccumuloClient();
-      // create a table and put some data in it
-      accumuloClient.tableOperations().create(tableName);
-      BatchWriter bw = accumuloClient.createBatchWriter(tableName, new BatchWriterConfig());
-      bw.addMutation(m("a"));
-      bw.addMutation(m("b"));
-      bw.addMutation(m("c"));
-      bw.close();
-      // take the table offline
-      accumuloClient.tableOperations().offline(tableName);
-      while (!isOffline(tableName, accumuloClient))
-        sleepUninterruptibly(200, TimeUnit.MILLISECONDS);
-
-      // poke a partial split into the metadata table
-      accumuloClient.securityOperations().grantTablePermission(getAdminPrincipal(),
-          MetadataTable.NAME, TablePermission.WRITE);
-      Table.ID tableId = Table.ID.of(accumuloClient.tableOperations().tableIdMap().get(tableName));
-
-      KeyExtent extent = new KeyExtent(tableId, null, new Text("b"));
-      Mutation m = extent.getPrevRowUpdateMutation();
-
-      TabletsSection.TabletColumnFamily.SPLIT_RATIO_COLUMN.put(m,
-          new Value(Double.toString(0.5).getBytes()));
-      TabletsSection.TabletColumnFamily.OLD_PREV_ROW_COLUMN.put(m,
-          KeyExtent.encodePrevEndRow(null));
-      bw = accumuloClient.createBatchWriter(MetadataTable.NAME, new BatchWriterConfig());
-      bw.addMutation(m);
-
-      if (tn == 1) {
-
-        bw.flush();
-
-        try (Scanner scanner = accumuloClient.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()));
+    try (AccumuloClient accumuloClient = getAccumuloClient()) {
+      for (int tn = 0; tn < 2; tn++) {
+        // create a table and put some data in it
+        accumuloClient.tableOperations().create(tableName);
+        BatchWriter bw = accumuloClient.createBatchWriter(tableName, new BatchWriterConfig());
+        bw.addMutation(m("a"));
+        bw.addMutation(m("b"));
+        bw.addMutation(m("c"));
+        bw.close();
+        // take the table offline
+        accumuloClient.tableOperations().offline(tableName);
+        while (!isOffline(tableName, accumuloClient))
+          sleepUninterruptibly(200, TimeUnit.MILLISECONDS);
+
+        // poke a partial split into the metadata table
+        accumuloClient.securityOperations().grantTablePermission(getAdminPrincipal(),
+            MetadataTable.NAME, TablePermission.WRITE);
+        Table.ID tableId = Table.ID
+            .of(accumuloClient.tableOperations().tableIdMap().get(tableName));
+
+        KeyExtent extent = new KeyExtent(tableId, null, new Text("b"));
+        Mutation m = extent.getPrevRowUpdateMutation();
+
+        TabletsSection.TabletColumnFamily.SPLIT_RATIO_COLUMN.put(m,
+            new Value(Double.toString(0.5).getBytes()));
+        TabletsSection.TabletColumnFamily.OLD_PREV_ROW_COLUMN.put(m,
+            KeyExtent.encodePrevEndRow(null));
+        bw = accumuloClient.createBatchWriter(MetadataTable.NAME, new BatchWriterConfig());
+        bw.addMutation(m);
+
+        if (tn == 1) {
+
+          bw.flush();
+
+          try (Scanner scanner = accumuloClient.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()));
+
+            for (Entry<Key,Value> entry : scanner) {
+              m.put(DataFileColumnFamily.NAME, entry.getKey().getColumnQualifier(),
+                  entry.getValue());
+            }
+
+            bw.addMutation(m);
+          }
+        }
 
+        bw.close();
+        // bring the table online
+        accumuloClient.tableOperations().online(tableName);
+
+        // verify the tablets went online
+        try (Scanner scanner = accumuloClient.createScanner(tableName, Authorizations.EMPTY)) {
+          int i = 0;
+          String expected[] = {"a", "b", "c"};
           for (Entry<Key,Value> entry : scanner) {
-            m.put(DataFileColumnFamily.NAME, entry.getKey().getColumnQualifier(), entry.getValue());
+            assertEquals(expected[i], entry.getKey().getRow().toString());
+            i++;
           }
+          assertEquals(3, i);
 
-          bw.addMutation(m);
-        }
-      }
-
-      bw.close();
-      // bring the table online
-      accumuloClient.tableOperations().online(tableName);
-
-      // verify the tablets went online
-      try (Scanner scanner = accumuloClient.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++;
+          accumuloClient.tableOperations().delete(tableName);
         }
-        assertEquals(3, i);
-
-        accumuloClient.tableOperations().delete(tableName);
       }
     }
   }
-
 }
diff --git a/test/src/main/java/org/apache/accumulo/test/TableConfigurationUpdateIT.java b/test/src/main/java/org/apache/accumulo/test/TableConfigurationUpdateIT.java
index 6b36c27655..9a3968f1bb 100644
--- a/test/src/main/java/org/apache/accumulo/test/TableConfigurationUpdateIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/TableConfigurationUpdateIT.java
@@ -52,46 +52,47 @@ public int defaultTimeoutSeconds() {
 
   @Test
   public void test() throws Exception {
-    AccumuloClient client = getAccumuloClient();
-    ServerContext context = getCluster().getServerContext();
-
-    String table = getUniqueNames(1)[0];
-    client.tableOperations().create(table);
-
-    final NamespaceConfiguration defaultConf = new NamespaceConfiguration(Namespace.ID.DEFAULT,
-        context, DefaultConfiguration.getInstance());
-
-    // Cache invalidates 25% of the time
-    int randomMax = 4;
-    // Number of threads
-    int numThreads = 2;
-    // Number of iterations per thread
-    int iterations = 100000;
-    AccumuloConfiguration tableConf = new TableConfiguration(context,
-        org.apache.accumulo.core.client.impl.Table.ID.of(table), defaultConf);
-
-    long start = System.currentTimeMillis();
-    ExecutorService svc = Executors.newFixedThreadPool(numThreads);
-    CountDownLatch countDown = new CountDownLatch(numThreads);
-    ArrayList<Future<Exception>> futures = new ArrayList<>(numThreads);
-
-    for (int i = 0; i < numThreads; i++) {
-      futures.add(svc.submit(new TableConfRunner(randomMax, iterations, tableConf, countDown)));
-    }
+    try (AccumuloClient client = getAccumuloClient()) {
+      ServerContext context = getCluster().getServerContext();
+
+      String table = getUniqueNames(1)[0];
+      client.tableOperations().create(table);
+
+      final NamespaceConfiguration defaultConf = new NamespaceConfiguration(Namespace.ID.DEFAULT,
+          context, DefaultConfiguration.getInstance());
+
+      // Cache invalidates 25% of the time
+      int randomMax = 4;
+      // Number of threads
+      int numThreads = 2;
+      // Number of iterations per thread
+      int iterations = 100000;
+      AccumuloConfiguration tableConf = new TableConfiguration(context,
+          org.apache.accumulo.core.client.impl.Table.ID.of(table), defaultConf);
+
+      long start = System.currentTimeMillis();
+      ExecutorService svc = Executors.newFixedThreadPool(numThreads);
+      CountDownLatch countDown = new CountDownLatch(numThreads);
+      ArrayList<Future<Exception>> futures = new ArrayList<>(numThreads);
+
+      for (int i = 0; i < numThreads; i++) {
+        futures.add(svc.submit(new TableConfRunner(randomMax, iterations, tableConf, countDown)));
+      }
 
-    svc.shutdown();
-    assertTrue(svc.awaitTermination(60, TimeUnit.MINUTES));
+      svc.shutdown();
+      assertTrue(svc.awaitTermination(60, TimeUnit.MINUTES));
 
-    for (Future<Exception> fut : futures) {
-      Exception e = fut.get();
-      if (null != e) {
-        fail("Thread failed with exception " + e);
+      for (Future<Exception> fut : futures) {
+        Exception e = fut.get();
+        if (null != e) {
+          fail("Thread failed with exception " + e);
+        }
       }
-    }
 
-    long end = System.currentTimeMillis();
-    log.debug("{} with {} iterations and {} threads and cache invalidates {}% took {} second(s)",
-        tableConf, iterations, numThreads, ((1. / randomMax) * 100.), (end - start) / 1000);
+      long end = System.currentTimeMillis();
+      log.debug("{} with {} iterations and {} threads and cache invalidates {}% took {} second(s)",
+          tableConf, iterations, numThreads, ((1. / randomMax) * 100.), (end - start) / 1000);
+    }
   }
 
   public static class TableConfRunner implements Callable<Exception> {
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 5cf2eac98a..0ed1e83d30 100644
--- a/test/src/main/java/org/apache/accumulo/test/TableOperationsIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/TableOperationsIT.java
@@ -87,6 +87,7 @@ public void setup() throws Exception {
   @After
   public void checkForDanglingFateLocks() {
     FunctionalTestUtils.assertNoDanglingFateLocks(getClientContext(), getCluster());
+    accumuloClient.close();
   }
 
   @Test
diff --git a/test/src/main/java/org/apache/accumulo/test/TabletServerGivesUpIT.java b/test/src/main/java/org/apache/accumulo/test/TabletServerGivesUpIT.java
index 5354b0aa51..f085765230 100644
--- a/test/src/main/java/org/apache/accumulo/test/TabletServerGivesUpIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/TabletServerGivesUpIT.java
@@ -46,31 +46,32 @@ public void configure(MiniAccumuloConfigImpl cfg, Configuration hadoopCoreSite)
 
   @Test(timeout = 45 * 1000)
   public void test() throws Exception {
-    final AccumuloClient client = this.getClient();
-    // Yes, there's a tabletserver
-    assertEquals(1, client.instanceOperations().getTabletServers().size());
-    final String tableName = getUniqueNames(1)[0];
-    client.tableOperations().create(tableName);
-    // Kill dfs
-    cluster.getMiniDfs().shutdown();
-    // ask the tserver to do something
-    final AtomicReference<Exception> ex = new AtomicReference<>();
-    Thread splitter = new Thread() {
-      @Override
-      public void run() {
-        try {
-          TreeSet<Text> splits = new TreeSet<>();
-          splits.add(new Text("X"));
-          client.tableOperations().addSplits(tableName, splits);
-        } catch (Exception e) {
-          ex.set(e);
+    try (AccumuloClient client = this.getClient()) {
+      // Yes, there's a tabletserver
+      assertEquals(1, client.instanceOperations().getTabletServers().size());
+      final String tableName = getUniqueNames(1)[0];
+      client.tableOperations().create(tableName);
+      // Kill dfs
+      cluster.getMiniDfs().shutdown();
+      // ask the tserver to do something
+      final AtomicReference<Exception> ex = new AtomicReference<>();
+      Thread splitter = new Thread() {
+        @Override
+        public void run() {
+          try {
+            TreeSet<Text> splits = new TreeSet<>();
+            splits.add(new Text("X"));
+            client.tableOperations().addSplits(tableName, splits);
+          } catch (Exception e) {
+            ex.set(e);
+          }
         }
+      };
+      splitter.start();
+      // wait for the tserver to give up on writing to the WAL
+      while (client.instanceOperations().getTabletServers().size() == 1) {
+        sleepUninterruptibly(1, TimeUnit.SECONDS);
       }
-    };
-    splitter.start();
-    // wait for the tserver to give up on writing to the WAL
-    while (client.instanceOperations().getTabletServers().size() == 1) {
-      sleepUninterruptibly(1, TimeUnit.SECONDS);
     }
   }
 
diff --git a/test/src/main/java/org/apache/accumulo/test/TabletServerHdfsRestartIT.java b/test/src/main/java/org/apache/accumulo/test/TabletServerHdfsRestartIT.java
index 5765e8a9d3..be006eb60f 100644
--- a/test/src/main/java/org/apache/accumulo/test/TabletServerHdfsRestartIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/TabletServerHdfsRestartIT.java
@@ -44,25 +44,26 @@ public void configure(MiniAccumuloConfigImpl cfg, Configuration hadoopCoreSite)
 
   @Test(timeout = 2 * 60 * 1000)
   public void test() throws Exception {
-    final AccumuloClient client = this.getClient();
-    // Yes, there's a tabletserver
-    assertEquals(1, client.instanceOperations().getTabletServers().size());
-    final String tableName = getUniqueNames(1)[0];
-    client.tableOperations().create(tableName);
-    BatchWriter bw = client.createBatchWriter(tableName, null);
-    for (int i = 0; i < N; i++) {
-      Mutation m = new Mutation("" + i);
-      m.put("", "", "");
-      bw.addMutation(m);
-    }
-    bw.close();
-    client.tableOperations().flush(tableName, null, null, true);
+    try (AccumuloClient client = this.getClient()) {
+      // Yes, there's a tabletserver
+      assertEquals(1, client.instanceOperations().getTabletServers().size());
+      final String tableName = getUniqueNames(1)[0];
+      client.tableOperations().create(tableName);
+      BatchWriter bw = client.createBatchWriter(tableName, null);
+      for (int i = 0; i < N; i++) {
+        Mutation m = new Mutation("" + i);
+        m.put("", "", "");
+        bw.addMutation(m);
+      }
+      bw.close();
+      client.tableOperations().flush(tableName, null, null, true);
 
-    // Kill dfs
-    cluster.getMiniDfs().restartNameNode(false);
+      // Kill dfs
+      cluster.getMiniDfs().restartNameNode(false);
 
-    assertEquals(N,
-        Iterators.size(client.createScanner(tableName, Authorizations.EMPTY).iterator()));
+      assertEquals(N,
+          Iterators.size(client.createScanner(tableName, Authorizations.EMPTY).iterator()));
+    }
   }
 
 }
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 39b9e2947a..12c67c47ec 100644
--- a/test/src/main/java/org/apache/accumulo/test/TestRandomDeletes.java
+++ b/test/src/main/java/org/apache/accumulo/test/TestRandomDeletes.java
@@ -82,8 +82,7 @@ public String toString() {
   private static TreeSet<RowColumn> scanAll(ClientOnDefaultTable opts, ScannerOpts scanOpts,
       String tableName) throws Exception {
     TreeSet<RowColumn> result = new TreeSet<>();
-    AccumuloClient client = opts.getClient();
-    try (Scanner scanner = client.createScanner(tableName, auths)) {
+    try (Scanner scanner = opts.getClient().createScanner(tableName, auths)) {
       scanner.setBatchSize(scanOpts.scanBatchSize);
       for (Entry<Key,Value> entry : scanner) {
         Key key = entry.getKey();
diff --git a/test/src/main/java/org/apache/accumulo/test/ThriftServerBindsBeforeZooKeeperLockIT.java b/test/src/main/java/org/apache/accumulo/test/ThriftServerBindsBeforeZooKeeperLockIT.java
index 33b0ec2e95..4bc7aac6c8 100644
--- a/test/src/main/java/org/apache/accumulo/test/ThriftServerBindsBeforeZooKeeperLockIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/ThriftServerBindsBeforeZooKeeperLockIT.java
@@ -24,6 +24,7 @@
 import java.util.List;
 
 import org.apache.accumulo.core.Constants;
+import org.apache.accumulo.core.client.AccumuloClient;
 import org.apache.accumulo.core.conf.Property;
 import org.apache.accumulo.core.util.MonitorUtil;
 import org.apache.accumulo.fate.zookeeper.ZooReader;
@@ -71,7 +72,7 @@ public void testMonitorService() throws Exception {
 
     while (true) {
       try {
-        MonitorUtil.getLocation(getClientContext());
+        MonitorUtil.getLocation(getServerContext());
         break;
       } catch (Exception e) {
         LOG.debug("Failed to find active monitor location, retrying", e);
@@ -131,62 +132,65 @@ public void testMonitorService() throws Exception {
   @Test
   public void testMasterService() throws Exception {
     final MiniAccumuloClusterImpl cluster = (MiniAccumuloClusterImpl) getCluster();
-    final String instanceID = getAccumuloClient().getInstanceID();
+    try (AccumuloClient client = getAccumuloClient()) {
+      final String instanceID = client.getInstanceID();
 
-    // Wait for the Master to grab its lock
-    while (true) {
-      final ZooReader reader = new ZooReader(cluster.getZooKeepers(), 30000);
-      try {
-        List<String> locks = reader
-            .getChildren(Constants.ZROOT + "/" + instanceID + Constants.ZMASTER_LOCK);
-        if (locks.size() > 0) {
-          break;
+      // Wait for the Master to grab its lock
+      while (true) {
+        final ZooReader reader = new ZooReader(cluster.getZooKeepers(), 30000);
+        try {
+          List<String> locks = reader
+              .getChildren(Constants.ZROOT + "/" + instanceID + Constants.ZMASTER_LOCK);
+          if (locks.size() > 0) {
+            break;
+          }
+        } catch (Exception e) {
+          LOG.debug("Failed to find active master location, retrying", e);
+          Thread.sleep(1000);
         }
-      } catch (Exception e) {
-        LOG.debug("Failed to find active master location, retrying", e);
-        Thread.sleep(1000);
       }
-    }
 
-    LOG.debug("Found active master");
+      LOG.debug("Found active master");
 
-    while (true) {
-      int freePort = PortUtils.getRandomFreePort();
-      Process master = null;
-      try {
-        LOG.debug("Starting standby master on {}", freePort);
-        master = startProcess(cluster, ServerType.MASTER, freePort);
+      while (true) {
+        int freePort = PortUtils.getRandomFreePort();
+        Process master = null;
+        try {
+          LOG.debug("Starting standby master on {}", freePort);
+          master = startProcess(cluster, ServerType.MASTER, freePort);
 
-        while (true) {
-          Socket s = null;
-          try {
-            s = new Socket("localhost", freePort);
-            if (s.isConnected()) {
-              // Pass
-              return;
+          while (true) {
+            Socket s = null;
+            try {
+              s = new Socket("localhost", freePort);
+              if (s.isConnected()) {
+                // Pass
+                return;
+              }
+            } catch (Exception e) {
+              LOG.debug("Caught exception trying to connect to Master", e);
+            } finally {
+              if (null != s) {
+                s.close();
+              }
             }
-          } catch (Exception e) {
-            LOG.debug("Caught exception trying to connect to Master", e);
-          } finally {
-            if (null != s) {
-              s.close();
+            // Wait before trying again
+            Thread.sleep(1000);
+            // Make sure the process is still up. Possible the "randomFreePort" we got wasn't
+            // actually
+            // free and the process
+            // died trying to bind it. Pick a new port and restart it in that case.
+            if (!master.isAlive()) {
+              freePort = PortUtils.getRandomFreePort();
+              LOG.debug("Master died, restarting it listening on {}", freePort);
+              master = startProcess(cluster, ServerType.MASTER, freePort);
             }
           }
-          // Wait before trying again
-          Thread.sleep(1000);
-          // Make sure the process is still up. Possible the "randomFreePort" we got wasn't actually
-          // free and the process
-          // died trying to bind it. Pick a new port and restart it in that case.
-          if (!master.isAlive()) {
-            freePort = PortUtils.getRandomFreePort();
-            LOG.debug("Master died, restarting it listening on {}", freePort);
-            master = startProcess(cluster, ServerType.MASTER, freePort);
+        } finally {
+          if (null != master) {
+            master.destroyForcibly();
           }
         }
-      } finally {
-        if (null != master) {
-          master.destroyForcibly();
-        }
       }
     }
   }
@@ -196,62 +200,65 @@ public void testMasterService() throws Exception {
   @Test
   public void testGarbageCollectorPorts() throws Exception {
     final MiniAccumuloClusterImpl cluster = (MiniAccumuloClusterImpl) getCluster();
-    String instanceID = getAccumuloClient().getInstanceID();
+    try (AccumuloClient client = getAccumuloClient()) {
+      String instanceID = client.getInstanceID();
 
-    // Wait for the Master to grab its lock
-    while (true) {
-      final ZooReader reader = new ZooReader(cluster.getZooKeepers(), 30000);
-      try {
-        List<String> locks = reader
-            .getChildren(Constants.ZROOT + "/" + instanceID + Constants.ZGC_LOCK);
-        if (locks.size() > 0) {
-          break;
+      // Wait for the Master to grab its lock
+      while (true) {
+        final ZooReader reader = new ZooReader(cluster.getZooKeepers(), 30000);
+        try {
+          List<String> locks = reader
+              .getChildren(Constants.ZROOT + "/" + instanceID + Constants.ZGC_LOCK);
+          if (locks.size() > 0) {
+            break;
+          }
+        } catch (Exception e) {
+          LOG.debug("Failed to find active gc location, retrying", e);
+          Thread.sleep(1000);
         }
-      } catch (Exception e) {
-        LOG.debug("Failed to find active gc location, retrying", e);
-        Thread.sleep(1000);
       }
-    }
 
-    LOG.debug("Found active gc");
+      LOG.debug("Found active gc");
 
-    while (true) {
-      int freePort = PortUtils.getRandomFreePort();
-      Process master = null;
-      try {
-        LOG.debug("Starting standby gc on {}", freePort);
-        master = startProcess(cluster, ServerType.GARBAGE_COLLECTOR, freePort);
+      while (true) {
+        int freePort = PortUtils.getRandomFreePort();
+        Process master = null;
+        try {
+          LOG.debug("Starting standby gc on {}", freePort);
+          master = startProcess(cluster, ServerType.GARBAGE_COLLECTOR, freePort);
 
-        while (true) {
-          Socket s = null;
-          try {
-            s = new Socket("localhost", freePort);
-            if (s.isConnected()) {
-              // Pass
-              return;
+          while (true) {
+            Socket s = null;
+            try {
+              s = new Socket("localhost", freePort);
+              if (s.isConnected()) {
+                // Pass
+                return;
+              }
+            } catch (Exception e) {
+              LOG.debug("Caught exception trying to connect to GC", e);
+            } finally {
+              if (null != s) {
+                s.close();
+              }
             }
-          } catch (Exception e) {
-            LOG.debug("Caught exception trying to connect to GC", e);
-          } finally {
-            if (null != s) {
-              s.close();
+            // Wait before trying again
+            Thread.sleep(1000);
+            // Make sure the process is still up. Possible the "randomFreePort" we got wasn't
+            // actually
+            // free and the process
+            // died trying to bind it. Pick a new port and restart it in that case.
+            if (!master.isAlive()) {
+              freePort = PortUtils.getRandomFreePort();
+              LOG.debug("GC died, restarting it listening on {}", freePort);
+              master = startProcess(cluster, ServerType.GARBAGE_COLLECTOR, freePort);
             }
           }
-          // Wait before trying again
-          Thread.sleep(1000);
-          // Make sure the process is still up. Possible the "randomFreePort" we got wasn't actually
-          // free and the process
-          // died trying to bind it. Pick a new port and restart it in that case.
-          if (!master.isAlive()) {
-            freePort = PortUtils.getRandomFreePort();
-            LOG.debug("GC died, restarting it listening on {}", freePort);
-            master = startProcess(cluster, ServerType.GARBAGE_COLLECTOR, freePort);
+        } finally {
+          if (null != master) {
+            master.destroyForcibly();
           }
         }
-      } finally {
-        if (null != master) {
-          master.destroyForcibly();
-        }
       }
     }
   }
diff --git a/test/src/main/java/org/apache/accumulo/test/TotalQueuedIT.java b/test/src/main/java/org/apache/accumulo/test/TotalQueuedIT.java
index f99f2e68ff..f128ccd075 100644
--- a/test/src/main/java/org/apache/accumulo/test/TotalQueuedIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/TotalQueuedIT.java
@@ -56,73 +56,73 @@ public void configure(MiniAccumuloConfigImpl cfg, Configuration hadoopCoreSite)
   @Test(timeout = 4 * 60 * 1000)
   public void test() throws Exception {
     Random random = new SecureRandom();
-    AccumuloClient c = getClient();
-    c.instanceOperations().setProperty(Property.TSERV_TOTAL_MUTATION_QUEUE_MAX.getKey(),
-        "" + SMALL_QUEUE_SIZE);
-    String tableName = getUniqueNames(1)[0];
-    c.tableOperations().create(tableName);
-    c.tableOperations().setProperty(tableName, Property.TABLE_MAJC_RATIO.getKey(), "9999");
-    c.tableOperations().setProperty(tableName, Property.TABLE_FILE_MAX.getKey(), "999");
-    sleepUninterruptibly(1, TimeUnit.SECONDS);
-    // get an idea of how fast the syncs occur
-    byte row[] = new byte[250];
-    BatchWriterConfig cfg = new BatchWriterConfig();
-    cfg.setMaxWriteThreads(10);
-    cfg.setMaxLatency(1, TimeUnit.SECONDS);
-    cfg.setMaxMemory(1024 * 1024);
-    long realSyncs = getSyncs();
-    BatchWriter bw = c.createBatchWriter(tableName, cfg);
-    long now = System.currentTimeMillis();
-    long bytesSent = 0;
-    for (int i = 0; i < N; i++) {
-      random.nextBytes(row);
-      Mutation m = new Mutation(row);
-      m.put("", "", "");
-      bw.addMutation(m);
-      bytesSent += m.estimatedMemoryUsed();
-    }
-    bw.close();
-    long diff = System.currentTimeMillis() - now;
-    double secs = diff / 1000.;
-    double syncs = bytesSent / SMALL_QUEUE_SIZE;
-    double syncsPerSec = syncs / secs;
-    System.out
-        .println(String.format("Sent %d bytes in %f secs approximately %d syncs (%f syncs per sec)",
-            bytesSent, secs, ((long) syncs), syncsPerSec));
-    long update = getSyncs();
-    System.out.println("Syncs " + (update - realSyncs));
-    realSyncs = update;
+    try (AccumuloClient c = getClient()) {
+      c.instanceOperations().setProperty(Property.TSERV_TOTAL_MUTATION_QUEUE_MAX.getKey(),
+          "" + SMALL_QUEUE_SIZE);
+      String tableName = getUniqueNames(1)[0];
+      c.tableOperations().create(tableName);
+      c.tableOperations().setProperty(tableName, Property.TABLE_MAJC_RATIO.getKey(), "9999");
+      c.tableOperations().setProperty(tableName, Property.TABLE_FILE_MAX.getKey(), "999");
+      sleepUninterruptibly(1, TimeUnit.SECONDS);
+      // get an idea of how fast the syncs occur
+      byte row[] = new byte[250];
+      BatchWriterConfig cfg = new BatchWriterConfig();
+      cfg.setMaxWriteThreads(10);
+      cfg.setMaxLatency(1, TimeUnit.SECONDS);
+      cfg.setMaxMemory(1024 * 1024);
+      long realSyncs = getSyncs(c);
+      BatchWriter bw = c.createBatchWriter(tableName, cfg);
+      long now = System.currentTimeMillis();
+      long bytesSent = 0;
+      for (int i = 0; i < N; i++) {
+        random.nextBytes(row);
+        Mutation m = new Mutation(row);
+        m.put("", "", "");
+        bw.addMutation(m);
+        bytesSent += m.estimatedMemoryUsed();
+      }
+      bw.close();
+      long diff = System.currentTimeMillis() - now;
+      double secs = diff / 1000.;
+      double syncs = bytesSent / SMALL_QUEUE_SIZE;
+      double syncsPerSec = syncs / secs;
+      System.out.println(
+          String.format("Sent %d bytes in %f secs approximately %d syncs (%f syncs per sec)",
+              bytesSent, secs, ((long) syncs), syncsPerSec));
+      long update = getSyncs(c);
+      System.out.println("Syncs " + (update - realSyncs));
+      realSyncs = update;
 
-    // Now with a much bigger total queue
-    c.instanceOperations().setProperty(Property.TSERV_TOTAL_MUTATION_QUEUE_MAX.getKey(),
-        "" + LARGE_QUEUE_SIZE);
-    c.tableOperations().flush(tableName, null, null, true);
-    sleepUninterruptibly(1, TimeUnit.SECONDS);
-    bw = c.createBatchWriter(tableName, cfg);
-    now = System.currentTimeMillis();
-    bytesSent = 0;
-    for (int i = 0; i < N; i++) {
-      random.nextBytes(row);
-      Mutation m = new Mutation(row);
-      m.put("", "", "");
-      bw.addMutation(m);
-      bytesSent += m.estimatedMemoryUsed();
+      // Now with a much bigger total queue
+      c.instanceOperations().setProperty(Property.TSERV_TOTAL_MUTATION_QUEUE_MAX.getKey(),
+          "" + LARGE_QUEUE_SIZE);
+      c.tableOperations().flush(tableName, null, null, true);
+      sleepUninterruptibly(1, TimeUnit.SECONDS);
+      bw = c.createBatchWriter(tableName, cfg);
+      now = System.currentTimeMillis();
+      bytesSent = 0;
+      for (int i = 0; i < N; i++) {
+        random.nextBytes(row);
+        Mutation m = new Mutation(row);
+        m.put("", "", "");
+        bw.addMutation(m);
+        bytesSent += m.estimatedMemoryUsed();
+      }
+      bw.close();
+      diff = System.currentTimeMillis() - now;
+      secs = diff / 1000.;
+      syncs = bytesSent / LARGE_QUEUE_SIZE;
+      syncsPerSec = syncs / secs;
+      System.out.println(
+          String.format("Sent %d bytes in %f secs approximately %d syncs (%f syncs per sec)",
+              bytesSent, secs, ((long) syncs), syncsPerSec));
+      update = getSyncs(c);
+      System.out.println("Syncs " + (update - realSyncs));
+      assertTrue(update - realSyncs < realSyncs);
     }
-    bw.close();
-    diff = System.currentTimeMillis() - now;
-    secs = diff / 1000.;
-    syncs = bytesSent / LARGE_QUEUE_SIZE;
-    syncsPerSec = syncs / secs;
-    System.out
-        .println(String.format("Sent %d bytes in %f secs approximately %d syncs (%f syncs per sec)",
-            bytesSent, secs, ((long) syncs), syncsPerSec));
-    update = getSyncs();
-    System.out.println("Syncs " + (update - realSyncs));
-    assertTrue(update - realSyncs < realSyncs);
   }
 
-  private long getSyncs() throws Exception {
-    AccumuloClient c = getClient();
+  private long getSyncs(AccumuloClient c) throws Exception {
     ServerContext context = getServerContext();
     for (String address : c.instanceOperations().getTabletServers()) {
       TabletClientService.Client client = ThriftUtil
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 2c26104089..97b8857188 100644
--- a/test/src/main/java/org/apache/accumulo/test/TracerRecoversAfterOfflineTableIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/TracerRecoversAfterOfflineTableIT.java
@@ -55,72 +55,73 @@ public int defaultTimeoutSeconds() {
   @Test
   public void test() throws Exception {
     Process tracer = null;
-    AccumuloClient client = getClient();
-    if (!client.tableOperations().exists("trace")) {
-      MiniAccumuloClusterImpl mac = cluster;
-      tracer = mac.exec(TraceServer.class);
-      while (!client.tableOperations().exists("trace")) {
-        sleepUninterruptibly(1, TimeUnit.SECONDS);
+    try (AccumuloClient client = getClient()) {
+      if (!client.tableOperations().exists("trace")) {
+        MiniAccumuloClusterImpl mac = cluster;
+        tracer = mac.exec(TraceServer.class);
+        while (!client.tableOperations().exists("trace")) {
+          sleepUninterruptibly(1, TimeUnit.SECONDS);
+        }
+        sleepUninterruptibly(5, TimeUnit.SECONDS);
       }
-      sleepUninterruptibly(5, TimeUnit.SECONDS);
-    }
 
-    log.info("Taking table offline");
-    client.tableOperations().offline("trace", true);
+      log.info("Taking table offline");
+      client.tableOperations().offline("trace", true);
 
-    String tableName = getUniqueNames(1)[0];
-    client.tableOperations().create(tableName);
+      String tableName = getUniqueNames(1)[0];
+      client.tableOperations().create(tableName);
 
-    log.info("Start a distributed trace span");
+      log.info("Start a distributed trace span");
 
-    DistributedTrace.enable("localhost", "testTrace", getClientInfo().getProperties());
-    Span root = Trace.on("traceTest");
-    BatchWriter bw = client.createBatchWriter(tableName, null);
-    Mutation m = new Mutation("m");
-    m.put("a", "b", "c");
-    bw.addMutation(m);
-    bw.close();
-    root.stop();
+      DistributedTrace.enable("localhost", "testTrace", getClientInfo().getProperties());
+      Span root = Trace.on("traceTest");
+      BatchWriter bw = client.createBatchWriter(tableName, null);
+      Mutation m = new Mutation("m");
+      m.put("a", "b", "c");
+      bw.addMutation(m);
+      bw.close();
+      root.stop();
 
-    log.info("Bringing trace table back online");
-    client.tableOperations().online("trace", true);
+      log.info("Bringing trace table back online");
+      client.tableOperations().online("trace", true);
 
-    log.info("Trace table is online, should be able to find trace");
+      log.info("Trace table is online, should be able to find trace");
 
-    try (Scanner scanner = client.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 = client.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 f823073e83..c9050b92fe 100644
--- a/test/src/main/java/org/apache/accumulo/test/UnusedWALIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/UnusedWALIT.java
@@ -77,38 +77,39 @@ public void test() throws Exception {
     String[] tableNames = getUniqueNames(2);
     String bigTable = tableNames[0];
     String lilTable = tableNames[1];
-    AccumuloClient c = getClient();
-    c.tableOperations().create(bigTable);
-    c.tableOperations().create(lilTable);
-
-    ServerContext context = getServerContext();
-    new ZooReaderWriter(c.info().getZooKeepers(), c.info().getZooKeepersSessionTimeOut(), "");
-
-    // put some data in a log that should be replayed for both tables
-    writeSomeData(c, bigTable, 0, 10, 0, 10);
-    scanSomeData(c, bigTable, 0, 10, 0, 10);
-    writeSomeData(c, lilTable, 0, 1, 0, 1);
-    scanSomeData(c, lilTable, 0, 1, 0, 1);
-    assertEquals(2, getWALCount(context));
-
-    // roll the logs by pushing data into bigTable
-    writeSomeData(c, bigTable, 0, 3000, 0, 1000);
-    assertEquals(3, getWALCount(context));
-
-    // put some data in the latest log
-    writeSomeData(c, lilTable, 1, 10, 0, 10);
-    scanSomeData(c, lilTable, 1, 10, 0, 10);
-
-    // bounce the tserver
-    getCluster().getClusterControl().stop(ServerType.TABLET_SERVER);
-    getCluster().getClusterControl().start(ServerType.TABLET_SERVER);
-
-    // wait for the metadata table to be online
-    Iterators.size(c.createScanner(MetadataTable.NAME, Authorizations.EMPTY).iterator());
-
-    // check our two sets of data in different logs
-    scanSomeData(c, lilTable, 0, 1, 0, 1);
-    scanSomeData(c, lilTable, 1, 10, 0, 10);
+    try (AccumuloClient c = getClient()) {
+      c.tableOperations().create(bigTable);
+      c.tableOperations().create(lilTable);
+
+      ServerContext context = getServerContext();
+      new ZooReaderWriter(c.info().getZooKeepers(), c.info().getZooKeepersSessionTimeOut(), "");
+
+      // put some data in a log that should be replayed for both tables
+      writeSomeData(c, bigTable, 0, 10, 0, 10);
+      scanSomeData(c, bigTable, 0, 10, 0, 10);
+      writeSomeData(c, lilTable, 0, 1, 0, 1);
+      scanSomeData(c, lilTable, 0, 1, 0, 1);
+      assertEquals(2, getWALCount(context));
+
+      // roll the logs by pushing data into bigTable
+      writeSomeData(c, bigTable, 0, 3000, 0, 1000);
+      assertEquals(3, getWALCount(context));
+
+      // put some data in the latest log
+      writeSomeData(c, lilTable, 1, 10, 0, 10);
+      scanSomeData(c, lilTable, 1, 10, 0, 10);
+
+      // bounce the tserver
+      getCluster().getClusterControl().stop(ServerType.TABLET_SERVER);
+      getCluster().getClusterControl().start(ServerType.TABLET_SERVER);
+
+      // wait for the metadata table to be online
+      Iterators.size(c.createScanner(MetadataTable.NAME, Authorizations.EMPTY).iterator());
+
+      // check our two sets of data in different logs
+      scanSomeData(c, lilTable, 0, 1, 0, 1);
+      scanSomeData(c, lilTable, 1, 10, 0, 10);
+    }
   }
 
   private void scanSomeData(AccumuloClient c, String table, int startRow, int rowCount,
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 ad4afbc052..b2e9d81539 100644
--- a/test/src/main/java/org/apache/accumulo/test/UserCompactionStrategyIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/UserCompactionStrategyIT.java
@@ -71,57 +71,62 @@ public int defaultTimeoutSeconds() {
 
   @After
   public void checkForDanglingFateLocks() {
-    FunctionalTestUtils.assertNoDanglingFateLocks(getClientContext(), getCluster());
+    // create an accumulo client even though its not used inorder to enable static stuff
+    try (AccumuloClient c = getAccumuloClient()) {
+      FunctionalTestUtils.assertNoDanglingFateLocks(getClientContext(), getCluster());
+    }
   }
 
   @Test
   public void testDropA() throws Exception {
-    AccumuloClient c = getAccumuloClient();
+    try (AccumuloClient c = getAccumuloClient()) {
 
-    String tableName = getUniqueNames(1)[0];
-    c.tableOperations().create(tableName);
+      String tableName = getUniqueNames(1)[0];
+      c.tableOperations().create(tableName);
 
-    writeFlush(c, tableName, "a");
-    writeFlush(c, tableName, "b");
-    // create a file that starts with A containing rows 'a' and 'b'
-    c.tableOperations().compact(tableName, new CompactionConfig().setWait(true));
+      writeFlush(c, tableName, "a");
+      writeFlush(c, tableName, "b");
+      // create a file that starts with A containing rows 'a' and 'b'
+      c.tableOperations().compact(tableName, new CompactionConfig().setWait(true));
 
-    writeFlush(c, tableName, "c");
-    writeFlush(c, tableName, "d");
+      writeFlush(c, tableName, "c");
+      writeFlush(c, tableName, "d");
 
-    // drop files that start with A
-    CompactionStrategyConfig csConfig = new CompactionStrategyConfig(
-        TestCompactionStrategy.class.getName());
-    csConfig.setOptions(ImmutableMap.of("dropPrefix", "A", "inputPrefix", "F"));
-    c.tableOperations().compact(tableName,
-        new CompactionConfig().setWait(true).setCompactionStrategy(csConfig));
+      // drop files that start with A
+      CompactionStrategyConfig csConfig = new CompactionStrategyConfig(
+          TestCompactionStrategy.class.getName());
+      csConfig.setOptions(ImmutableMap.of("dropPrefix", "A", "inputPrefix", "F"));
+      c.tableOperations().compact(tableName,
+          new CompactionConfig().setWait(true).setCompactionStrategy(csConfig));
 
-    assertEquals(ImmutableSet.of("c", "d"), getRows(c, tableName));
+      assertEquals(ImmutableSet.of("c", "d"), getRows(c, tableName));
 
-    // this compaction should not drop files starting with A
-    c.tableOperations().compact(tableName, new CompactionConfig().setWait(true));
-    c.tableOperations().compact(tableName, new CompactionConfig().setWait(true));
+      // this compaction should not drop files starting with A
+      c.tableOperations().compact(tableName, new CompactionConfig().setWait(true));
+      c.tableOperations().compact(tableName, new CompactionConfig().setWait(true));
 
-    assertEquals(ImmutableSet.of("c", "d"), getRows(c, tableName));
+      assertEquals(ImmutableSet.of("c", "d"), getRows(c, tableName));
+    }
   }
 
   private void testDropNone(Map<String,String> options) throws Exception {
 
-    AccumuloClient c = getAccumuloClient();
+    try (AccumuloClient c = getAccumuloClient()) {
 
-    String tableName = getUniqueNames(1)[0];
-    c.tableOperations().create(tableName);
+      String tableName = getUniqueNames(1)[0];
+      c.tableOperations().create(tableName);
 
-    writeFlush(c, tableName, "a");
-    writeFlush(c, tableName, "b");
+      writeFlush(c, tableName, "a");
+      writeFlush(c, tableName, "b");
 
-    CompactionStrategyConfig csConfig = new CompactionStrategyConfig(
-        TestCompactionStrategy.class.getName());
-    csConfig.setOptions(options);
-    c.tableOperations().compact(tableName,
-        new CompactionConfig().setWait(true).setCompactionStrategy(csConfig));
+      CompactionStrategyConfig csConfig = new CompactionStrategyConfig(
+          TestCompactionStrategy.class.getName());
+      csConfig.setOptions(options);
+      c.tableOperations().compact(tableName,
+          new CompactionConfig().setWait(true).setCompactionStrategy(csConfig));
 
-    assertEquals(ImmutableSet.of("a", "b"), getRows(c, tableName));
+      assertEquals(ImmutableSet.of("a", "b"), getRows(c, tableName));
+    }
   }
 
   @Test
@@ -148,38 +153,39 @@ public void testPerTableClasspath() throws Exception {
 
     // test per-table classpath + user specified compaction strategy
 
-    final AccumuloClient c = getAccumuloClient();
-    final String tableName = getUniqueNames(1)[0];
-    File target = new File(System.getProperty("user.dir"), "target");
-    assertTrue(target.mkdirs() || target.isDirectory());
-    File destFile = installJar(target, "/TestCompactionStrat.jar");
-    c.tableOperations().create(tableName);
-    c.instanceOperations().setProperty(
-        Property.VFS_CONTEXT_CLASSPATH_PROPERTY.getKey() + "context1", destFile.toString());
-    c.tableOperations().setProperty(tableName, Property.TABLE_CLASSPATH.getKey(), "context1");
+    try (AccumuloClient c = getAccumuloClient()) {
+      final String tableName = getUniqueNames(1)[0];
+      File target = new File(System.getProperty("user.dir"), "target");
+      assertTrue(target.mkdirs() || target.isDirectory());
+      File destFile = installJar(target, "/TestCompactionStrat.jar");
+      c.tableOperations().create(tableName);
+      c.instanceOperations().setProperty(
+          Property.VFS_CONTEXT_CLASSPATH_PROPERTY.getKey() + "context1", destFile.toString());
+      c.tableOperations().setProperty(tableName, Property.TABLE_CLASSPATH.getKey(), "context1");
 
-    c.tableOperations().addSplits(tableName, new TreeSet<>(Arrays.asList(new Text("efg"))));
+      c.tableOperations().addSplits(tableName, new TreeSet<>(Arrays.asList(new Text("efg"))));
 
-    writeFlush(c, tableName, "a");
-    writeFlush(c, tableName, "b");
+      writeFlush(c, tableName, "a");
+      writeFlush(c, tableName, "b");
 
-    writeFlush(c, tableName, "h");
-    writeFlush(c, tableName, "i");
+      writeFlush(c, tableName, "h");
+      writeFlush(c, tableName, "i");
 
-    assertEquals(4, FunctionalTestUtils.countRFiles(c, tableName));
+      assertEquals(4, FunctionalTestUtils.countRFiles(c, tableName));
 
-    // EfgCompactionStrat will only compact a tablet w/ end row of 'efg'. No other tablets are
-    // compacted.
-    CompactionStrategyConfig csConfig = new CompactionStrategyConfig(
-        "org.apache.accumulo.test.EfgCompactionStrat");
-    c.tableOperations().compact(tableName,
-        new CompactionConfig().setWait(true).setCompactionStrategy(csConfig));
+      // EfgCompactionStrat will only compact a tablet w/ end row of 'efg'. No other tablets are
+      // compacted.
+      CompactionStrategyConfig csConfig = new CompactionStrategyConfig(
+          "org.apache.accumulo.test.EfgCompactionStrat");
+      c.tableOperations().compact(tableName,
+          new CompactionConfig().setWait(true).setCompactionStrategy(csConfig));
 
-    assertEquals(3, FunctionalTestUtils.countRFiles(c, tableName));
+      assertEquals(3, FunctionalTestUtils.countRFiles(c, tableName));
 
-    c.tableOperations().compact(tableName, new CompactionConfig().setWait(true));
+      c.tableOperations().compact(tableName, new CompactionConfig().setWait(true));
 
-    assertEquals(2, FunctionalTestUtils.countRFiles(c, tableName));
+      assertEquals(2, FunctionalTestUtils.countRFiles(c, tableName));
+    }
   }
 
   @SuppressFBWarnings(value = "PATH_TRAVERSAL_IN", justification = "path provided by test")
@@ -194,77 +200,80 @@ private static File installJar(File destDir, String jarFile) throws IOException
   public void testIterators() throws Exception {
     // test compaction strategy + iterators
 
-    AccumuloClient c = getAccumuloClient();
+    try (AccumuloClient c = getAccumuloClient()) {
 
-    String tableName = getUniqueNames(1)[0];
-    c.tableOperations().create(tableName);
+      String tableName = getUniqueNames(1)[0];
+      c.tableOperations().create(tableName);
 
-    writeFlush(c, tableName, "a");
-    writeFlush(c, tableName, "b");
-    // create a file that starts with A containing rows 'a' and 'b'
-    c.tableOperations().compact(tableName, new CompactionConfig().setWait(true));
+      writeFlush(c, tableName, "a");
+      writeFlush(c, tableName, "b");
+      // create a file that starts with A containing rows 'a' and 'b'
+      c.tableOperations().compact(tableName, new CompactionConfig().setWait(true));
 
-    writeFlush(c, tableName, "c");
-    writeFlush(c, tableName, "d");
+      writeFlush(c, tableName, "c");
+      writeFlush(c, tableName, "d");
 
-    assertEquals(3, FunctionalTestUtils.countRFiles(c, tableName));
+      assertEquals(3, FunctionalTestUtils.countRFiles(c, tableName));
 
-    // drop files that start with A
-    CompactionStrategyConfig csConfig = new CompactionStrategyConfig(
-        TestCompactionStrategy.class.getName());
-    csConfig.setOptions(ImmutableMap.of("inputPrefix", "F"));
+      // drop files that start with A
+      CompactionStrategyConfig csConfig = new CompactionStrategyConfig(
+          TestCompactionStrategy.class.getName());
+      csConfig.setOptions(ImmutableMap.of("inputPrefix", "F"));
 
-    IteratorSetting iterConf = new IteratorSetting(21, "myregex", RegExFilter.class);
-    RegExFilter.setRegexs(iterConf, "a|c", null, null, null, false);
+      IteratorSetting iterConf = new IteratorSetting(21, "myregex", RegExFilter.class);
+      RegExFilter.setRegexs(iterConf, "a|c", null, null, null, false);
 
-    c.tableOperations().compact(tableName, new CompactionConfig().setWait(true)
-        .setCompactionStrategy(csConfig).setIterators(Arrays.asList(iterConf)));
+      c.tableOperations().compact(tableName, new CompactionConfig().setWait(true)
+          .setCompactionStrategy(csConfig).setIterators(Arrays.asList(iterConf)));
 
-    // compaction strategy should only be applied to one file. If its applied to both, then row 'b'
-    // would be dropped by filter.
-    assertEquals(ImmutableSet.of("a", "b", "c"), getRows(c, tableName));
+      // compaction strategy should only be applied to one file. If its applied to both, then row
+      // 'b'
+      // would be dropped by filter.
+      assertEquals(ImmutableSet.of("a", "b", "c"), getRows(c, tableName));
 
-    assertEquals(2, FunctionalTestUtils.countRFiles(c, tableName));
+      assertEquals(2, FunctionalTestUtils.countRFiles(c, tableName));
 
-    c.tableOperations().compact(tableName, new CompactionConfig().setWait(true));
+      c.tableOperations().compact(tableName, new CompactionConfig().setWait(true));
 
-    // ensure that iterator is not applied
-    assertEquals(ImmutableSet.of("a", "b", "c"), getRows(c, tableName));
+      // ensure that iterator is not applied
+      assertEquals(ImmutableSet.of("a", "b", "c"), getRows(c, tableName));
 
-    assertEquals(1, FunctionalTestUtils.countRFiles(c, tableName));
+      assertEquals(1, FunctionalTestUtils.countRFiles(c, tableName));
+    }
   }
 
   @Test
   public void testFileSize() throws Exception {
-    AccumuloClient c = getAccumuloClient();
+    try (AccumuloClient c = getAccumuloClient()) {
 
-    String tableName = getUniqueNames(1)[0];
-    c.tableOperations().create(tableName);
+      String tableName = getUniqueNames(1)[0];
+      c.tableOperations().create(tableName);
 
-    // write random data because its very unlikely it will compress
-    writeRandomValue(c, tableName, 1 << 16);
-    writeRandomValue(c, tableName, 1 << 16);
+      // write random data because its very unlikely it will compress
+      writeRandomValue(c, tableName, 1 << 16);
+      writeRandomValue(c, tableName, 1 << 16);
 
-    writeRandomValue(c, tableName, 1 << 9);
-    writeRandomValue(c, tableName, 1 << 7);
-    writeRandomValue(c, tableName, 1 << 6);
+      writeRandomValue(c, tableName, 1 << 9);
+      writeRandomValue(c, tableName, 1 << 7);
+      writeRandomValue(c, tableName, 1 << 6);
 
-    assertEquals(5, FunctionalTestUtils.countRFiles(c, tableName));
+      assertEquals(5, FunctionalTestUtils.countRFiles(c, tableName));
 
-    CompactionStrategyConfig csConfig = new CompactionStrategyConfig(
-        SizeCompactionStrategy.class.getName());
-    csConfig.setOptions(ImmutableMap.of("size", "" + (1 << 15)));
-    c.tableOperations().compact(tableName,
-        new CompactionConfig().setWait(true).setCompactionStrategy(csConfig));
+      CompactionStrategyConfig csConfig = new CompactionStrategyConfig(
+          SizeCompactionStrategy.class.getName());
+      csConfig.setOptions(ImmutableMap.of("size", "" + (1 << 15)));
+      c.tableOperations().compact(tableName,
+          new CompactionConfig().setWait(true).setCompactionStrategy(csConfig));
 
-    assertEquals(3, FunctionalTestUtils.countRFiles(c, tableName));
+      assertEquals(3, FunctionalTestUtils.countRFiles(c, tableName));
 
-    csConfig = new CompactionStrategyConfig(SizeCompactionStrategy.class.getName());
-    csConfig.setOptions(ImmutableMap.of("size", "" + (1 << 17)));
-    c.tableOperations().compact(tableName,
-        new CompactionConfig().setWait(true).setCompactionStrategy(csConfig));
+      csConfig = new CompactionStrategyConfig(SizeCompactionStrategy.class.getName());
+      csConfig.setOptions(ImmutableMap.of("size", "" + (1 << 17)));
+      c.tableOperations().compact(tableName,
+          new CompactionConfig().setWait(true).setCompactionStrategy(csConfig));
 
-    assertEquals(1, FunctionalTestUtils.countRFiles(c, tableName));
+      assertEquals(1, FunctionalTestUtils.countRFiles(c, tableName));
+    }
 
   }
 
@@ -272,34 +281,35 @@ public void testFileSize() throws Exception {
   public void testConcurrent() throws Exception {
     // two compactions without iterators or strategy should be able to run concurrently
 
-    AccumuloClient c = getAccumuloClient();
+    try (AccumuloClient c = getAccumuloClient()) {
 
-    String tableName = getUniqueNames(1)[0];
-    c.tableOperations().create(tableName);
+      String tableName = getUniqueNames(1)[0];
+      c.tableOperations().create(tableName);
 
-    // write random data because its very unlikely it will compress
-    writeRandomValue(c, tableName, 1 << 16);
-    writeRandomValue(c, tableName, 1 << 16);
+      // write random data because its very unlikely it will compress
+      writeRandomValue(c, tableName, 1 << 16);
+      writeRandomValue(c, tableName, 1 << 16);
 
-    c.tableOperations().compact(tableName, new CompactionConfig().setWait(false));
-    c.tableOperations().compact(tableName, new CompactionConfig().setWait(true));
+      c.tableOperations().compact(tableName, new CompactionConfig().setWait(false));
+      c.tableOperations().compact(tableName, new CompactionConfig().setWait(true));
 
-    assertEquals(1, FunctionalTestUtils.countRFiles(c, tableName));
+      assertEquals(1, FunctionalTestUtils.countRFiles(c, tableName));
 
-    writeRandomValue(c, tableName, 1 << 16);
+      writeRandomValue(c, tableName, 1 << 16);
 
-    IteratorSetting iterConfig = new IteratorSetting(30, SlowIterator.class);
-    SlowIterator.setSleepTime(iterConfig, 1000);
+      IteratorSetting iterConfig = new IteratorSetting(30, SlowIterator.class);
+      SlowIterator.setSleepTime(iterConfig, 1000);
 
-    long t1 = System.currentTimeMillis();
-    c.tableOperations().compact(tableName,
-        new CompactionConfig().setWait(false).setIterators(Arrays.asList(iterConfig)));
-    try {
-      // this compaction should fail because previous one set iterators
-      c.tableOperations().compact(tableName, new CompactionConfig().setWait(true));
-      if (System.currentTimeMillis() - t1 < 2000)
-        fail("Expected compaction to fail because another concurrent compaction set iterators");
-    } catch (AccumuloException e) {}
+      long t1 = System.currentTimeMillis();
+      c.tableOperations().compact(tableName,
+          new CompactionConfig().setWait(false).setIterators(Arrays.asList(iterConfig)));
+      try {
+        // this compaction should fail because previous one set iterators
+        c.tableOperations().compact(tableName, new CompactionConfig().setWait(true));
+        if (System.currentTimeMillis() - t1 < 2000)
+          fail("Expected compaction to fail because another concurrent compaction set iterators");
+      } catch (AccumuloException e) {}
+    }
   }
 
   void writeRandomValue(AccumuloClient c, String tableName, int size) throws Exception {
diff --git a/test/src/main/java/org/apache/accumulo/test/UsersIT.java b/test/src/main/java/org/apache/accumulo/test/UsersIT.java
index 081ee73def..3be15f4f80 100644
--- a/test/src/main/java/org/apache/accumulo/test/UsersIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/UsersIT.java
@@ -35,28 +35,29 @@
   @Test
   public void testCreateExistingUser() throws Exception {
     ClusterUser user0 = getUser(0);
-    AccumuloClient client = getAccumuloClient();
-    Set<String> currentUsers = client.securityOperations().listLocalUsers();
-
-    // Ensure that the user exists
-    if (!currentUsers.contains(user0.getPrincipal())) {
-      PasswordToken token = null;
-      if (!saslEnabled()) {
-        token = new PasswordToken(user0.getPassword());
+    try (AccumuloClient client = getAccumuloClient()) {
+      Set<String> currentUsers = client.securityOperations().listLocalUsers();
+
+      // Ensure that the user exists
+      if (!currentUsers.contains(user0.getPrincipal())) {
+        PasswordToken token = null;
+        if (!saslEnabled()) {
+          token = new PasswordToken(user0.getPassword());
+        }
+        client.securityOperations().createLocalUser(user0.getPrincipal(), token);
       }
-      client.securityOperations().createLocalUser(user0.getPrincipal(), token);
-    }
 
-    try {
-      client.securityOperations().createLocalUser(user0.getPrincipal(),
-          new PasswordToken("better_fail"));
-      fail("Creating a user that already exists should throw an exception");
-    } catch (AccumuloSecurityException e) {
-      assertSame("Expected USER_EXISTS error", SecurityErrorCode.USER_EXISTS,
-          e.getSecurityErrorCode());
-      String msg = e.getMessage();
-      assertTrue("Error message didn't contain principal: '" + msg + "'",
-          msg.contains(user0.getPrincipal()));
+      try {
+        client.securityOperations().createLocalUser(user0.getPrincipal(),
+            new PasswordToken("better_fail"));
+        fail("Creating a user that already exists should throw an exception");
+      } catch (AccumuloSecurityException e) {
+        assertSame("Expected USER_EXISTS error", SecurityErrorCode.USER_EXISTS,
+            e.getSecurityErrorCode());
+        String msg = e.getMessage();
+        assertTrue("Error message didn't contain principal: '" + msg + "'",
+            msg.contains(user0.getPrincipal()));
+      }
     }
   }
 
diff --git a/test/src/main/java/org/apache/accumulo/test/VerifySerialRecoveryIT.java b/test/src/main/java/org/apache/accumulo/test/VerifySerialRecoveryIT.java
index f480ff4d6d..fbcf83ea24 100644
--- a/test/src/main/java/org/apache/accumulo/test/VerifySerialRecoveryIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/VerifySerialRecoveryIT.java
@@ -74,52 +74,54 @@ public void configure(MiniAccumuloConfigImpl cfg, Configuration hadoopCoreSite)
   public void testSerializedRecovery() throws Exception {
     // make a table with many splits
     String tableName = getUniqueNames(1)[0];
-    AccumuloClient c = getClient();
-    c.tableOperations().create(tableName);
-    SortedSet<Text> splits = new TreeSet<>();
-    for (int i = 0; i < 200; i++) {
-      splits.add(new Text(randomHex(8)));
-    }
-    c.tableOperations().addSplits(tableName, splits);
-    // load data to give the recovery something to do
-    BatchWriter bw = c.createBatchWriter(tableName, null);
-    for (int i = 0; i < 50000; i++) {
-      Mutation m = new Mutation(randomHex(8));
-      m.put("", "", "");
-      bw.addMutation(m);
-    }
-    bw.close();
-    // kill the tserver
-    for (ProcessReference ref : getCluster().getProcesses().get(ServerType.TABLET_SERVER))
-      getCluster().killProcess(ServerType.TABLET_SERVER, ref);
-    final Process ts = cluster.exec(TabletServer.class);
+    try (AccumuloClient c = getClient()) {
+      c.tableOperations().create(tableName);
+      SortedSet<Text> splits = new TreeSet<>();
+      for (int i = 0; i < 200; i++) {
+        splits.add(new Text(randomHex(8)));
+      }
+      c.tableOperations().addSplits(tableName, splits);
+      // load data to give the recovery something to do
+      BatchWriter bw = c.createBatchWriter(tableName, null);
+      for (int i = 0; i < 50000; i++) {
+        Mutation m = new Mutation(randomHex(8));
+        m.put("", "", "");
+        bw.addMutation(m);
+      }
+      bw.close();
+      // kill the tserver
+      for (ProcessReference ref : getCluster().getProcesses().get(ServerType.TABLET_SERVER))
+        getCluster().killProcess(ServerType.TABLET_SERVER, ref);
+      final Process ts = cluster.exec(TabletServer.class);
 
-    // wait for recovery
-    Iterators.size(c.createScanner(tableName, Authorizations.EMPTY).iterator());
-    assertEquals(0, cluster.exec(Admin.class, "stopAll").waitFor());
-    ts.waitFor();
-    String result = FunctionalTestUtils.readAll(cluster, TabletServer.class, ts);
-    for (String line : result.split("\n")) {
-      System.out.println(line);
-    }
-    // walk through the output, verifying that only a single normal recovery was running at one time
-    boolean started = false;
-    int recoveries = 0;
-    for (String line : result.split("\n")) {
-      // ignore metadata tables
-      if (line.contains("!0") || line.contains("+r"))
-        continue;
-      if (line.contains("Starting Write-Ahead Log")) {
-        assertFalse(started);
-        started = true;
-        recoveries++;
+      // wait for recovery
+      Iterators.size(c.createScanner(tableName, Authorizations.EMPTY).iterator());
+      assertEquals(0, cluster.exec(Admin.class, "stopAll").waitFor());
+      ts.waitFor();
+      String result = FunctionalTestUtils.readAll(cluster, TabletServer.class, ts);
+      for (String line : result.split("\n")) {
+        System.out.println(line);
       }
-      if (line.contains("Write-Ahead Log recovery complete")) {
-        assertTrue(started);
-        started = false;
+      // walk through the output, verifying that only a single normal recovery was running at one
+      // time
+      boolean started = false;
+      int recoveries = 0;
+      for (String line : result.split("\n")) {
+        // ignore metadata tables
+        if (line.contains("!0") || line.contains("+r"))
+          continue;
+        if (line.contains("Starting Write-Ahead Log")) {
+          assertFalse(started);
+          started = true;
+          recoveries++;
+        }
+        if (line.contains("Write-Ahead Log recovery complete")) {
+          assertTrue(started);
+          started = false;
+        }
       }
+      assertFalse(started);
+      assertTrue(recoveries > 0);
     }
-    assertFalse(started);
-    assertTrue(recoveries > 0);
   }
 }
diff --git a/test/src/main/java/org/apache/accumulo/test/VolumeChooserFailureIT.java b/test/src/main/java/org/apache/accumulo/test/VolumeChooserFailureIT.java
index aae3676595..b503f02751 100644
--- a/test/src/main/java/org/apache/accumulo/test/VolumeChooserFailureIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/VolumeChooserFailureIT.java
@@ -117,18 +117,19 @@ public void missingVolumePreferredVolumeChooser() throws Exception {
     log.info("Starting missingVolumePreferredVolumeChooser");
 
     // Create namespace
-    AccumuloClient accumuloClient = getClient();
-    accumuloClient.namespaceOperations().create(namespace1);
-
-    // Set properties on the namespace
-    accumuloClient.namespaceOperations().setProperty(namespace1,
-        PerTableVolumeChooser.TABLE_VOLUME_CHOOSER, PreferredVolumeChooser.class.getName());
-    // deliberately do not set preferred volumes
-
-    // Create table1 on namespace1 (will fail)
-    String tableName = namespace1 + ".1";
-    thrown.expect(AccumuloException.class);
-    accumuloClient.tableOperations().create(tableName);
+    try (AccumuloClient accumuloClient = getClient()) {
+      accumuloClient.namespaceOperations().create(namespace1);
+
+      // Set properties on the namespace
+      accumuloClient.namespaceOperations().setProperty(namespace1,
+          PerTableVolumeChooser.TABLE_VOLUME_CHOOSER, PreferredVolumeChooser.class.getName());
+      // deliberately do not set preferred volumes
+
+      // Create table1 on namespace1 (will fail)
+      String tableName = namespace1 + ".1";
+      thrown.expect(AccumuloException.class);
+      accumuloClient.tableOperations().create(tableName);
+    }
   }
 
   // Test that uses one table with 10 split points each. It uses the PreferredVolumeChooser, but
@@ -139,24 +140,25 @@ public void notInstancePreferredVolumeChooser() throws Exception {
     log.info("Starting notInstancePreferredVolumeChooser");
 
     // Create namespace
-    AccumuloClient accumuloClient = getClient();
-    accumuloClient.namespaceOperations().create(namespace1);
-
-    // Set properties on the namespace
-    String propertyName = PerTableVolumeChooser.TABLE_VOLUME_CHOOSER;
-    String volume = PreferredVolumeChooser.class.getName();
-    accumuloClient.namespaceOperations().setProperty(namespace1, propertyName, volume);
-
-    // set to v3 which is not included in the list of instance volumes, so it should go to the
-    // system default preferred volumes
-    propertyName = PreferredVolumeChooser.TABLE_PREFERRED_VOLUMES;
-    volume = v3.toString();
-    accumuloClient.namespaceOperations().setProperty(namespace1, propertyName, volume);
-
-    // Create table1 on namespace1 (will fail)
-    String tableName = namespace1 + ".1";
-    thrown.expect(AccumuloException.class);
-    accumuloClient.tableOperations().create(tableName);
+    try (AccumuloClient accumuloClient = getClient()) {
+      accumuloClient.namespaceOperations().create(namespace1);
+
+      // Set properties on the namespace
+      String propertyName = PerTableVolumeChooser.TABLE_VOLUME_CHOOSER;
+      String volume = PreferredVolumeChooser.class.getName();
+      accumuloClient.namespaceOperations().setProperty(namespace1, propertyName, volume);
+
+      // set to v3 which is not included in the list of instance volumes, so it should go to the
+      // system default preferred volumes
+      propertyName = PreferredVolumeChooser.TABLE_PREFERRED_VOLUMES;
+      volume = v3.toString();
+      accumuloClient.namespaceOperations().setProperty(namespace1, propertyName, volume);
+
+      // Create table1 on namespace1 (will fail)
+      String tableName = namespace1 + ".1";
+      thrown.expect(AccumuloException.class);
+      accumuloClient.tableOperations().create(tableName);
+    }
   }
 
 }
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 8548208bf7..2da10806ce 100644
--- a/test/src/main/java/org/apache/accumulo/test/VolumeChooserIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/VolumeChooserIT.java
@@ -259,28 +259,29 @@ public void twoTablesPreferredVolumeChooser() throws Exception {
     log.info("Starting twoTablesPreferredVolumeChooser");
 
     // Create namespace
-    AccumuloClient accumuloClient = getClient();
-    accumuloClient.namespaceOperations().create(namespace1);
-
-    // Set properties on the namespace
-    // namespace 1 -> v2
-    accumuloClient.namespaceOperations().setProperty(namespace1,
-        PerTableVolumeChooser.TABLE_VOLUME_CHOOSER, PreferredVolumeChooser.class.getName());
-    accumuloClient.namespaceOperations().setProperty(namespace1,
-        PreferredVolumeChooser.TABLE_PREFERRED_VOLUMES, v2.toString());
-
-    // Create table1 on namespace1
-    verifyVolumesForWritesToNewTable(accumuloClient, namespace1, v2.toString());
-
-    accumuloClient.namespaceOperations().create(namespace2);
-    // Set properties on the namespace
-    accumuloClient.namespaceOperations().setProperty(namespace2,
-        PerTableVolumeChooser.TABLE_VOLUME_CHOOSER, PreferredVolumeChooser.class.getName());
-    accumuloClient.namespaceOperations().setProperty(namespace2,
-        PreferredVolumeChooser.TABLE_PREFERRED_VOLUMES, v1.toString());
-
-    // Create table2 on namespace2
-    verifyVolumesForWritesToNewTable(accumuloClient, namespace2, v1.toString());
+    try (AccumuloClient accumuloClient = getClient()) {
+      accumuloClient.namespaceOperations().create(namespace1);
+
+      // Set properties on the namespace
+      // namespace 1 -> v2
+      accumuloClient.namespaceOperations().setProperty(namespace1,
+          PerTableVolumeChooser.TABLE_VOLUME_CHOOSER, PreferredVolumeChooser.class.getName());
+      accumuloClient.namespaceOperations().setProperty(namespace1,
+          PreferredVolumeChooser.TABLE_PREFERRED_VOLUMES, v2.toString());
+
+      // Create table1 on namespace1
+      verifyVolumesForWritesToNewTable(accumuloClient, namespace1, v2.toString());
+
+      accumuloClient.namespaceOperations().create(namespace2);
+      // Set properties on the namespace
+      accumuloClient.namespaceOperations().setProperty(namespace2,
+          PerTableVolumeChooser.TABLE_VOLUME_CHOOSER, PreferredVolumeChooser.class.getName());
+      accumuloClient.namespaceOperations().setProperty(namespace2,
+          PreferredVolumeChooser.TABLE_PREFERRED_VOLUMES, v1.toString());
+
+      // Create table2 on namespace2
+      verifyVolumesForWritesToNewTable(accumuloClient, namespace2, v1.toString());
+    }
   }
 
   // Test that uses two tables with 10 split points each. They each use the RandomVolumeChooser to
@@ -290,45 +291,47 @@ public void twoTablesRandomVolumeChooser() throws Exception {
     log.info("Starting twoTablesRandomVolumeChooser()");
 
     // Create namespace
-    AccumuloClient accumuloClient = getClient();
-    accumuloClient.namespaceOperations().create(namespace1);
-
-    // Set properties on the namespace
-    accumuloClient.namespaceOperations().setProperty(namespace1,
-        PerTableVolumeChooser.TABLE_VOLUME_CHOOSER, RandomVolumeChooser.class.getName());
-
-    // Create table1 on namespace1
-    String tableName = namespace1 + ".1";
-    accumuloClient.tableOperations().create(tableName);
-    Table.ID tableID = Table.ID.of(accumuloClient.tableOperations().tableIdMap().get(tableName));
-
-    // Add 10 splits to the table
-    addSplits(accumuloClient, tableName);
-    // Write some data to the table
-    writeAndReadData(accumuloClient, tableName);
-    // Verify the new files are written to the Volumes specified
-
-    verifyVolumes(accumuloClient, tableName, TabletsSection.getRange(tableID),
-        v1 + "," + v2 + "," + v4);
-
-    accumuloClient.namespaceOperations().create(namespace2);
-
-    // Set properties on the namespace
-    accumuloClient.namespaceOperations().setProperty(namespace2,
-        PerTableVolumeChooser.TABLE_VOLUME_CHOOSER, RandomVolumeChooser.class.getName());
-
-    // Create table2 on namespace2
-    String tableName2 = namespace2 + ".1";
-    accumuloClient.tableOperations().create(tableName2);
-    Table.ID tableID2 = Table.ID.of(accumuloClient.tableOperations().tableIdMap().get(tableName2));
-
-    // / Add 10 splits to the table
-    addSplits(accumuloClient, tableName2);
-    // Write some data to the table
-    writeAndReadData(accumuloClient, tableName2);
-    // Verify the new files are written to the Volumes specified
-    verifyVolumes(accumuloClient, tableName2, TabletsSection.getRange(tableID2),
-        v1 + "," + v2 + "," + v4);
+    try (AccumuloClient accumuloClient = getClient()) {
+      accumuloClient.namespaceOperations().create(namespace1);
+
+      // Set properties on the namespace
+      accumuloClient.namespaceOperations().setProperty(namespace1,
+          PerTableVolumeChooser.TABLE_VOLUME_CHOOSER, RandomVolumeChooser.class.getName());
+
+      // Create table1 on namespace1
+      String tableName = namespace1 + ".1";
+      accumuloClient.tableOperations().create(tableName);
+      Table.ID tableID = Table.ID.of(accumuloClient.tableOperations().tableIdMap().get(tableName));
+
+      // Add 10 splits to the table
+      addSplits(accumuloClient, tableName);
+      // Write some data to the table
+      writeAndReadData(accumuloClient, tableName);
+      // Verify the new files are written to the Volumes specified
+
+      verifyVolumes(accumuloClient, tableName, TabletsSection.getRange(tableID),
+          v1 + "," + v2 + "," + v4);
+
+      accumuloClient.namespaceOperations().create(namespace2);
+
+      // Set properties on the namespace
+      accumuloClient.namespaceOperations().setProperty(namespace2,
+          PerTableVolumeChooser.TABLE_VOLUME_CHOOSER, RandomVolumeChooser.class.getName());
+
+      // Create table2 on namespace2
+      String tableName2 = namespace2 + ".1";
+      accumuloClient.tableOperations().create(tableName2);
+      Table.ID tableID2 = Table.ID
+          .of(accumuloClient.tableOperations().tableIdMap().get(tableName2));
+
+      // / Add 10 splits to the table
+      addSplits(accumuloClient, tableName2);
+      // Write some data to the table
+      writeAndReadData(accumuloClient, tableName2);
+      // Verify the new files are written to the Volumes specified
+      verifyVolumes(accumuloClient, tableName2, TabletsSection.getRange(tableID2),
+          v1 + "," + v2 + "," + v4);
+    }
   }
 
   // Test that uses two tables with 10 split points each. The first uses the RandomVolumeChooser and
@@ -339,49 +342,52 @@ public void twoTablesDiffChoosers() throws Exception {
     log.info("Starting twoTablesDiffChoosers");
 
     // Create namespace
-    AccumuloClient accumuloClient = getClient();
-    accumuloClient.namespaceOperations().create(namespace1);
+    try (AccumuloClient accumuloClient = getClient()) {
+      accumuloClient.namespaceOperations().create(namespace1);
 
-    // Set properties on the namespace
-    accumuloClient.namespaceOperations().setProperty(namespace1,
-        PerTableVolumeChooser.TABLE_VOLUME_CHOOSER, RandomVolumeChooser.class.getName());
+      // Set properties on the namespace
+      accumuloClient.namespaceOperations().setProperty(namespace1,
+          PerTableVolumeChooser.TABLE_VOLUME_CHOOSER, RandomVolumeChooser.class.getName());
 
-    // Create table1 on namespace1
-    verifyVolumesForWritesToNewTable(accumuloClient, namespace1, v1 + "," + v2 + "," + v4);
-    accumuloClient.namespaceOperations().create(namespace2);
+      // Create table1 on namespace1
+      verifyVolumesForWritesToNewTable(accumuloClient, namespace1, v1 + "," + v2 + "," + v4);
+      accumuloClient.namespaceOperations().create(namespace2);
 
-    accumuloClient.namespaceOperations().setProperty(namespace2,
-        PerTableVolumeChooser.TABLE_VOLUME_CHOOSER, PreferredVolumeChooser.class.getName());
-    accumuloClient.namespaceOperations().setProperty(namespace2,
-        PreferredVolumeChooser.TABLE_PREFERRED_VOLUMES, v1.toString());
+      accumuloClient.namespaceOperations().setProperty(namespace2,
+          PerTableVolumeChooser.TABLE_VOLUME_CHOOSER, PreferredVolumeChooser.class.getName());
+      accumuloClient.namespaceOperations().setProperty(namespace2,
+          PreferredVolumeChooser.TABLE_PREFERRED_VOLUMES, v1.toString());
 
-    // Create table2 on namespace2
-    verifyVolumesForWritesToNewTable(accumuloClient, namespace2, v1.toString());
+      // Create table2 on namespace2
+      verifyVolumesForWritesToNewTable(accumuloClient, namespace2, v1.toString());
+    }
   }
 
   @Test
   public void includeSpecialVolumeForTable() throws Exception {
     log.info("Starting includeSpecialVolumeForTable");
-    AccumuloClient accumuloClient = getClient();
+    try (AccumuloClient accumuloClient = getClient()) {
 
-    // the following table will be configured to go to the excluded volume
-    String configuredVolumes = v4.toString();
-    configureNamespace(accumuloClient, PreferredVolumeChooser.class.getName(), configuredVolumes,
-        namespace2);
-    verifyVolumesForWritesToNewTable(accumuloClient, namespace2, configuredVolumes);
+      // the following table will be configured to go to the excluded volume
+      String configuredVolumes = v4.toString();
+      configureNamespace(accumuloClient, PreferredVolumeChooser.class.getName(), configuredVolumes,
+          namespace2);
+      verifyVolumesForWritesToNewTable(accumuloClient, namespace2, configuredVolumes);
+    }
   }
 
   @Test
   public void waLogsSentToConfiguredVolumes() throws Exception {
     log.info("Starting waLogsSentToConfiguredVolumes");
 
-    AccumuloClient accumuloClient = getClient();
-    String tableName = "anotherTable";
-    accumuloClient.tableOperations().create(tableName);
+    try (AccumuloClient accumuloClient = getClient()) {
+      String tableName = "anotherTable";
+      accumuloClient.tableOperations().create(tableName);
 
-    VolumeChooserIT.addSplits(accumuloClient, tableName);
-    VolumeChooserIT.writeDataToTable(accumuloClient, tableName);
-    // should only go to v2 as per configuration in configure()
-    VolumeChooserIT.verifyWaLogVolumes(accumuloClient, new Range(), v2.toString());
+      VolumeChooserIT.addSplits(accumuloClient, tableName);
+      VolumeChooserIT.writeDataToTable(accumuloClient, tableName);
+      // should only go to v2 as per configuration in configure()
+      VolumeChooserIT.verifyWaLogVolumes(accumuloClient, new Range(), v2.toString());
+    }
   }
 }
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 67446e7c7b..f45dd8c50d 100644
--- a/test/src/main/java/org/apache/accumulo/test/VolumeIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/VolumeIT.java
@@ -122,50 +122,52 @@ public void configure(MiniAccumuloConfigImpl cfg, Configuration hadoopCoreSite)
   @Test
   public void test() throws Exception {
     // create a table
-    AccumuloClient accumuloClient = getClient();
-    String tableName = getUniqueNames(1)[0];
-    accumuloClient.tableOperations().create(tableName);
-    SortedSet<Text> partitions = new TreeSet<>();
-    // with some splits
-    for (String s : "d,m,t".split(","))
-      partitions.add(new Text(s));
-    accumuloClient.tableOperations().addSplits(tableName, partitions);
-    // scribble over the splits
-    BatchWriter bw = accumuloClient.createBatchWriter(tableName, new BatchWriterConfig());
-    String[] rows = "a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z".split(",");
-    for (String s : rows) {
-      Mutation m = new Mutation(new Text(s));
-      m.put(EMPTY, EMPTY, EMPTY_VALUE);
-      bw.addMutation(m);
-    }
-    bw.close();
-    // write the data to disk, read it back
-    accumuloClient.tableOperations().flush(tableName, null, null, true);
-    try (Scanner scanner = accumuloClient.createScanner(tableName, Authorizations.EMPTY)) {
-      int i = 0;
-      for (Entry<Key,Value> entry : scanner) {
-        assertEquals(rows[i++], entry.getKey().getRow().toString());
+    try (AccumuloClient accumuloClient = getClient()) {
+      String tableName = getUniqueNames(1)[0];
+      accumuloClient.tableOperations().create(tableName);
+      SortedSet<Text> partitions = new TreeSet<>();
+      // with some splits
+      for (String s : "d,m,t".split(","))
+        partitions.add(new Text(s));
+      accumuloClient.tableOperations().addSplits(tableName, partitions);
+      // scribble over the splits
+      BatchWriter bw = accumuloClient.createBatchWriter(tableName, new BatchWriterConfig());
+      String[] rows = "a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z".split(",");
+      for (String s : rows) {
+        Mutation m = new Mutation(new Text(s));
+        m.put(EMPTY, EMPTY, EMPTY_VALUE);
+        bw.addMutation(m);
       }
-    }
-    // verify the new files are written to the different volumes
-    try (Scanner scanner = accumuloClient.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++;
+      bw.close();
+      // write the data to disk, read it back
+      accumuloClient.tableOperations().flush(tableName, null, null, true);
+      try (Scanner scanner = accumuloClient.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
+      try (Scanner scanner = accumuloClient.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 = accumuloClient.tableOperations()
+            .getDiskUsage(Collections.singleton(tableName));
+        assertEquals(1, diskUsage.size());
+        long usage = diskUsage.get(0).getUsage();
+        log.debug("usage {}", usage);
+        assertTrue(usage > 700 && usage < 900);
       }
-      assertEquals(4, fileCount);
-      List<DiskUsage> diskUsage = accumuloClient.tableOperations()
-          .getDiskUsage(Collections.singleton(tableName));
-      assertEquals(1, diskUsage.size());
-      long usage = diskUsage.get(0).getUsage();
-      log.debug("usage {}", usage);
-      assertTrue(usage > 700 && usage < 900);
     }
   }
 
@@ -191,130 +193,133 @@ public void testRelativePaths() throws Exception {
 
     List<String> expected = new ArrayList<>();
 
-    AccumuloClient accumuloClient = getClient();
-    String tableName = getUniqueNames(1)[0];
-    accumuloClient.tableOperations().create(tableName,
-        new NewTableConfiguration().withoutDefaultIterators());
-
-    Table.ID tableId = Table.ID.of(accumuloClient.tableOperations().tableIdMap().get(tableName));
-
-    SortedSet<Text> partitions = new TreeSet<>();
-    // with some splits
-    for (String s : "c,g,k,p,s,v".split(","))
-      partitions.add(new Text(s));
-
-    accumuloClient.tableOperations().addSplits(tableName, partitions);
+    try (AccumuloClient accumuloClient = getClient()) {
+      String tableName = getUniqueNames(1)[0];
+      accumuloClient.tableOperations().create(tableName,
+          new NewTableConfiguration().withoutDefaultIterators());
 
-    BatchWriter bw = accumuloClient.createBatchWriter(tableName, new BatchWriterConfig());
+      Table.ID tableId = Table.ID.of(accumuloClient.tableOperations().tableIdMap().get(tableName));
 
-    // create two files in each tablet
+      SortedSet<Text> partitions = new TreeSet<>();
+      // with some splits
+      for (String s : "c,g,k,p,s,v".split(","))
+        partitions.add(new Text(s));
 
-    String[] rows = "a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z".split(",");
-    for (String s : rows) {
-      Mutation m = new Mutation(s);
-      m.put("cf1", "cq1", "1");
-      bw.addMutation(m);
-      expected.add(s + ":cf1:cq1:1");
-    }
+      accumuloClient.tableOperations().addSplits(tableName, partitions);
 
-    bw.flush();
-    accumuloClient.tableOperations().flush(tableName, null, null, true);
-
-    for (String s : rows) {
-      Mutation m = new Mutation(s);
-      m.put("cf1", "cq1", "2");
-      bw.addMutation(m);
-      expected.add(s + ":cf1:cq1:2");
-    }
+      BatchWriter bw = accumuloClient.createBatchWriter(tableName, new BatchWriterConfig());
 
-    bw.close();
-    accumuloClient.tableOperations().flush(tableName, null, null, true);
+      // create two files in each tablet
 
-    verifyData(expected, accumuloClient.createScanner(tableName, Authorizations.EMPTY));
+      String[] rows = "a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z".split(",");
+      for (String s : rows) {
+        Mutation m = new Mutation(s);
+        m.put("cf1", "cq1", "1");
+        bw.addMutation(m);
+        expected.add(s + ":cf1:cq1:1");
+      }
 
-    accumuloClient.tableOperations().offline(tableName, true);
+      bw.flush();
+      accumuloClient.tableOperations().flush(tableName, null, null, true);
 
-    accumuloClient.securityOperations().grantTablePermission("root", MetadataTable.NAME,
-        TablePermission.WRITE);
+      for (String s : rows) {
+        Mutation m = new Mutation(s);
+        m.put("cf1", "cq1", "2");
+        bw.addMutation(m);
+        expected.add(s + ":cf1:cq1:2");
+      }
 
-    try (Scanner metaScanner = accumuloClient.createScanner(MetadataTable.NAME,
-        Authorizations.EMPTY)) {
-      metaScanner.fetchColumnFamily(MetadataSchema.TabletsSection.DataFileColumnFamily.NAME);
-      metaScanner.setRange(new KeyExtent(tableId, null, null).toMetadataRange());
+      bw.close();
+      accumuloClient.tableOperations().flush(tableName, null, null, true);
 
-      BatchWriter mbw = accumuloClient.createBatchWriter(MetadataTable.NAME,
-          new BatchWriterConfig());
+      verifyData(expected, accumuloClient.createScanner(tableName, Authorizations.EMPTY));
 
-      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);
+      accumuloClient.tableOperations().offline(tableName, true);
+
+      accumuloClient.securityOperations().grantTablePermission("root", MetadataTable.NAME,
+          TablePermission.WRITE);
+
+      try (Scanner metaScanner = accumuloClient.createScanner(MetadataTable.NAME,
+          Authorizations.EMPTY)) {
+        metaScanner.fetchColumnFamily(MetadataSchema.TabletsSection.DataFileColumnFamily.NAME);
+        metaScanner.setRange(new KeyExtent(tableId, null, null).toMetadataRange());
+
+        BatchWriter mbw = accumuloClient.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();
 
-      accumuloClient.tableOperations().online(tableName, true);
+        accumuloClient.tableOperations().online(tableName, true);
 
-      verifyData(expected, accumuloClient.createScanner(tableName, Authorizations.EMPTY));
+        verifyData(expected, accumuloClient.createScanner(tableName, Authorizations.EMPTY));
 
-      accumuloClient.tableOperations().compact(tableName, null, null, true, true);
+        accumuloClient.tableOperations().compact(tableName, null, null, true, true);
 
-      verifyData(expected, accumuloClient.createScanner(tableName, Authorizations.EMPTY));
+        verifyData(expected, accumuloClient.createScanner(tableName, Authorizations.EMPTY));
 
-      for (Entry<Key,Value> entry : metaScanner) {
-        String cq = entry.getKey().getColumnQualifier().toString();
-        Path path = new Path(cq);
-        assertTrue("relative path not deleted " + path, path.depth() > 2);
+        for (Entry<Key,Value> entry : metaScanner) {
+          String cq = entry.getKey().getColumnQualifier().toString();
+          Path path = new Path(cq);
+          assertTrue("relative path not deleted " + path, path.depth() > 2);
+        }
       }
     }
   }
 
   @Test
   public void testAddVolumes() throws Exception {
+    try (AccumuloClient client = getClient()) {
+      String[] tableNames = getUniqueNames(2);
 
-    String[] tableNames = getUniqueNames(2);
+      // grab this before shutting down cluster
+      String uuid = client.getInstanceID();
 
-    // grab this before shutting down cluster
-    String uuid = getClient().getInstanceID();
+      verifyVolumesUsed(client, tableNames[0], false, v1, v2);
 
-    verifyVolumesUsed(tableNames[0], false, v1, v2);
-
-    assertEquals(0, cluster.exec(Admin.class, "stopAll").waitFor());
-    cluster.stop();
+      assertEquals(0, cluster.exec(Admin.class, "stopAll").waitFor());
+      cluster.stop();
 
-    PropertiesConfiguration conf = new PropertiesConfiguration();
-    conf.load(cluster.getAccumuloPropertiesPath());
+      PropertiesConfiguration conf = new PropertiesConfiguration();
+      conf.load(cluster.getAccumuloPropertiesPath());
 
-    File v3f = new File(volDirBase, "v3");
-    assertTrue(v3f.mkdir() || v3f.isDirectory());
-    Path v3 = new Path("file://" + v3f.getAbsolutePath());
+      File v3f = new File(volDirBase, "v3");
+      assertTrue(v3f.mkdir() || v3f.isDirectory());
+      Path v3 = new Path("file://" + v3f.getAbsolutePath());
 
-    conf.setProperty(Property.INSTANCE_VOLUMES.getKey(), v1 + "," + v2 + "," + v3);
-    conf.save(cluster.getAccumuloPropertiesPath());
+      conf.setProperty(Property.INSTANCE_VOLUMES.getKey(), v1 + "," + v2 + "," + v3);
+      conf.save(cluster.getAccumuloPropertiesPath());
 
-    // initialize volume
-    assertEquals(0, cluster.exec(Initialize.class, "--add-volumes").waitFor());
+      // initialize volume
+      assertEquals(0, cluster.exec(Initialize.class, "--add-volumes").waitFor());
 
-    // check that all volumes are initialized
-    for (Path volumePath : Arrays.asList(v1, v2, v3)) {
-      FileSystem fs = volumePath.getFileSystem(CachedConfiguration.getInstance());
-      Path vp = new Path(volumePath, ServerConstants.INSTANCE_ID_DIR);
-      FileStatus[] iids = fs.listStatus(vp);
-      assertEquals(1, iids.length);
-      assertEquals(uuid, iids[0].getPath().getName());
-    }
+      // check that all volumes are initialized
+      for (Path volumePath : Arrays.asList(v1, v2, v3)) {
+        FileSystem fs = volumePath.getFileSystem(CachedConfiguration.getInstance());
+        Path vp = new Path(volumePath, ServerConstants.INSTANCE_ID_DIR);
+        FileStatus[] iids = fs.listStatus(vp);
+        assertEquals(1, iids.length);
+        assertEquals(uuid, iids[0].getPath().getName());
+      }
 
-    // start cluster and verify that new volume is used
-    cluster.start();
+      // start cluster and verify that new volume is used
+      cluster.start();
 
-    verifyVolumesUsed(tableNames[1], false, v1, v2, v3);
+      verifyVolumesUsed(client, tableNames[1], false, v1, v2, v3);
+    }
   }
 
   @Test
@@ -323,50 +328,53 @@ public void testNonConfiguredVolumes() throws Exception {
     String[] tableNames = getUniqueNames(2);
 
     // grab this before shutting down cluster
-    String uuid = getClient().getInstanceID();
+    try (AccumuloClient client = getClient()) {
+      String uuid = client.getInstanceID();
 
-    verifyVolumesUsed(tableNames[0], false, v1, v2);
+      verifyVolumesUsed(client, tableNames[0], false, v1, v2);
 
-    assertEquals(0, cluster.exec(Admin.class, "stopAll").waitFor());
-    cluster.stop();
+      assertEquals(0, cluster.exec(Admin.class, "stopAll").waitFor());
+      cluster.stop();
 
-    PropertiesConfiguration conf = new PropertiesConfiguration();
-    conf.load(cluster.getAccumuloPropertiesPath());
+      PropertiesConfiguration conf = new PropertiesConfiguration();
+      conf.load(cluster.getAccumuloPropertiesPath());
 
-    File v3f = new File(volDirBase, "v3");
-    assertTrue(v3f.mkdir() || v3f.isDirectory());
-    Path v3 = new Path("file://" + v3f.getAbsolutePath());
+      File v3f = new File(volDirBase, "v3");
+      assertTrue(v3f.mkdir() || v3f.isDirectory());
+      Path v3 = new Path("file://" + v3f.getAbsolutePath());
 
-    conf.setProperty(Property.INSTANCE_VOLUMES.getKey(), v2 + "," + v3);
-    conf.save(cluster.getAccumuloPropertiesPath());
+      conf.setProperty(Property.INSTANCE_VOLUMES.getKey(), v2 + "," + v3);
+      conf.save(cluster.getAccumuloPropertiesPath());
 
-    // initialize volume
-    assertEquals(0, cluster.exec(Initialize.class, "--add-volumes").waitFor());
+      // initialize volume
+      assertEquals(0, cluster.exec(Initialize.class, "--add-volumes").waitFor());
 
-    // check that all volumes are initialized
-    for (Path volumePath : Arrays.asList(v1, v2, v3)) {
-      FileSystem fs = volumePath.getFileSystem(CachedConfiguration.getInstance());
-      Path vp = new Path(volumePath, ServerConstants.INSTANCE_ID_DIR);
-      FileStatus[] iids = fs.listStatus(vp);
-      assertEquals(1, iids.length);
-      assertEquals(uuid, iids[0].getPath().getName());
-    }
+      // check that all volumes are initialized
+      for (Path volumePath : Arrays.asList(v1, v2, v3)) {
+        FileSystem fs = volumePath.getFileSystem(CachedConfiguration.getInstance());
+        Path vp = new Path(volumePath, ServerConstants.INSTANCE_ID_DIR);
+        FileStatus[] iids = fs.listStatus(vp);
+        assertEquals(1, iids.length);
+        assertEquals(uuid, iids[0].getPath().getName());
+      }
 
-    // start cluster and verify that new volume is used
-    cluster.start();
+      // start cluster and verify that new volume is used
+      cluster.start();
 
-    // Make sure we can still read the tables (tableNames[0] is very likely to have a file still on
-    // v1)
-    List<String> expected = new ArrayList<>();
-    for (int i = 0; i < 100; i++) {
-      String row = String.format("%06d", i * 100 + 3);
-      expected.add(row + ":cf1:cq1:1");
-    }
+      // Make sure we can still read the tables (tableNames[0] is very likely to have a file still
+      // on
+      // v1)
+      List<String> expected = new ArrayList<>();
+      for (int i = 0; i < 100; i++) {
+        String row = String.format("%06d", i * 100 + 3);
+        expected.add(row + ":cf1:cq1:1");
+      }
 
-    verifyData(expected, getClient().createScanner(tableNames[0], Authorizations.EMPTY));
+      verifyData(expected, client.createScanner(tableNames[0], Authorizations.EMPTY));
 
-    // v1 should not have any data for tableNames[1]
-    verifyVolumesUsed(tableNames[1], false, v2, v3);
+      // v1 should not have any data for tableNames[1]
+      verifyVolumesUsed(client, tableNames[1], false, v2, v3);
+    }
   }
 
   private void writeData(String tableName, AccumuloClient client)
@@ -391,10 +399,8 @@ private void writeData(String tableName, AccumuloClient client)
     bw.close();
   }
 
-  private void verifyVolumesUsed(String tableName, boolean shouldExist, Path... paths)
-      throws Exception {
-
-    AccumuloClient client = getClient();
+  private void verifyVolumesUsed(AccumuloClient client, String tableName, boolean shouldExist,
+      Path... paths) throws Exception {
 
     List<String> expected = new ArrayList<>();
     for (int i = 0; i < 100; i++) {
@@ -483,48 +489,48 @@ private void verifyVolumesUsed(String tableName, boolean shouldExist, Path... pa
 
   @Test
   public void testRemoveVolumes() throws Exception {
-    String[] tableNames = getUniqueNames(2);
+    try (AccumuloClient client = getClient()) {
+      String[] tableNames = getUniqueNames(2);
 
-    verifyVolumesUsed(tableNames[0], false, v1, v2);
+      verifyVolumesUsed(client, tableNames[0], false, v1, v2);
 
-    assertEquals(0, cluster.exec(Admin.class, "stopAll").waitFor());
-    cluster.stop();
+      assertEquals(0, cluster.exec(Admin.class, "stopAll").waitFor());
+      cluster.stop();
 
-    PropertiesConfiguration conf = new PropertiesConfiguration();
-    conf.load(cluster.getAccumuloPropertiesPath());
-    conf.setProperty(Property.INSTANCE_VOLUMES.getKey(), v2.toString());
-    conf.save(cluster.getAccumuloPropertiesPath());
+      PropertiesConfiguration conf = new PropertiesConfiguration();
+      conf.load(cluster.getAccumuloPropertiesPath());
+      conf.setProperty(Property.INSTANCE_VOLUMES.getKey(), v2.toString());
+      conf.save(cluster.getAccumuloPropertiesPath());
 
-    // start cluster and verify that volume was decommissioned
-    cluster.start();
+      // start cluster and verify that volume was decommissioned
+      cluster.start();
 
-    AccumuloClient client = cluster.getAccumuloClient("root", new PasswordToken(ROOT_PASSWORD));
-    client.tableOperations().compact(tableNames[0], null, null, true, true);
+      client.tableOperations().compact(tableNames[0], null, null, true, true);
 
-    verifyVolumesUsed(tableNames[0], true, v2);
+      verifyVolumesUsed(client, tableNames[0], true, v2);
 
-    // check that root tablet is not on volume 1
-    ZooReader zreader = new ZooReader(cluster.getZooKeepers(), 30000);
-    String zpath = ZooUtil.getRoot(getClient().getInstanceID()) + RootTable.ZROOT_TABLET_PATH;
-    String rootTabletDir = new String(zreader.getData(zpath, false, null), UTF_8);
-    assertTrue(rootTabletDir.startsWith(v2.toString()));
+      // check that root tablet is not on volume 1
+      ZooReader zreader = new ZooReader(cluster.getZooKeepers(), 30000);
+      String zpath = ZooUtil.getRoot(client.getInstanceID()) + RootTable.ZROOT_TABLET_PATH;
+      String rootTabletDir = new String(zreader.getData(zpath, false, null), UTF_8);
+      assertTrue(rootTabletDir.startsWith(v2.toString()));
 
-    client.tableOperations().clone(tableNames[0], tableNames[1], true, new HashMap<>(),
-        new HashSet<>());
+      client.tableOperations().clone(tableNames[0], tableNames[1], true, new HashMap<>(),
+          new HashSet<>());
 
-    client.tableOperations().flush(MetadataTable.NAME, null, null, true);
-    client.tableOperations().flush(RootTable.NAME, null, null, true);
-
-    verifyVolumesUsed(tableNames[0], true, v2);
-    verifyVolumesUsed(tableNames[1], true, v2);
+      client.tableOperations().flush(MetadataTable.NAME, null, null, true);
+      client.tableOperations().flush(RootTable.NAME, null, null, true);
 
+      verifyVolumesUsed(client, tableNames[0], true, v2);
+      verifyVolumesUsed(client, tableNames[1], true, v2);
+    }
   }
 
   @SuppressFBWarnings(value = "PATH_TRAVERSAL_IN", justification = "paths provided by test")
-  private void testReplaceVolume(boolean cleanShutdown) throws Exception {
+  private void testReplaceVolume(AccumuloClient client, boolean cleanShutdown) throws Exception {
     String[] tableNames = getUniqueNames(3);
 
-    verifyVolumesUsed(tableNames[0], false, v1, v2);
+    verifyVolumesUsed(client, tableNames[0], false, v1, v2);
 
     // write to 2nd table, but do not flush data to disk before shutdown
     writeData(tableNames[1], cluster.getAccumuloClient("root", new PasswordToken(ROOT_PASSWORD)));
@@ -554,40 +560,44 @@ private void testReplaceVolume(boolean cleanShutdown) throws Exception {
     // start cluster and verify that volumes were replaced
     cluster.start();
 
-    verifyVolumesUsed(tableNames[0], true, v8, v9);
-    verifyVolumesUsed(tableNames[1], true, v8, v9);
+    verifyVolumesUsed(client, tableNames[0], true, v8, v9);
+    verifyVolumesUsed(client, tableNames[1], true, v8, v9);
 
     // verify writes to new dir
-    getClient().tableOperations().compact(tableNames[0], null, null, true, true);
-    getClient().tableOperations().compact(tableNames[1], null, null, true, true);
+    client.tableOperations().compact(tableNames[0], null, null, true, true);
+    client.tableOperations().compact(tableNames[1], null, null, true, true);
 
-    verifyVolumesUsed(tableNames[0], true, v8, v9);
-    verifyVolumesUsed(tableNames[1], true, v8, v9);
+    verifyVolumesUsed(client, tableNames[0], true, v8, v9);
+    verifyVolumesUsed(client, tableNames[1], true, v8, v9);
 
     // check that root tablet is not on volume 1 or 2
     ZooReader zreader = new ZooReader(cluster.getZooKeepers(), 30000);
-    String zpath = ZooUtil.getRoot(getClient().getInstanceID()) + RootTable.ZROOT_TABLET_PATH;
+    String zpath = ZooUtil.getRoot(client.getInstanceID()) + RootTable.ZROOT_TABLET_PATH;
     String rootTabletDir = new String(zreader.getData(zpath, false, null), UTF_8);
     assertTrue(rootTabletDir.startsWith(v8.toString()) || rootTabletDir.startsWith(v9.toString()));
 
-    getClient().tableOperations().clone(tableNames[1], tableNames[2], true, new HashMap<>(),
+    client.tableOperations().clone(tableNames[1], tableNames[2], true, new HashMap<>(),
         new HashSet<>());
 
-    getClient().tableOperations().flush(MetadataTable.NAME, null, null, true);
-    getClient().tableOperations().flush(RootTable.NAME, null, null, true);
+    client.tableOperations().flush(MetadataTable.NAME, null, null, true);
+    client.tableOperations().flush(RootTable.NAME, null, null, true);
 
-    verifyVolumesUsed(tableNames[0], true, v8, v9);
-    verifyVolumesUsed(tableNames[1], true, v8, v9);
-    verifyVolumesUsed(tableNames[2], true, v8, v9);
+    verifyVolumesUsed(client, tableNames[0], true, v8, v9);
+    verifyVolumesUsed(client, tableNames[1], true, v8, v9);
+    verifyVolumesUsed(client, tableNames[2], true, v8, v9);
   }
 
   @Test
   public void testCleanReplaceVolumes() throws Exception {
-    testReplaceVolume(true);
+    try (AccumuloClient client = getClient()) {
+      testReplaceVolume(client, true);
+    }
   }
 
   @Test
   public void testDirtyReplaceVolumes() throws Exception {
-    testReplaceVolume(false);
+    try (AccumuloClient client = getClient()) {
+      testReplaceVolume(client, false);
+    }
   }
 }
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 1d8634a529..d753b7f31e 100644
--- a/test/src/main/java/org/apache/accumulo/test/WaitForBalanceIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/WaitForBalanceIT.java
@@ -48,28 +48,28 @@ public int defaultTimeoutSeconds() {
 
   @Test
   public void test() throws Exception {
-    final AccumuloClient c = getClient();
-    // ensure the metadata table is online
-    Iterators.size(c.createScanner(MetadataTable.NAME, Authorizations.EMPTY).iterator());
-    c.instanceOperations().waitForBalance();
-    assertTrue(isBalanced());
-    final String tableName = getUniqueNames(1)[0];
-    c.tableOperations().create(tableName);
-    c.instanceOperations().waitForBalance();
-    final SortedSet<Text> partitionKeys = new TreeSet<>();
-    for (int i = 0; i < 1000; i++) {
-      partitionKeys.add(new Text("" + i));
+    try (AccumuloClient c = getClient()) {
+      // ensure the metadata table is online
+      Iterators.size(c.createScanner(MetadataTable.NAME, Authorizations.EMPTY).iterator());
+      c.instanceOperations().waitForBalance();
+      assertTrue(isBalanced(c));
+      final String tableName = getUniqueNames(1)[0];
+      c.tableOperations().create(tableName);
+      c.instanceOperations().waitForBalance();
+      final SortedSet<Text> partitionKeys = new TreeSet<>();
+      for (int i = 0; i < 1000; i++) {
+        partitionKeys.add(new Text("" + i));
+      }
+      c.tableOperations().addSplits(tableName, partitionKeys);
+      assertFalse(isBalanced(c));
+      c.instanceOperations().waitForBalance();
+      assertTrue(isBalanced(c));
     }
-    c.tableOperations().addSplits(tableName, partitionKeys);
-    assertFalse(isBalanced());
-    c.instanceOperations().waitForBalance();
-    assertTrue(isBalanced());
   }
 
-  private boolean isBalanced() throws Exception {
+  private boolean isBalanced(AccumuloClient c) throws Exception {
     final Map<String,Integer> counts = new HashMap<>();
     int offline = 0;
-    final AccumuloClient c = getClient();
     for (String tableName : new String[] {MetadataTable.NAME, RootTable.NAME}) {
       try (Scanner s = c.createScanner(tableName, Authorizations.EMPTY)) {
         s.setRange(MetadataSchema.TabletsSection.getRange());
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 e5a2c06ae7..f7db561675 100644
--- a/test/src/main/java/org/apache/accumulo/test/YieldScannersIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/YieldScannersIT.java
@@ -62,53 +62,54 @@ public void configureMiniCluster(MiniAccumuloConfigImpl cfg, Configuration hadoo
   public void testScan() throws Exception {
     // make a table
     final String tableName = getUniqueNames(1)[0];
-    final AccumuloClient client = getAccumuloClient();
-    client.tableOperations().create(tableName);
-    final BatchWriter writer = client.createBatchWriter(tableName, new BatchWriterConfig());
-    for (int i = 0; i < 10; i++) {
-      byte[] row = {(byte) (START_ROW + i)};
-      Mutation m = new Mutation(new Text(row));
-      m.put(new Text(), new Text(), new Value());
-      writer.addMutation(m);
-    }
-    writer.flush();
-    writer.close();
-
-    log.info("Creating scanner");
-    // make a scanner for a table with 10 keys
-    try (Scanner scanner = client.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);
-        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 (AccumuloClient client = getAccumuloClient()) {
+      client.tableOperations().create(tableName);
+      final BatchWriter writer = client.createBatchWriter(tableName, new BatchWriterConfig());
+      for (int i = 0; i < 10; i++) {
+        byte[] row = {(byte) (START_ROW + i)};
+        Mutation m = new Mutation(new Text(row));
+        m.put(new Text(), new Text(), new Value());
+        writer.addMutation(m);
+      }
+      writer.flush();
+      writer.close();
+
+      log.info("Creating scanner");
+      // make a scanner for a table with 10 keys
+      try (Scanner scanner = client.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);
+          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(), ',');
+          assertEquals("Unexpected yield next count", Integer.toString(yieldNextCount), value[0]);
+          assertEquals("Unexpected yield seek count", Integer.toString(yieldSeekCount), value[1]);
+          assertEquals("Unexpected rebuild count",
+              Integer.toString(yieldNextCount + yieldSeekCount), value[2]);
+
+          keyCount++;
         }
-        String[] value = StringUtils.split(next.getValue().toString(), ',');
-        assertEquals("Unexpected yield next count", Integer.toString(yieldNextCount), value[0]);
-        assertEquals("Unexpected yield seek count", Integer.toString(yieldSeekCount), value[1]);
-        assertEquals("Unexpected rebuild count", Integer.toString(yieldNextCount + yieldSeekCount),
-            value[2]);
-
-        keyCount++;
+        assertEquals("Did not get the expected number of results", 10, keyCount);
       }
-      assertEquals("Did not get the expected number of results", 10, keyCount);
     }
   }
 
@@ -116,55 +117,55 @@ public void testScan() throws Exception {
   public void testBatchScan() throws Exception {
     // make a table
     final String tableName = getUniqueNames(1)[0];
-    final AccumuloClient client = getAccumuloClient();
-    client.tableOperations().create(tableName);
-    final BatchWriter writer = client.createBatchWriter(tableName, new BatchWriterConfig());
-    for (int i = 0; i < 10; i++) {
-      byte[] row = {(byte) (START_ROW + i)};
-      Mutation m = new Mutation(new Text(row));
-      m.put(new Text(), new Text(), new Value());
-      writer.addMutation(m);
-    }
-    writer.flush();
-    writer.close();
-
-    log.info("Creating batch scanner");
-    // make a scanner for a table with 10 keys
-    try (BatchScanner scanner = client.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);
-        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 (AccumuloClient client = getAccumuloClient()) {
+      client.tableOperations().create(tableName);
+      final BatchWriter writer = client.createBatchWriter(tableName, new BatchWriterConfig());
+      for (int i = 0; i < 10; i++) {
+        byte[] row = {(byte) (START_ROW + i)};
+        Mutation m = new Mutation(new Text(row));
+        m.put(new Text(), new Text(), new Value());
+        writer.addMutation(m);
+      }
+      writer.flush();
+      writer.close();
+
+      log.info("Creating batch scanner");
+      // make a scanner for a table with 10 keys
+      try (BatchScanner scanner = client.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);
+          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(), ',');
+          assertEquals("Unexpected yield next count", Integer.toString(yieldNextCount), value[0]);
+          assertEquals("Unexpected yield seek count", Integer.toString(yieldSeekCount), value[1]);
+          assertEquals("Unexpected rebuild count",
+              Integer.toString(yieldNextCount + yieldSeekCount), value[2]);
+
+          keyCount++;
         }
-        String[] value = StringUtils.split(next.getValue().toString(), ',');
-        assertEquals("Unexpected yield next count", Integer.toString(yieldNextCount), value[0]);
-        assertEquals("Unexpected yield seek count", Integer.toString(yieldSeekCount), value[1]);
-        assertEquals("Unexpected rebuild count", Integer.toString(yieldNextCount + yieldSeekCount),
-            value[2]);
-
-        keyCount++;
+        assertEquals("Did not get the expected number of results", 10, keyCount);
       }
-      assertEquals("Did not get the expected number of results", 10, keyCount);
     }
   }
-
 }
diff --git a/test/src/main/java/org/apache/accumulo/test/ZooKeeperPropertiesIT.java b/test/src/main/java/org/apache/accumulo/test/ZooKeeperPropertiesIT.java
index 51b4716ecc..4f3e9078af 100644
--- a/test/src/main/java/org/apache/accumulo/test/ZooKeeperPropertiesIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/ZooKeeperPropertiesIT.java
@@ -26,9 +26,10 @@
 
   @Test(expected = AccumuloException.class)
   public void testNoFiles() throws Exception {
-    AccumuloClient client = getAccumuloClient();
-    // Should throw an error as this property can't be changed in ZooKeeper
-    client.instanceOperations().setProperty(Property.GENERAL_RPC_TIMEOUT.getKey(), "60s");
+    try (AccumuloClient client = getAccumuloClient()) {
+      // Should throw an error as this property can't be changed in ZooKeeper
+      client.instanceOperations().setProperty(Property.GENERAL_RPC_TIMEOUT.getKey(), "60s");
+    }
   }
 
 }
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/AccumuloClientIT.java b/test/src/main/java/org/apache/accumulo/test/functional/AccumuloClientIT.java
index a548ac22ef..71d4820555 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/AccumuloClientIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/AccumuloClientIT.java
@@ -18,26 +18,58 @@
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
 
+import java.util.Map.Entry;
 import java.util.Properties;
 
 import org.apache.accumulo.core.client.Accumulo;
 import org.apache.accumulo.core.client.AccumuloClient;
+import org.apache.accumulo.core.client.BatchWriter;
 import org.apache.accumulo.core.client.ClientInfo;
+import org.apache.accumulo.core.client.ConditionalWriterConfig;
+import org.apache.accumulo.core.client.Scanner;
+import org.apache.accumulo.core.client.admin.TableOperations;
 import org.apache.accumulo.core.client.security.tokens.PasswordToken;
 import org.apache.accumulo.core.conf.ClientProperty;
+import org.apache.accumulo.core.data.Key;
+import org.apache.accumulo.core.data.Mutation;
+import org.apache.accumulo.core.data.Value;
+import org.apache.accumulo.core.security.Authorizations;
+import org.apache.accumulo.core.singletons.SingletonManager;
+import org.apache.accumulo.core.singletons.SingletonManager.Mode;
 import org.apache.accumulo.harness.AccumuloClusterHarness;
 import org.junit.Test;
 
+import com.google.common.collect.Iterables;
+
 public class AccumuloClientIT extends AccumuloClusterHarness {
 
+  private static interface CloseCheck {
+    void check() throws Exception;
+  }
+
+  private static void expectClosed(CloseCheck cc) throws Exception {
+    try {
+      cc.check();
+      fail();
+    } catch (IllegalStateException e) {
+      assertTrue(e.getMessage().toLowerCase().contains("closed"));
+    }
+  }
+
   @SuppressWarnings("deprecation")
   @Test
-  public void testGetConnectorFromAccumuloClient() {
+  public void testGetConnectorFromAccumuloClient() throws Exception {
     AccumuloClient client = getAccumuloClient();
     org.apache.accumulo.core.client.Connector c = org.apache.accumulo.core.client.Connector
         .from(client);
     assertEquals(client.whoami(), c.whoami());
+
+    // this should cause the connector to stop functioning
+    client.close();
+
+    expectClosed(() -> c.tableOperations());
   }
 
   @Test
@@ -70,6 +102,7 @@ public void testclientectorBuilder() throws Exception {
     props.put(ClientProperty.AUTH_PRINCIPAL.getKey(), user);
     props.put(ClientProperty.INSTANCE_ZOOKEEPERS_TIMEOUT.getKey(), "22s");
     ClientProperty.setPassword(props, password);
+    client.close();
     client = Accumulo.newClient().usingProperties(props).build();
 
     assertEquals(instanceName, client.info().getInstanceName());
@@ -103,5 +136,74 @@ public void testclientectorBuilder() throws Exception {
     assertEquals(instanceName, info.getInstanceName());
     assertEquals(zookeepers, info.getZooKeepers());
     assertEquals(user3, info.getPrincipal());
+
+    c.close();
+    client.close();
+    client2.close();
+    client3.close();
+  }
+
+  @Test
+  public void testClose() throws Exception {
+    String tableName = getUniqueNames(1)[0];
+
+    Scanner scanner;
+
+    assertEquals(0, SingletonManager.getReservationCount());
+    assertEquals(Mode.CLIENT, SingletonManager.getMode());
+
+    try (AccumuloClient c = Accumulo.newClient().usingClientInfo(getClientInfo()).build()) {
+      assertEquals(1, SingletonManager.getReservationCount());
+
+      c.tableOperations().create(tableName);
+
+      try (BatchWriter writer = c.createBatchWriter(tableName)) {
+        Mutation m = new Mutation("0001");
+        m.at().family("f007").qualifier("q4").put("j");
+        writer.addMutation(m);
+      }
+
+      scanner = c.createScanner(tableName, Authorizations.EMPTY);
+    }
+
+    // scanner created from closed client should fail
+    expectClosed(() -> scanner.iterator().next());
+
+    assertEquals(0, SingletonManager.getReservationCount());
+
+    AccumuloClient c = Accumulo.newClient().usingClientInfo(getClientInfo()).build();
+    assertEquals(1, SingletonManager.getReservationCount());
+
+    // ensure client created after everything was closed works
+    Scanner scanner2 = c.createScanner(tableName, Authorizations.EMPTY);
+    Entry<Key,Value> e = Iterables.getOnlyElement(scanner2);
+    assertEquals("0001", e.getKey().getRowData().toString());
+    assertEquals("f007", e.getKey().getColumnFamilyData().toString());
+    assertEquals("q4", e.getKey().getColumnQualifierData().toString());
+    assertEquals("j", e.getValue().toString());
+
+    // grab table ops before closing, will get an exception if trying to get it after closing
+    TableOperations tops = c.tableOperations();
+
+    c.close();
+
+    assertEquals(0, SingletonManager.getReservationCount());
+
+    expectClosed(() -> c.createScanner(tableName, Authorizations.EMPTY));
+    expectClosed(() -> c.createConditionalWriter(tableName, new ConditionalWriterConfig()));
+    expectClosed(() -> c.createBatchWriter(tableName));
+    expectClosed(() -> c.tableOperations());
+    expectClosed(() -> c.instanceOperations());
+    expectClosed(() -> c.securityOperations());
+    expectClosed(() -> c.namespaceOperations());
+    expectClosed(() -> c.info());
+    expectClosed(() -> c.getInstanceID());
+    expectClosed(() -> c.changeUser("root", new PasswordToken("secret")));
+
+    // check a few table ops to ensure they fail
+    expectClosed(() -> tops.create("expectFail"));
+    expectClosed(() -> tops.cancelCompaction(tableName));
+    expectClosed(() -> tops.listSplits(tableName));
+
   }
 }
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 6324828037..da5a41ef63 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
@@ -51,50 +51,51 @@ protected int defaultTimeoutSeconds() {
   public void addSplitTest() throws Exception {
 
     String tableName = getUniqueNames(1)[0];
-    AccumuloClient c = getAccumuloClient();
-    c.tableOperations().create(tableName);
+    try (AccumuloClient c = getAccumuloClient()) {
+      c.tableOperations().create(tableName);
 
-    insertData(tableName, 1L);
+      insertData(c, tableName, 1L);
 
-    TreeSet<Text> splits = new TreeSet<>();
-    splits.add(new Text(String.format("%09d", 333)));
-    splits.add(new Text(String.format("%09d", 666)));
+      TreeSet<Text> splits = new TreeSet<>();
+      splits.add(new Text(String.format("%09d", 333)));
+      splits.add(new Text(String.format("%09d", 666)));
 
-    c.tableOperations().addSplits(tableName, splits);
+      c.tableOperations().addSplits(tableName, splits);
 
-    sleepUninterruptibly(100, TimeUnit.MILLISECONDS);
+      sleepUninterruptibly(100, TimeUnit.MILLISECONDS);
 
-    Collection<Text> actualSplits = c.tableOperations().listSplits(tableName);
+      Collection<Text> actualSplits = c.tableOperations().listSplits(tableName);
 
-    if (!splits.equals(new TreeSet<>(actualSplits))) {
-      throw new Exception(splits + " != " + actualSplits);
-    }
+      if (!splits.equals(new TreeSet<>(actualSplits))) {
+        throw new Exception(splits + " != " + actualSplits);
+      }
 
-    verifyData(tableName, 1L);
-    insertData(tableName, 2L);
+      verifyData(c, tableName, 1L);
+      insertData(c, tableName, 2L);
 
-    // did not clear splits on purpose, it should ignore existing split points
-    // and still create the three additional split points
+      // did not clear splits on purpose, it should ignore existing split points
+      // and still create the three additional split points
 
-    splits.add(new Text(String.format("%09d", 200)));
-    splits.add(new Text(String.format("%09d", 500)));
-    splits.add(new Text(String.format("%09d", 800)));
+      splits.add(new Text(String.format("%09d", 200)));
+      splits.add(new Text(String.format("%09d", 500)));
+      splits.add(new Text(String.format("%09d", 800)));
 
-    c.tableOperations().addSplits(tableName, splits);
+      c.tableOperations().addSplits(tableName, splits);
 
-    sleepUninterruptibly(100, TimeUnit.MILLISECONDS);
+      sleepUninterruptibly(100, TimeUnit.MILLISECONDS);
 
-    actualSplits = c.tableOperations().listSplits(tableName);
+      actualSplits = c.tableOperations().listSplits(tableName);
 
-    if (!splits.equals(new TreeSet<>(actualSplits))) {
-      throw new Exception(splits + " != " + actualSplits);
-    }
+      if (!splits.equals(new TreeSet<>(actualSplits))) {
+        throw new Exception(splits + " != " + actualSplits);
+      }
 
-    verifyData(tableName, 2L);
+      verifyData(c, tableName, 2L);
+    }
   }
 
-  private void verifyData(String tableName, long ts) throws Exception {
-    try (Scanner scanner = getAccumuloClient().createScanner(tableName, Authorizations.EMPTY)) {
+  private void verifyData(AccumuloClient client, String tableName, long ts) throws Exception {
+    try (Scanner scanner = client.createScanner(tableName, Authorizations.EMPTY)) {
 
       Iterator<Entry<Key,Value>> iter = scanner.iterator();
 
@@ -126,9 +127,10 @@ private void verifyData(String tableName, long ts) throws Exception {
     }
   }
 
-  private void insertData(String tableName, long ts) throws AccumuloException,
-      AccumuloSecurityException, TableNotFoundException, MutationsRejectedException {
-    BatchWriter bw = getAccumuloClient().createBatchWriter(tableName, null);
+  private void insertData(AccumuloClient client, String tableName, long ts)
+      throws AccumuloException, AccumuloSecurityException, TableNotFoundException,
+      MutationsRejectedException {
+    BatchWriter bw = client.createBatchWriter(tableName, null);
 
     for (int i = 0; i < 10000; i++) {
       String row = String.format("%09d", i);
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/BackupMasterIT.java b/test/src/main/java/org/apache/accumulo/test/functional/BackupMasterIT.java
index 85dd3e5160..18f810b88e 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/BackupMasterIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/BackupMasterIT.java
@@ -19,6 +19,7 @@
 import java.util.Collections;
 import java.util.List;
 
+import org.apache.accumulo.core.client.AccumuloClient;
 import org.apache.accumulo.core.conf.Property;
 import org.apache.accumulo.fate.util.UtilWaitThread;
 import org.apache.accumulo.fate.zookeeper.IZooReaderWriter;
@@ -40,11 +41,11 @@ public void test() throws Exception {
     UtilWaitThread.sleep(1000);
     // create a backup
     Process backup = exec(Master.class);
-    try {
+    try (AccumuloClient client = getClient()) {
       String secret = getCluster().getSiteConfiguration().get(Property.INSTANCE_SECRET);
       IZooReaderWriter writer = new ZooReaderWriterFactory()
           .getZooReaderWriter(cluster.getZooKeepers(), 30 * 1000, secret);
-      String root = "/accumulo/" + getClient().getInstanceID();
+      String root = "/accumulo/" + client.getInstanceID();
       List<String> children = Collections.emptyList();
       // wait for 2 lock entries
       do {
@@ -63,7 +64,7 @@ public void test() throws Exception {
       // kill the master by removing its lock
       writer.recursiveDelete(lockPath, NodeMissingPolicy.FAIL);
       // ensure the backup becomes the master
-      getClient().tableOperations().create(getUniqueNames(1)[0]);
+      client.tableOperations().create(getUniqueNames(1)[0]);
     } finally {
       backup.destroy();
     }
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 9f1845edf8..4112f311b3 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
@@ -47,64 +47,64 @@ protected int defaultTimeoutSeconds() {
 
   @Test
   public void test() throws Exception {
-    AccumuloClient c = getAccumuloClient();
+    try (AccumuloClient c = getAccumuloClient()) {
 
-    String tableName = getUniqueNames(1)[0];
-    c.tableOperations().create(tableName);
-    IteratorSetting is = new IteratorSetting(30, BadIterator.class);
-    c.tableOperations().attachIterator(tableName, is, EnumSet.of(IteratorScope.minc));
-    BatchWriter bw = c.createBatchWriter(tableName, new BatchWriterConfig());
+      String tableName = getUniqueNames(1)[0];
+      c.tableOperations().create(tableName);
+      IteratorSetting is = new IteratorSetting(30, BadIterator.class);
+      c.tableOperations().attachIterator(tableName, is, EnumSet.of(IteratorScope.minc));
+      BatchWriter bw = c.createBatchWriter(tableName, new BatchWriterConfig());
 
-    Mutation m = new Mutation(new Text("r1"));
-    m.put(new Text("acf"), new Text(tableName), new Value("1".getBytes(UTF_8)));
+      Mutation m = new Mutation(new Text("r1"));
+      m.put(new Text("acf"), new Text(tableName), new Value("1".getBytes(UTF_8)));
 
-    bw.addMutation(m);
-    bw.close();
+      bw.addMutation(m);
+      bw.close();
 
-    c.tableOperations().flush(tableName, null, null, false);
-    sleepUninterruptibly(1, TimeUnit.SECONDS);
+      c.tableOperations().flush(tableName, null, null, false);
+      sleepUninterruptibly(1, TimeUnit.SECONDS);
 
-    // minc should fail, so there should be no files
-    FunctionalTestUtils.checkRFiles(c, tableName, 1, 1, 0, 0);
+      // minc should fail, so there should be no files
+      FunctionalTestUtils.checkRFiles(c, tableName, 1, 1, 0, 0);
 
-    // try to scan table
-    try (Scanner scanner = c.createScanner(tableName, Authorizations.EMPTY)) {
-      int count = Iterators.size(scanner.iterator());
-      assertEquals("Did not see expected # entries " + count, 1, count);
+      // try to scan table
+      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/BalanceAfterCommsFailureIT.java b/test/src/main/java/org/apache/accumulo/test/functional/BalanceAfterCommsFailureIT.java
index 1b3a42b79b..114c840525 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/BalanceAfterCommsFailureIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/BalanceAfterCommsFailureIT.java
@@ -63,41 +63,42 @@ protected int defaultTimeoutSeconds() {
 
   @Test
   public void test() throws Exception {
-    AccumuloClient c = this.getClient();
-    c.tableOperations().create("test");
-    Collection<ProcessReference> tservers = getCluster().getProcesses()
-        .get(ServerType.TABLET_SERVER);
-    ArrayList<Integer> tserverPids = new ArrayList<>(tservers.size());
-    for (ProcessReference tserver : tservers) {
-      Process p = tserver.getProcess();
-      if (!p.getClass().getName().equals("java.lang.UNIXProcess")) {
-        log.info("Found process that was not UNIXProcess, exiting test");
-        return;
-      }
+    try (AccumuloClient c = this.getClient()) {
+      c.tableOperations().create("test");
+      Collection<ProcessReference> tservers = getCluster().getProcesses()
+          .get(ServerType.TABLET_SERVER);
+      ArrayList<Integer> tserverPids = new ArrayList<>(tservers.size());
+      for (ProcessReference tserver : tservers) {
+        Process p = tserver.getProcess();
+        if (!p.getClass().getName().equals("java.lang.UNIXProcess")) {
+          log.info("Found process that was not UNIXProcess, exiting test");
+          return;
+        }
 
-      Field f = p.getClass().getDeclaredField("pid");
-      f.setAccessible(true);
-      tserverPids.add(f.getInt(p));
-    }
+        Field f = p.getClass().getDeclaredField("pid");
+        f.setAccessible(true);
+        tserverPids.add(f.getInt(p));
+      }
 
-    for (int pid : tserverPids) {
-      assertEquals(0, Runtime.getRuntime()
-          .exec(new String[] {"kill", "-SIGSTOP", Integer.toString(pid)}).waitFor());
-    }
-    UtilWaitThread.sleep(20 * 1000);
-    for (int pid : tserverPids) {
-      assertEquals(0, Runtime.getRuntime()
-          .exec(new String[] {"kill", "-SIGCONT", Integer.toString(pid)}).waitFor());
-    }
-    SortedSet<Text> splits = new TreeSet<>();
-    for (String split : "a b c d e f g h i j k l m n o p q r s t u v w x y z".split(" ")) {
-      splits.add(new Text(split));
+      for (int pid : tserverPids) {
+        assertEquals(0, Runtime.getRuntime()
+            .exec(new String[] {"kill", "-SIGSTOP", Integer.toString(pid)}).waitFor());
+      }
+      UtilWaitThread.sleep(20 * 1000);
+      for (int pid : tserverPids) {
+        assertEquals(0, Runtime.getRuntime()
+            .exec(new String[] {"kill", "-SIGCONT", Integer.toString(pid)}).waitFor());
+      }
+      SortedSet<Text> splits = new TreeSet<>();
+      for (String split : "a b c d e f g h i j k l m n o p q r s t u v w x y z".split(" ")) {
+        splits.add(new Text(split));
+      }
+      c.tableOperations().addSplits("test", splits);
+      // Ensure all of the tablets are actually assigned
+      assertEquals(0, Iterables.size(c.createScanner("test", Authorizations.EMPTY)));
+      UtilWaitThread.sleep(30 * 1000);
+      checkBalance(c);
     }
-    c.tableOperations().addSplits("test", splits);
-    // Ensure all of the tablets are actually assigned
-    assertEquals(0, Iterables.size(c.createScanner("test", Authorizations.EMPTY)));
-    UtilWaitThread.sleep(30 * 1000);
-    checkBalance(c);
   }
 
   private void checkBalance(AccumuloClient c) throws Exception {
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/BalanceInPresenceOfOfflineTableIT.java b/test/src/main/java/org/apache/accumulo/test/functional/BalanceInPresenceOfOfflineTableIT.java
index 3fd1c3976c..89307d7cea 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/BalanceInPresenceOfOfflineTableIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/BalanceInPresenceOfOfflineTableIT.java
@@ -49,6 +49,7 @@
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.io.Text;
 import org.apache.thrift.TException;
+import org.junit.After;
 import org.junit.Assume;
 import org.junit.Before;
 import org.junit.Test;
@@ -89,10 +90,10 @@ protected int defaultTimeoutSeconds() {
   @Before
   public void setupTables() throws AccumuloException, AccumuloSecurityException,
       TableExistsException, TableNotFoundException {
-    AccumuloClient client = getAccumuloClient();
+    accumuloClient = getAccumuloClient();
     // Need at least two tservers
     Assume.assumeTrue("Not enough tservers to run test",
-        client.instanceOperations().getTabletServers().size() >= 2);
+        accumuloClient.instanceOperations().getTabletServers().size() >= 2);
 
     // set up splits
     final SortedSet<Text> splits = new TreeSet<>();
@@ -105,7 +106,7 @@ public void setupTables() throws AccumuloException, AccumuloSecurityException,
     TEST_TABLE = names[1];
 
     // load into a table we won't use
-    accumuloClient = getAccumuloClient();
+
     accumuloClient.tableOperations().create(UNUSED_TABLE);
     accumuloClient.tableOperations().addSplits(UNUSED_TABLE, splits);
     // mark the table offline before it can rebalance.
@@ -117,6 +118,11 @@ public void setupTables() throws AccumuloException, AccumuloSecurityException,
         Property.TABLE_SPLIT_THRESHOLD.getKey(), "10K");
   }
 
+  @After
+  public void closeClient() {
+    accumuloClient.close();
+  }
+
   @Test
   public void test() throws Exception {
     log.info("Test that balancing is not stopped by an offline table with outstanding migrations.");
@@ -152,7 +158,7 @@ public void test() throws Exception {
         try {
           client = MasterClient.getConnectionWithRetry(getClientContext());
           stats = client.getMasterStats(Tracer.traceInfo(),
-              creds.toThrift(getAccumuloClient().getInstanceID()));
+              creds.toThrift(accumuloClient.getInstanceID()));
           break;
         } catch (ThriftSecurityException exception) {
           throw new AccumuloSecurityException(exception);
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 496622b3c7..4e2fce50e3 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
@@ -60,75 +60,73 @@ protected int defaultTimeoutSeconds() {
 
   @Test
   public void test() throws Exception {
-    AccumuloClient c = getAccumuloClient();
-    String tableName = getUniqueNames(1)[0];
-    c.tableOperations().create(tableName);
+    try (AccumuloClient c = getAccumuloClient()) {
+      String tableName = getUniqueNames(1)[0];
+      c.tableOperations().create(tableName);
 
-    int numRows = 1 << 18;
+      int numRows = 1 << 18;
 
-    BatchWriter bw = getAccumuloClient().createBatchWriter(tableName, new BatchWriterConfig());
+      BatchWriter bw = c.createBatchWriter(tableName, new BatchWriterConfig());
 
-    for (int i = 0; i < numRows; i++) {
-      Mutation m = new Mutation(new Text(String.format("%09x", i)));
-      m.put(new Text("cf1"), new Text("cq1"),
-          new Value(String.format("%016x", numRows - i).getBytes(UTF_8)));
-      bw.addMutation(m);
-    }
+      for (int i = 0; i < numRows; i++) {
+        Mutation m = new Mutation(new Text(String.format("%09x", i)));
+        m.put(new Text("cf1"), new Text("cq1"),
+            new Value(String.format("%016x", numRows - i).getBytes(UTF_8)));
+        bw.addMutation(m);
+      }
 
-    bw.close();
+      bw.close();
 
-    getAccumuloClient().tableOperations().flush(tableName, null, null, true);
+      c.tableOperations().flush(tableName, null, null, true);
 
-    getAccumuloClient().tableOperations().setProperty(tableName,
-        Property.TABLE_SPLIT_THRESHOLD.getKey(), "4K");
+      c.tableOperations().setProperty(tableName, Property.TABLE_SPLIT_THRESHOLD.getKey(), "4K");
 
-    Collection<Text> splits = getAccumuloClient().tableOperations().listSplits(tableName);
-    while (splits.size() < 2) {
-      sleepUninterruptibly(1, TimeUnit.MILLISECONDS);
-      splits = getAccumuloClient().tableOperations().listSplits(tableName);
-    }
+      Collection<Text> splits = c.tableOperations().listSplits(tableName);
+      while (splits.size() < 2) {
+        sleepUninterruptibly(1, TimeUnit.MILLISECONDS);
+        splits = c.tableOperations().listSplits(tableName);
+      }
 
-    System.out.println("splits : " + splits);
+      System.out.println("splits : " + splits);
 
-    Random random = new SecureRandom();
-    HashMap<Text,Value> expected = new HashMap<>();
-    ArrayList<Range> ranges = new ArrayList<>();
-    for (int i = 0; i < 100; i++) {
-      int r = random.nextInt(numRows);
-      Text row = new Text(String.format("%09x", r));
-      expected.put(row, new Value(String.format("%016x", numRows - r).getBytes(UTF_8)));
-      ranges.add(new Range(row));
-    }
+      Random random = new SecureRandom();
+      HashMap<Text,Value> expected = new HashMap<>();
+      ArrayList<Range> ranges = new ArrayList<>();
+      for (int i = 0; i < 100; i++) {
+        int r = random.nextInt(numRows);
+        Text row = new Text(String.format("%09x", r));
+        expected.put(row, new Value(String.format("%016x", numRows - r).getBytes(UTF_8)));
+        ranges.add(new Range(row));
+      }
 
-    // logger.setLevel(Level.TRACE);
+      // logger.setLevel(Level.TRACE);
 
-    HashMap<Text,Value> found = new HashMap<>();
+      HashMap<Text,Value> found = new HashMap<>();
 
-    for (int i = 0; i < 20; i++) {
-      try (BatchScanner bs = getAccumuloClient().createBatchScanner(tableName, Authorizations.EMPTY,
-          4)) {
+      for (int i = 0; i < 20; i++) {
+        try (BatchScanner bs = c.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());
-        }
+          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 = getAccumuloClient().tableOperations().listSplits(tableName);
-    log.info("splits : {}", splits);
+      splits = c.tableOperations().listSplits(tableName);
+      log.info("splits : {}", splits);
+    }
   }
-
 }
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 c7f983c1bf..1dbb667623 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
@@ -67,22 +67,23 @@ protected int defaultTimeoutSeconds() {
 
   @Test
   public void run() throws Exception {
-    AccumuloClient c = getAccumuloClient();
-    String[] tableNames = getUniqueNames(2);
-    String bwft = tableNames[0];
-    c.tableOperations().create(bwft);
-    String bwlt = tableNames[1];
-    c.tableOperations().create(bwlt);
-    runFlushTest(bwft);
-    runLatencyTest(bwlt);
+    try (AccumuloClient c = getAccumuloClient()) {
+      String[] tableNames = getUniqueNames(2);
+      String bwft = tableNames[0];
+      c.tableOperations().create(bwft);
+      String bwlt = tableNames[1];
+      c.tableOperations().create(bwlt);
+      runFlushTest(c, bwft);
+      runLatencyTest(c, bwlt);
+    }
   }
 
-  private void runLatencyTest(String tableName) throws Exception {
+  private void runLatencyTest(AccumuloClient client, String tableName) throws Exception {
     // should automatically flush after 2 seconds
     try (
         BatchWriter bw = getAccumuloClient().createBatchWriter(tableName,
             new BatchWriterConfig().setMaxLatency(1000, TimeUnit.MILLISECONDS));
-        Scanner scanner = getAccumuloClient().createScanner(tableName, Authorizations.EMPTY)) {
+        Scanner scanner = client.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)));
@@ -106,10 +107,10 @@ private void runLatencyTest(String tableName) throws Exception {
     }
   }
 
-  private void runFlushTest(String tableName) throws AccumuloException, AccumuloSecurityException,
-      TableNotFoundException, MutationsRejectedException, Exception {
-    BatchWriter bw = getAccumuloClient().createBatchWriter(tableName, new BatchWriterConfig());
-    try (Scanner scanner = getAccumuloClient().createScanner(tableName, Authorizations.EMPTY)) {
+  private void runFlushTest(AccumuloClient client, String tableName) throws AccumuloException,
+      AccumuloSecurityException, TableNotFoundException, MutationsRejectedException, Exception {
+    BatchWriter bw = client.createBatchWriter(tableName, new BatchWriterConfig());
+    try (Scanner scanner = client.createScanner(tableName, Authorizations.EMPTY)) {
       Random r = new SecureRandom();
 
       for (int i = 0; i < 4; i++) {
@@ -182,78 +183,79 @@ private void runFlushTest(String tableName) throws AccumuloException, AccumuloSe
 
   @Test
   public void runMultiThreadedBinningTest() throws Exception {
-    AccumuloClient c = getAccumuloClient();
-    String[] tableNames = getUniqueNames(1);
-    String tableName = tableNames[0];
-    c.tableOperations().create(tableName);
-    for (int x = 0; x < NUM_THREADS; x++) {
-      c.tableOperations().addSplits(tableName,
-          new TreeSet<>(Collections.singleton(new Text(Integer.toString(x * NUM_TO_FLUSH)))));
-    }
-    c.instanceOperations().waitForBalance();
-
-    // Logger.getLogger(TabletServerBatchWriter.class).setLevel(Level.TRACE);
-    final List<Set<Mutation>> allMuts = new LinkedList<>();
-    List<Mutation> data = new ArrayList<>();
-    for (int i = 0; i < NUM_THREADS; 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("%10d", row)));
-        m.put(new Text("cf" + i), new Text("cq"), new Value(("" + row).getBytes()));
-        data.add(m);
+    try (AccumuloClient c = getAccumuloClient()) {
+      String[] tableNames = getUniqueNames(1);
+      String tableName = tableNames[0];
+      c.tableOperations().create(tableName);
+      for (int x = 0; x < NUM_THREADS; x++) {
+        c.tableOperations().addSplits(tableName,
+            new TreeSet<>(Collections.singleton(new Text(Integer.toString(x * NUM_TO_FLUSH)))));
       }
-    }
-    assertEquals(NUM_THREADS * NUM_TO_FLUSH, data.size());
-    Collections.shuffle(data);
-    for (int n = 0; n < (NUM_THREADS * NUM_TO_FLUSH); n += NUM_TO_FLUSH) {
-      Set<Mutation> muts = new HashSet<>(data.subList(n, n + NUM_TO_FLUSH));
-      allMuts.add(muts);
-    }
+      c.instanceOperations().waitForBalance();
 
-    SimpleThreadPool threads = new SimpleThreadPool(NUM_THREADS, "ClientThreads");
-    threads.allowCoreThreadTimeOut(false);
-    threads.prestartAllCoreThreads();
-
-    BatchWriterConfig cfg = new BatchWriterConfig();
-    cfg.setMaxLatency(10, TimeUnit.SECONDS);
-    cfg.setMaxMemory(1 * 1024 * 1024);
-    cfg.setMaxWriteThreads(NUM_THREADS);
-    final BatchWriter bw = getAccumuloClient().createBatchWriter(tableName, cfg);
-
-    for (int k = 0; k < NUM_THREADS; k++) {
-      final int idx = k;
-      threads.execute(new Runnable() {
-        @Override
-        public void run() {
-          try {
-            bw.addMutations(allMuts.get(idx));
-            bw.flush();
-          } catch (MutationsRejectedException e) {
-            fail("Error adding mutations to batch writer");
-          }
+      // Logger.getLogger(TabletServerBatchWriter.class).setLevel(Level.TRACE);
+      final List<Set<Mutation>> allMuts = new LinkedList<>();
+      List<Mutation> data = new ArrayList<>();
+      for (int i = 0; i < NUM_THREADS; 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("%10d", row)));
+          m.put(new Text("cf" + i), new Text("cq"), new Value(("" + row).getBytes()));
+          data.add(m);
         }
-      });
-    }
-    threads.shutdown();
-    threads.awaitTermination(3, TimeUnit.MINUTES);
-    bw.close();
-    try (Scanner scanner = getAccumuloClient().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;
+      }
+      assertEquals(NUM_THREADS * NUM_TO_FLUSH, data.size());
+      Collections.shuffle(data);
+      for (int n = 0; n < (NUM_THREADS * NUM_TO_FLUSH); n += NUM_TO_FLUSH) {
+        Set<Mutation> muts = new HashSet<>(data.subList(n, n + NUM_TO_FLUSH));
+        allMuts.add(muts);
+      }
+
+      SimpleThreadPool threads = new SimpleThreadPool(NUM_THREADS, "ClientThreads");
+      threads.allowCoreThreadTimeOut(false);
+      threads.prestartAllCoreThreads();
+
+      BatchWriterConfig cfg = new BatchWriterConfig();
+      cfg.setMaxLatency(10, TimeUnit.SECONDS);
+      cfg.setMaxMemory(1 * 1024 * 1024);
+      cfg.setMaxWriteThreads(NUM_THREADS);
+      final BatchWriter bw = c.createBatchWriter(tableName, cfg);
+
+      for (int k = 0; k < NUM_THREADS; k++) {
+        final int idx = k;
+        threads.execute(new Runnable() {
+          @Override
+          public void run() {
+            try {
+              bw.addMutations(allMuts.get(idx));
+              bw.flush();
+            } catch (MutationsRejectedException e) {
+              fail("Error adding mutations to batch writer");
+            }
           }
-        }
-        assertTrue("Mutation not found: " + m, found);
+        });
       }
+      threads.shutdown();
+      threads.awaitTermination(3, TimeUnit.MINUTES);
+      bw.close();
+      try (Scanner scanner = c.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;
+            }
+          }
+          assertTrue("Mutation not found: " + m, found);
+        }
 
-      for (int m = 0; m < NUM_THREADS; m++) {
-        assertEquals(0, allMuts.get(m).size());
+        for (int m = 0; m < NUM_THREADS; m++) {
+          assertEquals(0, allMuts.get(m).size());
+        }
       }
     }
   }
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/BigRootTabletIT.java b/test/src/main/java/org/apache/accumulo/test/functional/BigRootTabletIT.java
index 34510dbc89..cf33567793 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/BigRootTabletIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/BigRootTabletIT.java
@@ -51,19 +51,20 @@ protected int defaultTimeoutSeconds() {
 
   @Test
   public void test() throws Exception {
-    AccumuloClient c = getAccumuloClient();
-    c.tableOperations().addSplits(MetadataTable.NAME,
-        FunctionalTestUtils.splits("0 1 2 3 4 5 6 7 8 9 a".split(" ")));
-    String[] names = getUniqueNames(10);
-    for (String name : names) {
-      c.tableOperations().create(name);
-      c.tableOperations().flush(MetadataTable.NAME, null, null, true);
-      c.tableOperations().flush(RootTable.NAME, null, null, true);
+    try (AccumuloClient c = getAccumuloClient()) {
+      c.tableOperations().addSplits(MetadataTable.NAME,
+          FunctionalTestUtils.splits("0 1 2 3 4 5 6 7 8 9 a".split(" ")));
+      String[] names = getUniqueNames(10);
+      for (String name : names) {
+        c.tableOperations().create(name);
+        c.tableOperations().flush(MetadataTable.NAME, null, null, true);
+        c.tableOperations().flush(RootTable.NAME, null, null, true);
+      }
+      cluster.stop();
+      cluster.start();
+      assertTrue(
+          Iterators.size(c.createScanner(RootTable.NAME, Authorizations.EMPTY).iterator()) > 0);
     }
-    cluster.stop();
-    cluster.start();
-    assertTrue(
-        Iterators.size(c.createScanner(RootTable.NAME, Authorizations.EMPTY).iterator()) > 0);
   }
 
 }
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/BinaryIT.java b/test/src/main/java/org/apache/accumulo/test/functional/BinaryIT.java
index 24b068dcb5..26b49f3482 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/BinaryIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/BinaryIT.java
@@ -36,22 +36,24 @@ protected int defaultTimeoutSeconds() {
 
   @Test
   public void test() throws Exception {
-    AccumuloClient c = getAccumuloClient();
-    String tableName = getUniqueNames(1)[0];
-    c.tableOperations().create(tableName);
-    runTest(c, tableName);
+    try (AccumuloClient c = getAccumuloClient()) {
+      String tableName = getUniqueNames(1)[0];
+      c.tableOperations().create(tableName);
+      runTest(c, tableName);
+    }
   }
 
   @Test
   public void testPreSplit() throws Exception {
     String tableName = getUniqueNames(1)[0];
-    AccumuloClient c = getAccumuloClient();
-    c.tableOperations().create(tableName);
-    SortedSet<Text> splits = new TreeSet<>();
-    splits.add(new Text("8"));
-    splits.add(new Text("256"));
-    c.tableOperations().addSplits(tableName, splits);
-    runTest(c, tableName);
+    try (AccumuloClient c = getAccumuloClient()) {
+      c.tableOperations().create(tableName);
+      SortedSet<Text> splits = new TreeSet<>();
+      splits.add(new Text("8"));
+      splits.add(new Text("256"));
+      c.tableOperations().addSplits(tableName, splits);
+      runTest(c, tableName);
+    }
   }
 
   public static void runTest(AccumuloClient c, String tableName) 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 09c291cc97..4d36ccfc74 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
@@ -62,26 +62,28 @@ public void alterConfig() throws Exception {
     if (ClusterType.MINI == getClusterType()) {
       return;
     }
+    try (AccumuloClient client = getAccumuloClient()) {
+      InstanceOperations iops = client.instanceOperations();
+      Map<String,String> conf = iops.getSystemConfiguration();
+      majcDelay = conf.get(Property.TSERV_MAJC_DELAY.getKey());
+      maxMem = conf.get(Property.TSERV_MAXMEM.getKey());
 
-    InstanceOperations iops = getAccumuloClient().instanceOperations();
-    Map<String,String> conf = iops.getSystemConfiguration();
-    majcDelay = conf.get(Property.TSERV_MAJC_DELAY.getKey());
-    maxMem = conf.get(Property.TSERV_MAXMEM.getKey());
+      iops.setProperty(Property.TSERV_MAJC_DELAY.getKey(), "0");
+      iops.setProperty(Property.TSERV_MAXMEM.getKey(), "50K");
 
-    iops.setProperty(Property.TSERV_MAJC_DELAY.getKey(), "0");
-    iops.setProperty(Property.TSERV_MAXMEM.getKey(), "50K");
-
-    getClusterControl().stopAllServers(ServerType.TABLET_SERVER);
-    getClusterControl().startAllServers(ServerType.TABLET_SERVER);
+      getClusterControl().stopAllServers(ServerType.TABLET_SERVER);
+      getClusterControl().startAllServers(ServerType.TABLET_SERVER);
+    }
   }
 
   @After
   public void resetConfig() throws Exception {
     if (null != majcDelay) {
-      InstanceOperations iops = getAccumuloClient().instanceOperations();
-      iops.setProperty(Property.TSERV_MAJC_DELAY.getKey(), majcDelay);
-      iops.setProperty(Property.TSERV_MAXMEM.getKey(), maxMem);
-
+      try (AccumuloClient client = getAccumuloClient()) {
+        InstanceOperations iops = client.instanceOperations();
+        iops.setProperty(Property.TSERV_MAJC_DELAY.getKey(), majcDelay);
+        iops.setProperty(Property.TSERV_MAXMEM.getKey(), maxMem);
+      }
       getClusterControl().stopAllServers(ServerType.TABLET_SERVER);
       getClusterControl().startAllServers(ServerType.TABLET_SERVER);
     }
@@ -89,20 +91,21 @@ public void resetConfig() throws Exception {
 
   @Test
   public void binaryStressTest() throws Exception {
-    AccumuloClient c = getAccumuloClient();
-    String tableName = getUniqueNames(1)[0];
-    c.tableOperations().create(tableName);
-    c.tableOperations().setProperty(tableName, Property.TABLE_SPLIT_THRESHOLD.getKey(), "10K");
-    BinaryIT.runTest(c, tableName);
-    String id = c.tableOperations().tableIdMap().get(tableName);
-    Set<Text> tablets = new HashSet<>();
-    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());
+    try (AccumuloClient c = getAccumuloClient()) {
+      String tableName = getUniqueNames(1)[0];
+      c.tableOperations().create(tableName);
+      c.tableOperations().setProperty(tableName, Property.TABLE_SPLIT_THRESHOLD.getKey(), "10K");
+      BinaryIT.runTest(c, tableName);
+      String id = c.tableOperations().tableIdMap().get(tableName);
+      Set<Text> tablets = new HashSet<>();
+      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);
     }
-    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 226e5bfbfa..dff45642f7 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
@@ -70,99 +70,101 @@ protected int defaultTimeoutSeconds() {
 
   @Test
   public void test() throws Exception {
-    AccumuloClient c = getAccumuloClient();
-    final String readAhead = c.instanceOperations().getSystemConfiguration()
-        .get(Property.TSERV_SCAN_EXECUTORS_DEFAULT_THREADS.getKey());
-    c.instanceOperations().setProperty(Property.TSERV_SCAN_EXECUTORS_DEFAULT_THREADS.getKey(), "1");
-    try {
-      Thread.sleep(1000);
-      final String[] tables = getUniqueNames(4);
-      for (String table : tables) {
-        TableOperations tops = c.tableOperations();
-        tops.create(table);
-        tops.setProperty(table, Property.TABLE_INDEXCACHE_ENABLED.getKey(), "false");
-        tops.setProperty(table, Property.TABLE_BLOCKCACHE_ENABLED.getKey(), "false");
-        tops.setProperty(table, Property.TABLE_BLOOM_SIZE.getKey(), "2000000");
-        tops.setProperty(table, Property.TABLE_BLOOM_ERRORRATE.getKey(), "1%");
-        tops.setProperty(table, Property.TABLE_BLOOM_LOAD_THRESHOLD.getKey(), "0");
-        tops.setProperty(table, Property.TABLE_FILE_COMPRESSED_BLOCK_SIZE.getKey(), "64K");
-      }
-      log.info("Writing");
-      write(c, tables[0], 1, 0, 2000000000, 500);
-      write(c, tables[1], 2, 0, 2000000000, 500);
-      write(c, tables[2], 3, 0, 2000000000, 500);
-      log.info("Writing complete");
-
-      // test inserting an empty key
-      BatchWriter bw = c.createBatchWriter(tables[3], new BatchWriterConfig());
-      Mutation m = new Mutation(new Text(""));
-      m.put(new Text(""), new Text(""), new Value("foo1".getBytes()));
-      bw.addMutation(m);
-      bw.close();
-      c.tableOperations().flush(tables[3], null, null, true);
-
-      for (String table : Arrays.asList(tables[0], tables[1], tables[2])) {
-        c.tableOperations().compact(table, null, null, true, true);
-      }
+    try (AccumuloClient c = getAccumuloClient()) {
+      final String readAhead = c.instanceOperations().getSystemConfiguration()
+          .get(Property.TSERV_SCAN_EXECUTORS_DEFAULT_THREADS.getKey());
+      c.instanceOperations().setProperty(Property.TSERV_SCAN_EXECUTORS_DEFAULT_THREADS.getKey(),
+          "1");
+      try {
+        Thread.sleep(1000);
+        final String[] tables = getUniqueNames(4);
+        for (String table : tables) {
+          TableOperations tops = c.tableOperations();
+          tops.create(table);
+          tops.setProperty(table, Property.TABLE_INDEXCACHE_ENABLED.getKey(), "false");
+          tops.setProperty(table, Property.TABLE_BLOCKCACHE_ENABLED.getKey(), "false");
+          tops.setProperty(table, Property.TABLE_BLOOM_SIZE.getKey(), "2000000");
+          tops.setProperty(table, Property.TABLE_BLOOM_ERRORRATE.getKey(), "1%");
+          tops.setProperty(table, Property.TABLE_BLOOM_LOAD_THRESHOLD.getKey(), "0");
+          tops.setProperty(table, Property.TABLE_FILE_COMPRESSED_BLOCK_SIZE.getKey(), "64K");
+        }
+        log.info("Writing");
+        write(c, tables[0], 1, 0, 2000000000, 500);
+        write(c, tables[1], 2, 0, 2000000000, 500);
+        write(c, tables[2], 3, 0, 2000000000, 500);
+        log.info("Writing complete");
+
+        // test inserting an empty key
+        BatchWriter bw = c.createBatchWriter(tables[3], new BatchWriterConfig());
+        Mutation m = new Mutation(new Text(""));
+        m.put(new Text(""), new Text(""), new Value("foo1".getBytes()));
+        bw.addMutation(m);
+        bw.close();
+        c.tableOperations().flush(tables[3], null, null, true);
+
+        for (String table : Arrays.asList(tables[0], tables[1], tables[2])) {
+          c.tableOperations().compact(table, null, null, true, true);
+        }
 
-      // ensure compactions are finished
-      for (String table : tables) {
-        FunctionalTestUtils.checkRFiles(c, table, 1, 1, 1, 1);
-      }
+        // ensure compactions are finished
+        for (String table : tables) {
+          FunctionalTestUtils.checkRFiles(c, table, 1, 1, 1, 1);
+        }
 
-      // these queries should only run quickly if bloom filters are working, so lets get a base
-      log.info("Base query");
-      long t1 = query(c, tables[0], 1, 0, 2000000000, 5000, 500);
-      long t2 = query(c, tables[1], 2, 0, 2000000000, 5000, 500);
-      long t3 = query(c, tables[2], 3, 0, 2000000000, 5000, 500);
-      log.info("Base query complete");
-
-      log.info("Rewriting with bloom filters");
-      c.tableOperations().setProperty(tables[0], Property.TABLE_BLOOM_ENABLED.getKey(), "true");
-      c.tableOperations().setProperty(tables[0], Property.TABLE_BLOOM_KEY_FUNCTOR.getKey(),
-          RowFunctor.class.getName());
-
-      c.tableOperations().setProperty(tables[1], Property.TABLE_BLOOM_ENABLED.getKey(), "true");
-      c.tableOperations().setProperty(tables[1], Property.TABLE_BLOOM_KEY_FUNCTOR.getKey(),
-          ColumnFamilyFunctor.class.getName());
-
-      c.tableOperations().setProperty(tables[2], Property.TABLE_BLOOM_ENABLED.getKey(), "true");
-      c.tableOperations().setProperty(tables[2], Property.TABLE_BLOOM_KEY_FUNCTOR.getKey(),
-          ColumnQualifierFunctor.class.getName());
-
-      c.tableOperations().setProperty(tables[3], Property.TABLE_BLOOM_ENABLED.getKey(), "true");
-      c.tableOperations().setProperty(tables[3], Property.TABLE_BLOOM_KEY_FUNCTOR.getKey(),
-          RowFunctor.class.getName());
-
-      // ensure the updates to zookeeper propagate
-      UtilWaitThread.sleep(500);
-
-      c.tableOperations().compact(tables[3], null, null, false, true);
-      c.tableOperations().compact(tables[0], null, null, false, true);
-      c.tableOperations().compact(tables[1], null, null, false, true);
-      c.tableOperations().compact(tables[2], null, null, false, true);
-      log.info("Rewriting with bloom filters complete");
-
-      // these queries should only run quickly if bloom
-      // filters are working
-      log.info("Bloom query");
-      long tb1 = query(c, tables[0], 1, 0, 2000000000, 5000, 500);
-      long tb2 = query(c, tables[1], 2, 0, 2000000000, 5000, 500);
-      long tb3 = query(c, tables[2], 3, 0, 2000000000, 5000, 500);
-      log.info("Bloom query complete");
-      timeCheck(t1 + t2 + t3, tb1 + tb2 + tb3);
-
-      // test querying for empty key
-      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");
+        // these queries should only run quickly if bloom filters are working, so lets get a base
+        log.info("Base query");
+        long t1 = query(c, tables[0], 1, 0, 2000000000, 5000, 500);
+        long t2 = query(c, tables[1], 2, 0, 2000000000, 5000, 500);
+        long t3 = query(c, tables[2], 3, 0, 2000000000, 5000, 500);
+        log.info("Base query complete");
+
+        log.info("Rewriting with bloom filters");
+        c.tableOperations().setProperty(tables[0], Property.TABLE_BLOOM_ENABLED.getKey(), "true");
+        c.tableOperations().setProperty(tables[0], Property.TABLE_BLOOM_KEY_FUNCTOR.getKey(),
+            RowFunctor.class.getName());
+
+        c.tableOperations().setProperty(tables[1], Property.TABLE_BLOOM_ENABLED.getKey(), "true");
+        c.tableOperations().setProperty(tables[1], Property.TABLE_BLOOM_KEY_FUNCTOR.getKey(),
+            ColumnFamilyFunctor.class.getName());
+
+        c.tableOperations().setProperty(tables[2], Property.TABLE_BLOOM_ENABLED.getKey(), "true");
+        c.tableOperations().setProperty(tables[2], Property.TABLE_BLOOM_KEY_FUNCTOR.getKey(),
+            ColumnQualifierFunctor.class.getName());
+
+        c.tableOperations().setProperty(tables[3], Property.TABLE_BLOOM_ENABLED.getKey(), "true");
+        c.tableOperations().setProperty(tables[3], Property.TABLE_BLOOM_KEY_FUNCTOR.getKey(),
+            RowFunctor.class.getName());
+
+        // ensure the updates to zookeeper propagate
+        UtilWaitThread.sleep(500);
+
+        c.tableOperations().compact(tables[3], null, null, false, true);
+        c.tableOperations().compact(tables[0], null, null, false, true);
+        c.tableOperations().compact(tables[1], null, null, false, true);
+        c.tableOperations().compact(tables[2], null, null, false, true);
+        log.info("Rewriting with bloom filters complete");
+
+        // these queries should only run quickly if bloom
+        // filters are working
+        log.info("Bloom query");
+        long tb1 = query(c, tables[0], 1, 0, 2000000000, 5000, 500);
+        long tb2 = query(c, tables[1], 2, 0, 2000000000, 5000, 500);
+        long tb3 = query(c, tables[2], 3, 0, 2000000000, 5000, 500);
+        log.info("Bloom query complete");
+        timeCheck(t1 + t2 + t3, tb1 + tb2 + tb3);
+
+        // test querying for empty key
+        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");
+          }
         }
+      } finally {
+        c.instanceOperations().setProperty(Property.TSERV_SCAN_EXECUTORS_DEFAULT_THREADS.getKey(),
+            readAhead);
       }
-    } finally {
-      c.instanceOperations().setProperty(Property.TSERV_SCAN_EXECUTORS_DEFAULT_THREADS.getKey(),
-          readAhead);
     }
   }
 
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 69d0a8e38f..da87e8407b 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
@@ -62,42 +62,43 @@ protected int defaultTimeoutSeconds() {
   @SuppressWarnings("deprecation")
   @Test
   public void testBulkFile() throws Exception {
-    AccumuloClient c = getAccumuloClient();
-    String tableName = getUniqueNames(1)[0];
-    c.tableOperations().create(tableName);
-    SortedSet<Text> splits = new TreeSet<>();
-    for (String split : "0333 0666 0999 1333 1666".split(" "))
-      splits.add(new Text(split));
-    c.tableOperations().addSplits(tableName, splits);
-    Configuration conf = new Configuration();
-    AccumuloConfiguration aconf = getCluster().getServerContext().getConfiguration();
-    FileSystem fs = getCluster().getFileSystem();
+    try (AccumuloClient c = getAccumuloClient()) {
+      String tableName = getUniqueNames(1)[0];
+      c.tableOperations().create(tableName);
+      SortedSet<Text> splits = new TreeSet<>();
+      for (String split : "0333 0666 0999 1333 1666".split(" "))
+        splits.add(new Text(split));
+      c.tableOperations().addSplits(tableName, splits);
+      Configuration conf = new Configuration();
+      AccumuloConfiguration aconf = getCluster().getServerContext().getConfiguration();
+      FileSystem fs = getCluster().getFileSystem();
 
-    String rootPath = cluster.getTemporaryPath().toString();
+      String rootPath = cluster.getTemporaryPath().toString();
 
-    String dir = rootPath + "/bulk_test_diff_files_89723987592_" + getUniqueNames(1)[0];
+      String dir = rootPath + "/bulk_test_diff_files_89723987592_" + getUniqueNames(1)[0];
 
-    fs.delete(new Path(dir), true);
+      fs.delete(new Path(dir), true);
 
-    writeData(conf, aconf, fs, dir, "f1", 0, 333);
-    writeData(conf, aconf, fs, dir, "f2", 334, 999);
-    writeData(conf, aconf, fs, dir, "f3", 1000, 1999);
+      writeData(conf, aconf, fs, dir, "f1", 0, 333);
+      writeData(conf, aconf, fs, dir, "f2", 334, 999);
+      writeData(conf, aconf, fs, dir, "f3", 1000, 1999);
 
-    String failDir = dir + "_failures";
-    Path failPath = new Path(failDir);
-    fs.delete(failPath, true);
-    fs.mkdirs(failPath);
+      String failDir = dir + "_failures";
+      Path failPath = new Path(failDir);
+      fs.delete(failPath, true);
+      fs.mkdirs(failPath);
 
-    // Ensure server can read/modify files
-    c.tableOperations().importDirectory(tableName, dir, failDir, false);
+      // Ensure server can read/modify files
+      c.tableOperations().importDirectory(tableName, dir, failDir, false);
 
-    if (fs.listStatus(failPath).length > 0) {
-      throw new Exception("Some files failed to bulk import");
-    }
+      if (fs.listStatus(failPath).length > 0) {
+        throw new Exception("Some files failed to bulk import");
+      }
 
-    FunctionalTestUtils.checkRFiles(c, tableName, 6, 6, 1, 1);
+      FunctionalTestUtils.checkRFiles(c, tableName, 6, 6, 1, 1);
 
-    verifyData(tableName, 0, 1999);
+      verifyData(c, tableName, 0, 1999);
+    }
 
   }
 
@@ -114,8 +115,8 @@ private void writeData(Configuration conf, AccumuloConfiguration aconf, FileSyst
     writer1.close();
   }
 
-  private void verifyData(String table, int s, int e) throws Exception {
-    try (Scanner scanner = getAccumuloClient().createScanner(table, Authorizations.EMPTY)) {
+  private void verifyData(AccumuloClient client, String table, int s, int e) throws Exception {
+    try (Scanner scanner = client.createScanner(table, Authorizations.EMPTY)) {
 
       Iterator<Entry<Key,Value>> iter = scanner.iterator();
 
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/BulkIT.java b/test/src/main/java/org/apache/accumulo/test/functional/BulkIT.java
index d90c8f813c..df88c83284 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/BulkIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/BulkIT.java
@@ -65,16 +65,20 @@ public void restoreConf() {
 
   @Test
   public void test() throws Exception {
-    runTest(getAccumuloClient(), getClientInfo(), getCluster().getFileSystem(),
-        getCluster().getTemporaryPath(), getUniqueNames(1)[0], this.getClass().getName(),
-        testName.getMethodName(), false);
+    try (AccumuloClient client = getAccumuloClient()) {
+      runTest(client, getClientInfo(), getCluster().getFileSystem(),
+          getCluster().getTemporaryPath(), getUniqueNames(1)[0], this.getClass().getName(),
+          testName.getMethodName(), false);
+    }
   }
 
   @Test
   public void testOld() throws Exception {
-    runTest(getAccumuloClient(), getClientInfo(), getCluster().getFileSystem(),
-        getCluster().getTemporaryPath(), getUniqueNames(1)[0], this.getClass().getName(),
-        testName.getMethodName(), true);
+    try (AccumuloClient client = getAccumuloClient()) {
+      runTest(client, getClientInfo(), getCluster().getFileSystem(),
+          getCluster().getTemporaryPath(), getUniqueNames(1)[0], this.getClass().getName(),
+          testName.getMethodName(), true);
+    }
   }
 
   static void runTest(AccumuloClient c, ClientInfo info, FileSystem fs, Path basePath,
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/BulkLoadIT.java b/test/src/main/java/org/apache/accumulo/test/functional/BulkLoadIT.java
index 3aadc9aef9..2316fda9ec 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/BulkLoadIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/BulkLoadIT.java
@@ -100,12 +100,13 @@ protected int defaultTimeoutSeconds() {
 
   @Before
   public void setupBulkTest() throws Exception {
-    AccumuloClient c = getAccumuloClient();
-    tableName = getUniqueNames(1)[0];
-    c.tableOperations().create(tableName);
-    aconf = getCluster().getServerContext().getConfiguration();
-    fs = getCluster().getFileSystem();
-    rootPath = cluster.getTemporaryPath().toString();
+    try (AccumuloClient c = getAccumuloClient()) {
+      tableName = getUniqueNames(1)[0];
+      c.tableOperations().create(tableName);
+      aconf = getCluster().getServerContext().getConfiguration();
+      fs = getCluster().getFileSystem();
+      rootPath = cluster.getTemporaryPath().toString();
+    }
   }
 
   private String getDir(String testName) throws Exception {
@@ -114,9 +115,8 @@ private String getDir(String testName) throws Exception {
     return dir;
   }
 
-  private void testSingleTabletSingleFile(boolean offline) throws Exception {
-    AccumuloClient c = getAccumuloClient();
-    addSplits(tableName, "0333");
+  private void testSingleTabletSingleFile(AccumuloClient c, boolean offline) throws Exception {
+    addSplits(c, tableName, "0333");
 
     if (offline)
       c.tableOperations().offline(tableName);
@@ -130,24 +130,27 @@ private void testSingleTabletSingleFile(boolean offline) throws Exception {
     if (offline)
       c.tableOperations().online(tableName);
 
-    verifyData(tableName, 0, 332);
-    verifyMetadata(tableName,
+    verifyData(c, tableName, 0, 332);
+    verifyMetadata(c, tableName,
         ImmutableMap.of("0333", ImmutableSet.of(h1), "null", ImmutableSet.of()));
   }
 
   @Test
   public void testSingleTabletSingleFile() throws Exception {
-    testSingleTabletSingleFile(false);
+    try (AccumuloClient client = getAccumuloClient()) {
+      testSingleTabletSingleFile(client, false);
+    }
   }
 
   @Test
   public void testSingleTabletSingleFileOffline() throws Exception {
-    testSingleTabletSingleFile(true);
+    try (AccumuloClient client = getAccumuloClient()) {
+      testSingleTabletSingleFile(client, true);
+    }
   }
 
-  private void testSingleTabletSingleFileNoSplits(boolean offline) throws Exception {
-    AccumuloClient c = getAccumuloClient();
-
+  private void testSingleTabletSingleFileNoSplits(AccumuloClient c, boolean offline)
+      throws Exception {
     if (offline)
       c.tableOperations().offline(tableName);
 
@@ -160,103 +163,109 @@ private void testSingleTabletSingleFileNoSplits(boolean offline) throws Exceptio
     if (offline)
       c.tableOperations().online(tableName);
 
-    verifyData(tableName, 0, 333);
-    verifyMetadata(tableName, ImmutableMap.of("null", ImmutableSet.of(h1)));
+    verifyData(c, tableName, 0, 333);
+    verifyMetadata(c, tableName, ImmutableMap.of("null", ImmutableSet.of(h1)));
   }
 
   @Test
   public void testSingleTabletSingleFileNoSplits() throws Exception {
-    testSingleTabletSingleFileNoSplits(false);
+    try (AccumuloClient client = getAccumuloClient()) {
+      testSingleTabletSingleFileNoSplits(client, false);
+    }
   }
 
   @Test
   public void testSingleTabletSingleFileNoSplitsOffline() throws Exception {
-    testSingleTabletSingleFileNoSplits(true);
+    try (AccumuloClient client = getAccumuloClient()) {
+      testSingleTabletSingleFileNoSplits(client, true);
+    }
   }
 
   @Test
   public void testBadPermissions() throws Exception {
-    AccumuloClient c = getAccumuloClient();
-    addSplits(tableName, "0333");
-
-    String dir = getDir("/testBadPermissions-");
-
-    writeData(dir + "/f1.", aconf, 0, 333);
-
-    Path rFilePath = new Path(dir, "f1." + RFile.EXTENSION);
-    FsPermission originalPerms = fs.getFileStatus(rFilePath).getPermission();
-    fs.setPermission(rFilePath, FsPermission.valueOf("----------"));
-    try {
-      c.tableOperations().importDirectory(dir).to(tableName).load();
-    } catch (Exception e) {
-      Throwable cause = e.getCause();
-      if (!(cause instanceof FileNotFoundException)
-          && !(cause.getCause() instanceof FileNotFoundException))
-        fail("Expected FileNotFoundException but threw " + e.getCause());
-    } finally {
-      fs.setPermission(rFilePath, originalPerms);
-    }
+    try (AccumuloClient c = getAccumuloClient()) {
+      addSplits(c, tableName, "0333");
+
+      String dir = getDir("/testBadPermissions-");
+
+      writeData(dir + "/f1.", aconf, 0, 333);
+
+      Path rFilePath = new Path(dir, "f1." + RFile.EXTENSION);
+      FsPermission originalPerms = fs.getFileStatus(rFilePath).getPermission();
+      fs.setPermission(rFilePath, FsPermission.valueOf("----------"));
+      try {
+        c.tableOperations().importDirectory(dir).to(tableName).load();
+      } catch (Exception e) {
+        Throwable cause = e.getCause();
+        if (!(cause instanceof FileNotFoundException)
+            && !(cause.getCause() instanceof FileNotFoundException))
+          fail("Expected FileNotFoundException but threw " + e.getCause());
+      } finally {
+        fs.setPermission(rFilePath, originalPerms);
+      }
 
-    originalPerms = fs.getFileStatus(new Path(dir)).getPermission();
-    fs.setPermission(new Path(dir), FsPermission.valueOf("dr--r--r--"));
-    try {
-      c.tableOperations().importDirectory(dir).to(tableName).load();
-    } catch (AccumuloException ae) {
-      if (!(ae.getCause() instanceof FileNotFoundException))
-        fail("Expected FileNotFoundException but threw " + ae.getCause());
-    } finally {
-      fs.setPermission(new Path(dir), originalPerms);
+      originalPerms = fs.getFileStatus(new Path(dir)).getPermission();
+      fs.setPermission(new Path(dir), FsPermission.valueOf("dr--r--r--"));
+      try {
+        c.tableOperations().importDirectory(dir).to(tableName).load();
+      } catch (AccumuloException ae) {
+        if (!(ae.getCause() instanceof FileNotFoundException))
+          fail("Expected FileNotFoundException but threw " + ae.getCause());
+      } finally {
+        fs.setPermission(new Path(dir), originalPerms);
+      }
     }
   }
 
   private void testBulkFile(boolean offline, boolean usePlan) throws Exception {
-    AccumuloClient c = getAccumuloClient();
-    addSplits(tableName, "0333 0666 0999 1333 1666");
+    try (AccumuloClient c = getAccumuloClient()) {
+      addSplits(c, tableName, "0333 0666 0999 1333 1666");
 
-    if (offline)
-      c.tableOperations().offline(tableName);
+      if (offline)
+        c.tableOperations().offline(tableName);
 
-    String dir = getDir("/testBulkFile-");
+      String dir = getDir("/testBulkFile-");
 
-    Map<String,Set<String>> hashes = new HashMap<>();
-    for (String endRow : Arrays.asList("0333 0666 0999 1333 1666 null".split(" "))) {
-      hashes.put(endRow, new HashSet<>());
-    }
-
-    // 1 Tablet 0333-null
-    String h1 = writeData(dir + "/f1.", aconf, 0, 333);
-    hashes.get("0333").add(h1);
-
-    // 2 Tablets 0666-0334, 0999-0667
-    String h2 = writeData(dir + "/f2.", aconf, 334, 999);
-    hashes.get("0666").add(h2);
-    hashes.get("0999").add(h2);
+      Map<String,Set<String>> hashes = new HashMap<>();
+      for (String endRow : Arrays.asList("0333 0666 0999 1333 1666 null".split(" "))) {
+        hashes.put(endRow, new HashSet<>());
+      }
 
-    // 2 Tablets 1333-1000, 1666-1334
-    String h3 = writeData(dir + "/f3.", aconf, 1000, 1499);
-    hashes.get("1333").add(h3);
-    hashes.get("1666").add(h3);
+      // 1 Tablet 0333-null
+      String h1 = writeData(dir + "/f1.", aconf, 0, 333);
+      hashes.get("0333").add(h1);
+
+      // 2 Tablets 0666-0334, 0999-0667
+      String h2 = writeData(dir + "/f2.", aconf, 334, 999);
+      hashes.get("0666").add(h2);
+      hashes.get("0999").add(h2);
+
+      // 2 Tablets 1333-1000, 1666-1334
+      String h3 = writeData(dir + "/f3.", aconf, 1000, 1499);
+      hashes.get("1333").add(h3);
+      hashes.get("1666").add(h3);
+
+      // 2 Tablets 1666-1334, >1666
+      String h4 = writeData(dir + "/f4.", aconf, 1500, 1999);
+      hashes.get("1666").add(h4);
+      hashes.get("null").add(h4);
+
+      if (usePlan) {
+        LoadPlan loadPlan = LoadPlan.builder().loadFileTo("f1.rf", RangeType.TABLE, null, row(333))
+            .loadFileTo("f2.rf", RangeType.TABLE, row(333), row(999))
+            .loadFileTo("f3.rf", RangeType.FILE, row(1000), row(1499))
+            .loadFileTo("f4.rf", RangeType.FILE, row(1500), row(1999)).build();
+        c.tableOperations().importDirectory(dir).to(tableName).plan(loadPlan).load();
+      } else {
+        c.tableOperations().importDirectory(dir).to(tableName).load();
+      }
 
-    // 2 Tablets 1666-1334, >1666
-    String h4 = writeData(dir + "/f4.", aconf, 1500, 1999);
-    hashes.get("1666").add(h4);
-    hashes.get("null").add(h4);
+      if (offline)
+        c.tableOperations().online(tableName);
 
-    if (usePlan) {
-      LoadPlan loadPlan = LoadPlan.builder().loadFileTo("f1.rf", RangeType.TABLE, null, row(333))
-          .loadFileTo("f2.rf", RangeType.TABLE, row(333), row(999))
-          .loadFileTo("f3.rf", RangeType.FILE, row(1000), row(1499))
-          .loadFileTo("f4.rf", RangeType.FILE, row(1500), row(1999)).build();
-      c.tableOperations().importDirectory(dir).to(tableName).plan(loadPlan).load();
-    } else {
-      c.tableOperations().importDirectory(dir).to(tableName).load();
+      verifyData(c, tableName, 0, 1999);
+      verifyMetadata(c, tableName, hashes);
     }
-
-    if (offline)
-      c.tableOperations().online(tableName);
-
-    verifyData(tableName, 0, 1999);
-    verifyMetadata(tableName, hashes);
   }
 
   @Test
@@ -281,54 +290,56 @@ public void testLoadPlanOffline() throws Exception {
 
   @Test
   public void testBadLoadPlans() throws Exception {
-    AccumuloClient c = getAccumuloClient();
-    addSplits(tableName, "0333 0666 0999 1333 1666");
+    try (AccumuloClient c = getAccumuloClient()) {
+      addSplits(c, tableName, "0333 0666 0999 1333 1666");
 
-    String dir = getDir("/testBulkFile-");
+      String dir = getDir("/testBulkFile-");
 
-    writeData(dir + "/f1.", aconf, 0, 333);
-    writeData(dir + "/f2.", aconf, 0, 666);
+      writeData(dir + "/f1.", aconf, 0, 333);
+      writeData(dir + "/f2.", aconf, 0, 666);
 
-    // Create a plan with more files than exists in dir
-    LoadPlan loadPlan = LoadPlan.builder().loadFileTo("f1.rf", RangeType.TABLE, null, row(333))
-        .loadFileTo("f2.rf", RangeType.TABLE, null, row(666))
-        .loadFileTo("f3.rf", RangeType.TABLE, null, row(666)).build();
-    try {
-      c.tableOperations().importDirectory(dir).to(tableName).plan(loadPlan).load();
-      fail();
-    } catch (IllegalArgumentException e) {
-      // ignore
-    }
+      // Create a plan with more files than exists in dir
+      LoadPlan loadPlan = LoadPlan.builder().loadFileTo("f1.rf", RangeType.TABLE, null, row(333))
+          .loadFileTo("f2.rf", RangeType.TABLE, null, row(666))
+          .loadFileTo("f3.rf", RangeType.TABLE, null, row(666)).build();
+      try {
+        c.tableOperations().importDirectory(dir).to(tableName).plan(loadPlan).load();
+        fail();
+      } catch (IllegalArgumentException e) {
+        // ignore
+      }
 
-    // Create a plan with less files than exists in dir
-    loadPlan = LoadPlan.builder().loadFileTo("f1.rf", RangeType.TABLE, null, row(333)).build();
-    try {
-      c.tableOperations().importDirectory(dir).to(tableName).plan(loadPlan).load();
-      fail();
-    } catch (IllegalArgumentException e) {
-      // ignore
-    }
+      // Create a plan with less files than exists in dir
+      loadPlan = LoadPlan.builder().loadFileTo("f1.rf", RangeType.TABLE, null, row(333)).build();
+      try {
+        c.tableOperations().importDirectory(dir).to(tableName).plan(loadPlan).load();
+        fail();
+      } catch (IllegalArgumentException e) {
+        // ignore
+      }
 
-    // Create a plan with tablet boundary that does not exits
-    loadPlan = LoadPlan.builder().loadFileTo("f1.rf", RangeType.TABLE, null, row(555))
-        .loadFileTo("f2.rf", RangeType.TABLE, null, row(555)).build();
-    try {
-      c.tableOperations().importDirectory(dir).to(tableName).plan(loadPlan).load();
-      fail();
-    } catch (AccumuloException e) {
-      // ignore
+      // Create a plan with tablet boundary that does not exits
+      loadPlan = LoadPlan.builder().loadFileTo("f1.rf", RangeType.TABLE, null, row(555))
+          .loadFileTo("f2.rf", RangeType.TABLE, null, row(555)).build();
+      try {
+        c.tableOperations().importDirectory(dir).to(tableName).plan(loadPlan).load();
+        fail();
+      } catch (AccumuloException e) {
+        // ignore
+      }
     }
   }
 
-  private void addSplits(String tableName, String splitString) throws Exception {
+  private void addSplits(AccumuloClient client, String tableName, String splitString)
+      throws Exception {
     SortedSet<Text> splits = new TreeSet<>();
     for (String split : splitString.split(" "))
       splits.add(new Text(split));
-    getAccumuloClient().tableOperations().addSplits(tableName, splits);
+    client.tableOperations().addSplits(tableName, splits);
   }
 
-  private void verifyData(String table, int s, int e) throws Exception {
-    try (Scanner scanner = getAccumuloClient().createScanner(table, Authorizations.EMPTY)) {
+  private void verifyData(AccumuloClient client, String table, int s, int e) throws Exception {
+    try (Scanner scanner = client.createScanner(table, Authorizations.EMPTY)) {
 
       Iterator<Entry<Key,Value>> iter = scanner.iterator();
 
@@ -352,15 +363,14 @@ private void verifyData(String table, int s, int e) throws Exception {
     }
   }
 
-  private void verifyMetadata(String tableName, Map<String,Set<String>> expectedHashes)
-      throws Exception {
+  private void verifyMetadata(AccumuloClient client, String tableName,
+      Map<String,Set<String>> expectedHashes) throws Exception {
 
     Set<String> endRowsSeen = new HashSet<>();
 
-    String id = getAccumuloClient().tableOperations().tableIdMap().get(tableName);
-    try (MetadataScanner scanner = MetadataScanner.builder().from(getAccumuloClient())
-        .scanMetadataTable().overRange(Table.ID.of(id)).fetchFiles().fetchLoaded().fetchPrev()
-        .build()) {
+    String id = client.tableOperations().tableIdMap().get(tableName);
+    try (MetadataScanner scanner = MetadataScanner.builder().from(client).scanMetadataTable()
+        .overRange(Table.ID.of(id)).fetchFiles().fetchLoaded().fetchPrev().build()) {
       for (TabletMetadata tablet : scanner) {
         assertTrue(tablet.getLoaded().isEmpty());
 
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/BulkSplitOptimizationIT.java b/test/src/main/java/org/apache/accumulo/test/functional/BulkSplitOptimizationIT.java
index 131c479cb9..8908390582 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/BulkSplitOptimizationIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/BulkSplitOptimizationIT.java
@@ -55,23 +55,25 @@ protected int defaultTimeoutSeconds() {
 
   @Before
   public void alterConfig() throws Exception {
-    AccumuloClient client = getAccumuloClient();
-    majcDelay = client.instanceOperations().getSystemConfiguration()
-        .get(Property.TSERV_MAJC_DELAY.getKey());
-    if (!"1s".equals(majcDelay)) {
-      client.instanceOperations().setProperty(Property.TSERV_MAJC_DELAY.getKey(), "1s");
-      getClusterControl().stopAllServers(ServerType.TABLET_SERVER);
-      getClusterControl().startAllServers(ServerType.TABLET_SERVER);
+    try (AccumuloClient client = getAccumuloClient()) {
+      majcDelay = client.instanceOperations().getSystemConfiguration()
+          .get(Property.TSERV_MAJC_DELAY.getKey());
+      if (!"1s".equals(majcDelay)) {
+        client.instanceOperations().setProperty(Property.TSERV_MAJC_DELAY.getKey(), "1s");
+        getClusterControl().stopAllServers(ServerType.TABLET_SERVER);
+        getClusterControl().startAllServers(ServerType.TABLET_SERVER);
+      }
     }
   }
 
   @After
   public void resetConfig() throws Exception {
     if (null != majcDelay) {
-      AccumuloClient client = getAccumuloClient();
-      client.instanceOperations().setProperty(Property.TSERV_MAJC_DELAY.getKey(), majcDelay);
-      getClusterControl().stopAllServers(ServerType.TABLET_SERVER);
-      getClusterControl().startAllServers(ServerType.TABLET_SERVER);
+      try (AccumuloClient client = getAccumuloClient()) {
+        client.instanceOperations().setProperty(Property.TSERV_MAJC_DELAY.getKey(), majcDelay);
+        getClusterControl().stopAllServers(ServerType.TABLET_SERVER);
+        getClusterControl().startAllServers(ServerType.TABLET_SERVER);
+      }
     }
   }
 
@@ -80,48 +82,48 @@ public void resetConfig() throws Exception {
 
   @Test
   public void testBulkSplitOptimization() throws Exception {
-    final AccumuloClient c = getAccumuloClient();
-    final String tableName = getUniqueNames(1)[0];
-    c.tableOperations().create(tableName);
-    c.tableOperations().setProperty(tableName, Property.TABLE_MAJC_RATIO.getKey(), "1000");
-    c.tableOperations().setProperty(tableName, Property.TABLE_FILE_MAX.getKey(), "1000");
-    c.tableOperations().setProperty(tableName, Property.TABLE_SPLIT_THRESHOLD.getKey(), "1G");
-    FileSystem fs = cluster.getFileSystem();
-    Path testDir = new Path(getUsableDir(), "testmf");
-    FunctionalTestUtils.createRFiles(c, fs, testDir.toString(), ROWS, SPLITS, 8);
-    FileStatus[] stats = fs.listStatus(testDir);
-
-    System.out.println("Number of generated files: " + stats.length);
-    c.tableOperations().importDirectory(testDir.toString()).to(tableName).load();
-    FunctionalTestUtils.checkSplits(c, tableName, 0, 0);
-    FunctionalTestUtils.checkRFiles(c, tableName, 1, 1, 100, 100);
-
-    // initiate splits
-    getAccumuloClient().tableOperations().setProperty(tableName,
-        Property.TABLE_SPLIT_THRESHOLD.getKey(), "100K");
-
-    sleepUninterruptibly(2, TimeUnit.SECONDS);
-
-    // wait until over split threshold -- should be 78 splits
-    while (getAccumuloClient().tableOperations().listSplits(tableName).size() < 75) {
-      sleepUninterruptibly(500, TimeUnit.MILLISECONDS);
+    try (AccumuloClient c = getAccumuloClient()) {
+      final String tableName = getUniqueNames(1)[0];
+      c.tableOperations().create(tableName);
+      c.tableOperations().setProperty(tableName, Property.TABLE_MAJC_RATIO.getKey(), "1000");
+      c.tableOperations().setProperty(tableName, Property.TABLE_FILE_MAX.getKey(), "1000");
+      c.tableOperations().setProperty(tableName, Property.TABLE_SPLIT_THRESHOLD.getKey(), "1G");
+      FileSystem fs = cluster.getFileSystem();
+      Path testDir = new Path(getUsableDir(), "testmf");
+      FunctionalTestUtils.createRFiles(c, fs, testDir.toString(), ROWS, SPLITS, 8);
+      FileStatus[] stats = fs.listStatus(testDir);
+
+      System.out.println("Number of generated files: " + stats.length);
+      c.tableOperations().importDirectory(testDir.toString()).to(tableName).load();
+      FunctionalTestUtils.checkSplits(c, tableName, 0, 0);
+      FunctionalTestUtils.checkRFiles(c, tableName, 1, 1, 100, 100);
+
+      // initiate splits
+      c.tableOperations().setProperty(tableName, Property.TABLE_SPLIT_THRESHOLD.getKey(), "100K");
+
+      sleepUninterruptibly(2, TimeUnit.SECONDS);
+
+      // wait until over split threshold -- should be 78 splits
+      while (c.tableOperations().listSplits(tableName).size() < 75) {
+        sleepUninterruptibly(500, TimeUnit.MILLISECONDS);
+      }
+
+      FunctionalTestUtils.checkSplits(c, tableName, 50, 100);
+      VerifyIngest.Opts opts = new VerifyIngest.Opts();
+      opts.timestamp = 1;
+      opts.dataSize = 50;
+      opts.random = 56;
+      opts.rows = 100000;
+      opts.startRow = 0;
+      opts.cols = 1;
+      opts.setTableName(tableName);
+
+      opts.setClientInfo(getClientInfo());
+      VerifyIngest.verifyIngest(c, opts, new ScannerOpts());
+
+      // ensure each tablet does not have all map files, should be ~2.5 files per tablet
+      FunctionalTestUtils.checkRFiles(c, tableName, 50, 100, 1, 4);
     }
-
-    FunctionalTestUtils.checkSplits(c, tableName, 50, 100);
-    VerifyIngest.Opts opts = new VerifyIngest.Opts();
-    opts.timestamp = 1;
-    opts.dataSize = 50;
-    opts.random = 56;
-    opts.rows = 100000;
-    opts.startRow = 0;
-    opts.cols = 1;
-    opts.setTableName(tableName);
-
-    opts.setClientInfo(getClientInfo());
-    VerifyIngest.verifyIngest(c, opts, new ScannerOpts());
-
-    // ensure each tablet does not have all map files, should be ~2.5 files per tablet
-    FunctionalTestUtils.checkRFiles(c, tableName, 50, 100, 1, 4);
   }
 
 }
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/ChaoticBalancerIT.java b/test/src/main/java/org/apache/accumulo/test/functional/ChaoticBalancerIT.java
index 504779f2ee..f322e29e5c 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/ChaoticBalancerIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/ChaoticBalancerIT.java
@@ -53,25 +53,26 @@ protected int defaultTimeoutSeconds() {
 
   @Test
   public void test() throws Exception {
-    AccumuloClient c = getAccumuloClient();
-    String[] names = getUniqueNames(1);
-    String tableName = names[0];
-    NewTableConfiguration ntc = new NewTableConfiguration();
-    ntc.setProperties(Stream
-        .of(new Pair<>(Property.TABLE_SPLIT_THRESHOLD.getKey(), "10K"),
-            new Pair<>(Property.TABLE_FILE_COMPRESSED_BLOCK_SIZE.getKey(), "1K"))
-        .collect(Collectors.toMap(k -> k.getFirst(), v -> v.getSecond())));
-    c.tableOperations().create(tableName, ntc);
+    try (AccumuloClient c = getAccumuloClient()) {
+      String[] names = getUniqueNames(1);
+      String tableName = names[0];
+      NewTableConfiguration ntc = new NewTableConfiguration();
+      ntc.setProperties(Stream
+          .of(new Pair<>(Property.TABLE_SPLIT_THRESHOLD.getKey(), "10K"),
+              new Pair<>(Property.TABLE_FILE_COMPRESSED_BLOCK_SIZE.getKey(), "1K"))
+          .collect(Collectors.toMap(k -> k.getFirst(), v -> v.getSecond())));
+      c.tableOperations().create(tableName, ntc);
 
-    TestIngest.Opts opts = new TestIngest.Opts();
-    VerifyIngest.Opts vopts = new VerifyIngest.Opts();
-    vopts.rows = opts.rows = 20000;
-    opts.setTableName(tableName);
-    vopts.setTableName(tableName);
-    opts.setClientInfo(getClientInfo());
-    vopts.setClientInfo(getClientInfo());
-    TestIngest.ingest(c, opts, new BatchWriterOpts());
-    c.tableOperations().flush(tableName, null, null, true);
-    VerifyIngest.verifyIngest(c, vopts, new ScannerOpts());
+      TestIngest.Opts opts = new TestIngest.Opts();
+      VerifyIngest.Opts vopts = new VerifyIngest.Opts();
+      vopts.rows = opts.rows = 20000;
+      opts.setTableName(tableName);
+      vopts.setTableName(tableName);
+      opts.setClientInfo(getClientInfo());
+      vopts.setClientInfo(getClientInfo());
+      TestIngest.ingest(c, opts, new BatchWriterOpts());
+      c.tableOperations().flush(tableName, null, null, true);
+      VerifyIngest.verifyIngest(c, vopts, new ScannerOpts());
+    }
   }
 }
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 e1f9faca0a..9f82339d2e 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
@@ -88,30 +88,31 @@ private static void copyStreamToFileSystem(FileSystem fs, String jarName, Path p
 
   @Test
   public void test() throws Exception {
-    AccumuloClient c = getAccumuloClient();
-    String tableName = getUniqueNames(1)[0];
-    c.tableOperations().create(tableName);
-    BatchWriter bw = c.createBatchWriter(tableName, new BatchWriterConfig());
-    Mutation m = new Mutation("row1");
-    m.put("cf", "col1", "Test");
-    bw.addMutation(m);
-    bw.close();
-    scanCheck(c, tableName, "Test");
-    FileSystem fs = getCluster().getFileSystem();
-    Path jarPath = new Path(rootPath + "/lib/ext/Test.jar");
-    copyStreamToFileSystem(fs, "/TestCombinerX.jar", jarPath);
-    sleepUninterruptibly(1, TimeUnit.SECONDS);
-    IteratorSetting is = new IteratorSetting(10, "TestCombiner",
-        "org.apache.accumulo.test.functional.TestCombiner");
-    Combiner.setColumns(is, Collections.singletonList(new IteratorSetting.Column("cf")));
-    c.tableOperations().attachIterator(tableName, is, EnumSet.of(IteratorScope.scan));
-    sleepUninterruptibly(ZOOKEEPER_PROPAGATION_TIME, TimeUnit.MILLISECONDS);
-    scanCheck(c, tableName, "TestX");
-    fs.delete(jarPath, true);
-    copyStreamToFileSystem(fs, "/TestCombinerY.jar", jarPath);
-    sleepUninterruptibly(5, TimeUnit.SECONDS);
-    scanCheck(c, tableName, "TestY");
-    fs.delete(jarPath, true);
+    try (AccumuloClient c = getAccumuloClient()) {
+      String tableName = getUniqueNames(1)[0];
+      c.tableOperations().create(tableName);
+      BatchWriter bw = c.createBatchWriter(tableName, new BatchWriterConfig());
+      Mutation m = new Mutation("row1");
+      m.put("cf", "col1", "Test");
+      bw.addMutation(m);
+      bw.close();
+      scanCheck(c, tableName, "Test");
+      FileSystem fs = getCluster().getFileSystem();
+      Path jarPath = new Path(rootPath + "/lib/ext/Test.jar");
+      copyStreamToFileSystem(fs, "/TestCombinerX.jar", jarPath);
+      sleepUninterruptibly(1, TimeUnit.SECONDS);
+      IteratorSetting is = new IteratorSetting(10, "TestCombiner",
+          "org.apache.accumulo.test.functional.TestCombiner");
+      Combiner.setColumns(is, Collections.singletonList(new IteratorSetting.Column("cf")));
+      c.tableOperations().attachIterator(tableName, is, EnumSet.of(IteratorScope.scan));
+      sleepUninterruptibly(ZOOKEEPER_PROPAGATION_TIME, TimeUnit.MILLISECONDS);
+      scanCheck(c, tableName, "TestX");
+      fs.delete(jarPath, true);
+      copyStreamToFileSystem(fs, "/TestCombinerY.jar", jarPath);
+      sleepUninterruptibly(5, TimeUnit.SECONDS);
+      scanCheck(c, tableName, "TestY");
+      fs.delete(jarPath, true);
+    }
   }
 
   private void scanCheck(AccumuloClient c, String tableName, String expected) throws Exception {
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 0b0b178a81..69c13cb161 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
@@ -65,51 +65,52 @@ protected int defaultTimeoutSeconds() {
 
   @Test
   public void test() throws Exception {
-    AccumuloClient c = getClient();
-    // make a table
-    String tableName = getUniqueNames(1)[0];
-    c.tableOperations().create(tableName);
-    // write to it
-    BatchWriter bw = c.createBatchWriter(tableName, new BatchWriterConfig());
-    Mutation m = new Mutation("row");
-    m.put("cf", "cq", "value");
-    bw.addMutation(m);
-    bw.flush();
+    try (AccumuloClient c = getClient()) {
+      // make a table
+      String tableName = getUniqueNames(1)[0];
+      c.tableOperations().create(tableName);
+      // write to it
+      BatchWriter bw = c.createBatchWriter(tableName, new BatchWriterConfig());
+      Mutation m = new Mutation("row");
+      m.put("cf", "cq", "value");
+      bw.addMutation(m);
+      bw.flush();
 
-    // Compact memory to make a file
-    c.tableOperations().compact(tableName, null, null, true, true);
+      // Compact memory to make a file
+      c.tableOperations().compact(tableName, null, null, true, true);
 
-    // Make sure that we'll have a WAL
-    m = new Mutation("row2");
-    m.put("cf", "cq", "value");
-    bw.addMutation(m);
-    bw.close();
+      // Make sure that we'll have a WAL
+      m = new Mutation("row2");
+      m.put("cf", "cq", "value");
+      bw.addMutation(m);
+      bw.close();
 
-    // create a fake _tmp file in its directory
-    String id = c.tableOperations().tableIdMap().get(tableName);
-    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());
-    }
+      // create a fake _tmp file in its directory
+      String id = c.tableOperations().tableIdMap().get(tableName);
+      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));
-    Path tabletDir = file.getParent();
-    assertNotNull("Tablet dir should not be null", tabletDir);
-    Path tmp = new Path(tabletDir, "junk.rf_tmp");
-    // Make the file
-    fs.create(tmp).close();
-    log.info("Created tmp file {}", tmp);
-    getCluster().stop();
-    getCluster().start();
+      FileSystem fs = getCluster().getFileSystem();
+      assertTrue("Could not find file: " + file, fs.exists(file));
+      Path tabletDir = file.getParent();
+      assertNotNull("Tablet dir should not be null", tabletDir);
+      Path tmp = new Path(tabletDir, "junk.rf_tmp");
+      // Make the file
+      fs.create(tmp).close();
+      log.info("Created tmp file {}", tmp);
+      getCluster().stop();
+      getCluster().start();
 
-    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));
+      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 bc7cae174d..2dbcb0e2b3 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
@@ -30,7 +30,7 @@
 import org.apache.accumulo.core.data.Mutation;
 import org.apache.accumulo.core.data.Value;
 import org.apache.accumulo.core.security.Authorizations;
-import org.apache.accumulo.core.util.CleanUp;
+import org.apache.accumulo.core.singletons.SingletonManager;
 import org.apache.accumulo.harness.SharedMiniClusterBase;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
@@ -64,13 +64,23 @@ public static void teardown() throws Exception {
     SharedMiniClusterBase.stopMiniCluster();
   }
 
+  @SuppressWarnings("deprecation")
   @Test
   public void run() throws Exception {
 
+    // CleanUp for Connectors will not work if there are active AccumuloClients
+    assertEquals(0, SingletonManager.getReservationCount());
+
+    // CleanUp was created to clean up after connectors. This test intentionally creates a connector
+    // instead of an AccumuloClient
+    org.apache.accumulo.core.client.Connector conn = new org.apache.accumulo.core.client.ZooKeeperInstance(
+        getCluster().getInstanceName(), getCluster().getZooKeepers()).getConnector(getPrincipal(),
+            getToken());
+
     String tableName = getUniqueNames(1)[0];
-    getClient().tableOperations().create(tableName);
+    conn.tableOperations().create(tableName);
 
-    BatchWriter bw = getClient().createBatchWriter(tableName, new BatchWriterConfig());
+    BatchWriter bw = conn.createBatchWriter(tableName, new BatchWriterConfig());
 
     Mutation m1 = new Mutation("r1");
     m1.put("cf1", "cq1", 1, "5");
@@ -79,7 +89,7 @@ public void run() throws Exception {
 
     bw.flush();
 
-    try (Scanner scanner = getClient().createScanner(tableName, new Authorizations())) {
+    try (Scanner scanner = conn.createScanner(tableName, new Authorizations())) {
 
       int count = 0;
       for (Entry<Key,Value> entry : scanner) {
@@ -97,7 +107,7 @@ public void run() throws Exception {
         fail("Not seeing expected threads. Saw " + threadCount);
       }
 
-      CleanUp.shutdownNow();
+      org.apache.accumulo.core.util.CleanUp.shutdownNow();
 
       Mutation m2 = new Mutation("r2");
       m2.put("cf1", "cq1", 1, "6");
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 5b54df6bb5..048ddb5a92 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
@@ -71,49 +71,49 @@ public void testProps() throws Exception {
     String table1 = tableNames[0];
     String table2 = tableNames[1];
 
-    AccumuloClient c = getAccumuloClient();
+    try (AccumuloClient c = getAccumuloClient()) {
 
-    c.tableOperations().create(table1);
+      c.tableOperations().create(table1);
 
-    c.tableOperations().setProperty(table1, Property.TABLE_FILE_COMPRESSED_BLOCK_SIZE.getKey(),
-        "1M");
-    c.tableOperations().setProperty(table1,
-        Property.TABLE_FILE_COMPRESSED_BLOCK_SIZE_INDEX.getKey(), "2M");
-    c.tableOperations().setProperty(table1, Property.TABLE_FILE_MAX.getKey(), "23");
+      c.tableOperations().setProperty(table1, Property.TABLE_FILE_COMPRESSED_BLOCK_SIZE.getKey(),
+          "1M");
+      c.tableOperations().setProperty(table1,
+          Property.TABLE_FILE_COMPRESSED_BLOCK_SIZE_INDEX.getKey(), "2M");
+      c.tableOperations().setProperty(table1, Property.TABLE_FILE_MAX.getKey(), "23");
 
-    BatchWriter bw = writeData(table1, c);
+      BatchWriter bw = writeData(table1, c);
 
-    Map<String,String> props = new HashMap<>();
-    props.put(Property.TABLE_FILE_COMPRESSED_BLOCK_SIZE.getKey(), "500K");
+      Map<String,String> props = new HashMap<>();
+      props.put(Property.TABLE_FILE_COMPRESSED_BLOCK_SIZE.getKey(), "500K");
 
-    Set<String> exclude = new HashSet<>();
-    exclude.add(Property.TABLE_FILE_MAX.getKey());
+      Set<String> exclude = new HashSet<>();
+      exclude.add(Property.TABLE_FILE_MAX.getKey());
 
-    c.tableOperations().clone(table1, table2, true, props, exclude);
+      c.tableOperations().clone(table1, table2, true, props, exclude);
 
-    Mutation m3 = new Mutation("009");
-    m3.put("data", "x", "1");
-    m3.put("data", "y", "2");
-    bw.addMutation(m3);
-    bw.close();
+      Mutation m3 = new Mutation("009");
+      m3.put("data", "x", "1");
+      m3.put("data", "y", "2");
+      bw.addMutation(m3);
+      bw.close();
 
-    checkData(table2, c);
+      checkData(table2, c);
 
-    checkMetadata(table2, c);
+      checkMetadata(table2, c);
 
-    HashMap<String,String> tableProps = new HashMap<>();
-    for (Entry<String,String> prop : c.tableOperations().getProperties(table2)) {
-      tableProps.put(prop.getKey(), prop.getValue());
-    }
-
-    assertEquals("500K", tableProps.get(Property.TABLE_FILE_COMPRESSED_BLOCK_SIZE.getKey()));
-    assertEquals(Property.TABLE_FILE_MAX.getDefaultValue(),
-        tableProps.get(Property.TABLE_FILE_MAX.getKey()));
-    assertEquals("2M", tableProps.get(Property.TABLE_FILE_COMPRESSED_BLOCK_SIZE_INDEX.getKey()));
+      HashMap<String,String> tableProps = new HashMap<>();
+      for (Entry<String,String> prop : c.tableOperations().getProperties(table2)) {
+        tableProps.put(prop.getKey(), prop.getValue());
+      }
 
-    c.tableOperations().delete(table1);
-    c.tableOperations().delete(table2);
+      assertEquals("500K", tableProps.get(Property.TABLE_FILE_COMPRESSED_BLOCK_SIZE.getKey()));
+      assertEquals(Property.TABLE_FILE_MAX.getDefaultValue(),
+          tableProps.get(Property.TABLE_FILE_MAX.getKey()));
+      assertEquals("2M", tableProps.get(Property.TABLE_FILE_COMPRESSED_BLOCK_SIZE_INDEX.getKey()));
 
+      c.tableOperations().delete(table1);
+      c.tableOperations().delete(table2);
+    }
   }
 
   private void checkData(String table2, AccumuloClient c) throws TableNotFoundException {
@@ -205,99 +205,99 @@ public void testDeleteClone() throws Exception {
     String table2 = tableNames[1];
     String table3 = tableNames[2];
 
-    AccumuloClient c = getAccumuloClient();
-    AccumuloCluster cluster = getCluster();
-    Assume.assumeTrue(cluster instanceof MiniAccumuloClusterImpl);
-    MiniAccumuloClusterImpl mac = (MiniAccumuloClusterImpl) cluster;
-    String rootPath = mac.getConfig().getDir().getAbsolutePath();
-
-    // verify that deleting a new table removes the files
-    c.tableOperations().create(table3);
-    writeData(table3, c).close();
-    c.tableOperations().flush(table3, null, null, true);
-    // check for files
-    FileSystem fs = getCluster().getFileSystem();
-    String id = c.tableOperations().tableIdMap().get(table3);
-    FileStatus[] status = fs.listStatus(new Path(rootPath + "/accumulo/tables/" + id));
-    assertTrue(status.length > 0);
-    // verify disk usage
-    List<DiskUsage> diskUsage = c.tableOperations().getDiskUsage(Collections.singleton(table3));
-    assertEquals(1, diskUsage.size());
-    assertTrue(diskUsage.get(0).getUsage() > 100);
-    // delete the table
-    c.tableOperations().delete(table3);
-    // verify its gone from the file system
-    Path tablePath = new Path(rootPath + "/accumulo/tables/" + id);
-    if (fs.exists(tablePath)) {
-      status = fs.listStatus(tablePath);
-      assertTrue(status == null || status.length == 0);
-    }
-
-    c.tableOperations().create(table1);
+    try (AccumuloClient c = getAccumuloClient()) {
+      AccumuloCluster cluster = getCluster();
+      Assume.assumeTrue(cluster instanceof MiniAccumuloClusterImpl);
+      MiniAccumuloClusterImpl mac = (MiniAccumuloClusterImpl) cluster;
+      String rootPath = mac.getConfig().getDir().getAbsolutePath();
+
+      // verify that deleting a new table removes the files
+      c.tableOperations().create(table3);
+      writeData(table3, c).close();
+      c.tableOperations().flush(table3, null, null, true);
+      // check for files
+      FileSystem fs = getCluster().getFileSystem();
+      String id = c.tableOperations().tableIdMap().get(table3);
+      FileStatus[] status = fs.listStatus(new Path(rootPath + "/accumulo/tables/" + id));
+      assertTrue(status.length > 0);
+      // verify disk usage
+      List<DiskUsage> diskUsage = c.tableOperations().getDiskUsage(Collections.singleton(table3));
+      assertEquals(1, diskUsage.size());
+      assertTrue(diskUsage.get(0).getUsage() > 100);
+      // delete the table
+      c.tableOperations().delete(table3);
+      // verify its gone from the file system
+      Path tablePath = new Path(rootPath + "/accumulo/tables/" + id);
+      if (fs.exists(tablePath)) {
+        status = fs.listStatus(tablePath);
+        assertTrue(status == null || status.length == 0);
+      }
 
-    BatchWriter bw = writeData(table1, c);
+      c.tableOperations().create(table1);
 
-    Map<String,String> props = new HashMap<>();
-    props.put(Property.TABLE_FILE_COMPRESSED_BLOCK_SIZE.getKey(), "500K");
+      BatchWriter bw = writeData(table1, c);
 
-    Set<String> exclude = new HashSet<>();
-    exclude.add(Property.TABLE_FILE_MAX.getKey());
+      Map<String,String> props = new HashMap<>();
+      props.put(Property.TABLE_FILE_COMPRESSED_BLOCK_SIZE.getKey(), "500K");
 
-    c.tableOperations().clone(table1, table2, true, props, exclude);
+      Set<String> exclude = new HashSet<>();
+      exclude.add(Property.TABLE_FILE_MAX.getKey());
 
-    Mutation m3 = new Mutation("009");
-    m3.put("data", "x", "1");
-    m3.put("data", "y", "2");
-    bw.addMutation(m3);
-    bw.close();
+      c.tableOperations().clone(table1, table2, true, props, exclude);
 
-    // delete source table, should not affect clone
-    c.tableOperations().delete(table1);
+      Mutation m3 = new Mutation("009");
+      m3.put("data", "x", "1");
+      m3.put("data", "y", "2");
+      bw.addMutation(m3);
+      bw.close();
 
-    checkData(table2, c);
+      // delete source table, should not affect clone
+      c.tableOperations().delete(table1);
 
-    c.tableOperations().compact(table2, null, null, true, true);
+      checkData(table2, c);
 
-    checkData(table2, c);
+      c.tableOperations().compact(table2, null, null, true, true);
 
-    c.tableOperations().delete(table2);
+      checkData(table2, c);
 
+      c.tableOperations().delete(table2);
+    }
   }
 
   @Test
   public void testCloneWithSplits() throws Exception {
-    AccumuloClient client = getAccumuloClient();
-
-    List<Mutation> mutations = new ArrayList<>();
-    TreeSet<Text> splits = new TreeSet<>();
-    for (int i = 0; i < 10; i++) {
-      splits.add(new Text(Integer.toString(i)));
-      Mutation m = new Mutation(Integer.toString(i));
-      m.put("", "", "");
-      mutations.add(m);
-    }
+    try (AccumuloClient client = getAccumuloClient()) {
+
+      List<Mutation> mutations = new ArrayList<>();
+      TreeSet<Text> splits = new TreeSet<>();
+      for (int i = 0; i < 10; i++) {
+        splits.add(new Text(Integer.toString(i)));
+        Mutation m = new Mutation(Integer.toString(i));
+        m.put("", "", "");
+        mutations.add(m);
+      }
 
-    String[] tables = getUniqueNames(2);
+      String[] tables = getUniqueNames(2);
 
-    client.tableOperations().create(tables[0]);
+      client.tableOperations().create(tables[0]);
 
-    client.tableOperations().addSplits(tables[0], splits);
+      client.tableOperations().addSplits(tables[0], splits);
 
-    BatchWriter bw = client.createBatchWriter(tables[0], new BatchWriterConfig());
-    bw.addMutations(mutations);
-    bw.close();
+      BatchWriter bw = client.createBatchWriter(tables[0], new BatchWriterConfig());
+      bw.addMutations(mutations);
+      bw.close();
 
-    client.tableOperations().clone(tables[0], tables[1], true, null, null);
+      client.tableOperations().clone(tables[0], tables[1], true, null, null);
 
-    client.tableOperations().deleteRows(tables[1], new Text("4"), new Text("8"));
+      client.tableOperations().deleteRows(tables[1], new Text("4"), new Text("8"));
 
-    List<String> rows = Arrays.asList("0", "1", "2", "3", "4", "9");
-    List<String> actualRows = new ArrayList<>();
-    for (Entry<Key,Value> entry : client.createScanner(tables[1], Authorizations.EMPTY)) {
-      actualRows.add(entry.getKey().getRow().toString());
-    }
+      List<String> rows = Arrays.asList("0", "1", "2", "3", "4", "9");
+      List<String> actualRows = new ArrayList<>();
+      for (Entry<Key,Value> entry : client.createScanner(tables[1], Authorizations.EMPTY)) {
+        actualRows.add(entry.getKey().getRow().toString());
+      }
 
-    assertEquals(rows, actualRows);
+      assertEquals(rows, actualRows);
+    }
   }
-
 }
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 e88cfdbaba..6f96ef84a9 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
@@ -57,22 +57,23 @@ private void checkSum(String tableName, AccumuloClient c) throws Exception {
 
   @Test
   public void aggregationTest() throws Exception {
-    AccumuloClient c = getAccumuloClient();
-    String tableName = getUniqueNames(1)[0];
-    c.tableOperations().create(tableName);
-    IteratorSetting setting = new IteratorSetting(10, SummingCombiner.class);
-    SummingCombiner.setEncodingType(setting, Type.STRING);
-    SummingCombiner.setColumns(setting,
-        Collections.singletonList(new IteratorSetting.Column("cf")));
-    c.tableOperations().attachIterator(tableName, setting);
-    BatchWriter bw = c.createBatchWriter(tableName, new BatchWriterConfig());
-    for (int i = 0; i < 10; i++) {
-      Mutation m = new Mutation("row1");
-      m.put("cf".getBytes(), "col1".getBytes(), ("" + i).getBytes());
-      bw.addMutation(m);
+    try (AccumuloClient c = getAccumuloClient()) {
+      String tableName = getUniqueNames(1)[0];
+      c.tableOperations().create(tableName);
+      IteratorSetting setting = new IteratorSetting(10, SummingCombiner.class);
+      SummingCombiner.setEncodingType(setting, Type.STRING);
+      SummingCombiner.setColumns(setting,
+          Collections.singletonList(new IteratorSetting.Column("cf")));
+      c.tableOperations().attachIterator(tableName, setting);
+      BatchWriter bw = c.createBatchWriter(tableName, new BatchWriterConfig());
+      for (int i = 0; i < 10; i++) {
+        Mutation m = new Mutation("row1");
+        m.put("cf".getBytes(), "col1".getBytes(), ("" + i).getBytes());
+        bw.addMutation(m);
+      }
+      bw.close();
+      checkSum(tableName, c);
     }
-    bw.close();
-    checkSum(tableName, c);
   }
 
 }
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 c354424372..a3926c4478 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
@@ -73,18 +73,20 @@ protected int defaultTimeoutSeconds() {
   @Before
   public void alterConfig() throws Exception {
     if (ClusterType.STANDALONE == getClusterType()) {
-      InstanceOperations iops = getAccumuloClient().instanceOperations();
-      Map<String,String> config = iops.getSystemConfiguration();
-      majcThreadMaxOpen = config.get(Property.TSERV_MAJC_THREAD_MAXOPEN.getKey());
-      majcDelay = config.get(Property.TSERV_MAJC_DELAY.getKey());
-      majcMaxConcurrent = config.get(Property.TSERV_MAJC_MAXCONCURRENT.getKey());
-
-      iops.setProperty(Property.TSERV_MAJC_THREAD_MAXOPEN.getKey(), "4");
-      iops.setProperty(Property.TSERV_MAJC_DELAY.getKey(), "1");
-      iops.setProperty(Property.TSERV_MAJC_MAXCONCURRENT.getKey(), "1");
-
-      getClusterControl().stopAllServers(ServerType.TABLET_SERVER);
-      getClusterControl().startAllServers(ServerType.TABLET_SERVER);
+      try (AccumuloClient client = getAccumuloClient()) {
+        InstanceOperations iops = client.instanceOperations();
+        Map<String,String> config = iops.getSystemConfiguration();
+        majcThreadMaxOpen = config.get(Property.TSERV_MAJC_THREAD_MAXOPEN.getKey());
+        majcDelay = config.get(Property.TSERV_MAJC_DELAY.getKey());
+        majcMaxConcurrent = config.get(Property.TSERV_MAJC_MAXCONCURRENT.getKey());
+
+        iops.setProperty(Property.TSERV_MAJC_THREAD_MAXOPEN.getKey(), "4");
+        iops.setProperty(Property.TSERV_MAJC_DELAY.getKey(), "1");
+        iops.setProperty(Property.TSERV_MAJC_MAXCONCURRENT.getKey(), "1");
+
+        getClusterControl().stopAllServers(ServerType.TABLET_SERVER);
+        getClusterControl().startAllServers(ServerType.TABLET_SERVER);
+      }
     }
   }
 
@@ -92,75 +94,78 @@ public void alterConfig() throws Exception {
   public void resetConfig() throws Exception {
     // We set the values..
     if (null != majcThreadMaxOpen) {
-      InstanceOperations iops = getAccumuloClient().instanceOperations();
+      try (AccumuloClient client = getAccumuloClient()) {
+        InstanceOperations iops = client.instanceOperations();
 
-      iops.setProperty(Property.TSERV_MAJC_THREAD_MAXOPEN.getKey(), majcThreadMaxOpen);
-      iops.setProperty(Property.TSERV_MAJC_DELAY.getKey(), majcDelay);
-      iops.setProperty(Property.TSERV_MAJC_MAXCONCURRENT.getKey(), majcMaxConcurrent);
+        iops.setProperty(Property.TSERV_MAJC_THREAD_MAXOPEN.getKey(), majcThreadMaxOpen);
+        iops.setProperty(Property.TSERV_MAJC_DELAY.getKey(), majcDelay);
+        iops.setProperty(Property.TSERV_MAJC_MAXCONCURRENT.getKey(), majcMaxConcurrent);
 
-      getClusterControl().stopAllServers(ServerType.TABLET_SERVER);
-      getClusterControl().startAllServers(ServerType.TABLET_SERVER);
+        getClusterControl().stopAllServers(ServerType.TABLET_SERVER);
+        getClusterControl().startAllServers(ServerType.TABLET_SERVER);
+      }
     }
   }
 
   @Test
   public void test() throws Exception {
-    final AccumuloClient c = getAccumuloClient();
-    final String tableName = getUniqueNames(1)[0];
-    c.tableOperations().create(tableName);
-    c.tableOperations().setProperty(tableName, Property.TABLE_MAJC_RATIO.getKey(), "1.0");
-    FileSystem fs = getFileSystem();
-    Path root = new Path(cluster.getTemporaryPath(), getClass().getName());
-    Path testrf = new Path(root, "testrf");
-    FunctionalTestUtils.createRFiles(c, fs, testrf.toString(), 500000, 59, 4);
-
-    c.tableOperations().importDirectory(testrf.toString()).to(tableName).load();
-    int beforeCount = countFiles(c);
-
-    final AtomicBoolean fail = new AtomicBoolean(false);
-    final int THREADS = 5;
-    for (int count = 0; count < THREADS; count++) {
-      ExecutorService executor = Executors.newFixedThreadPool(THREADS);
-      final int span = 500000 / 59;
-      for (int i = 0; i < 500000; i += 500000 / 59) {
-        final int finalI = i;
-        Runnable r = new Runnable() {
-          @Override
-          public void run() {
-            try {
-              VerifyIngest.Opts opts = new VerifyIngest.Opts();
-              opts.startRow = finalI;
-              opts.rows = span;
-              opts.random = 56;
-              opts.dataSize = 50;
-              opts.cols = 1;
-              opts.setTableName(tableName);
-              opts.setClientInfo(getClientInfo());
-              VerifyIngest.verifyIngest(c, opts, new ScannerOpts());
-            } catch (Exception ex) {
-              log.warn("Got exception verifying data", ex);
-              fail.set(true);
+    try (AccumuloClient c = getAccumuloClient()) {
+      final String tableName = getUniqueNames(1)[0];
+      c.tableOperations().create(tableName);
+      c.tableOperations().setProperty(tableName, Property.TABLE_MAJC_RATIO.getKey(), "1.0");
+      FileSystem fs = getFileSystem();
+      Path root = new Path(cluster.getTemporaryPath(), getClass().getName());
+      Path testrf = new Path(root, "testrf");
+      FunctionalTestUtils.createRFiles(c, fs, testrf.toString(), 500000, 59, 4);
+
+      c.tableOperations().importDirectory(testrf.toString()).to(tableName).load();
+      int beforeCount = countFiles(c);
+
+      final AtomicBoolean fail = new AtomicBoolean(false);
+      final int THREADS = 5;
+      for (int count = 0; count < THREADS; count++) {
+        ExecutorService executor = Executors.newFixedThreadPool(THREADS);
+        final int span = 500000 / 59;
+        for (int i = 0; i < 500000; i += 500000 / 59) {
+          final int finalI = i;
+          Runnable r = new Runnable() {
+            @Override
+            public void run() {
+              try {
+                VerifyIngest.Opts opts = new VerifyIngest.Opts();
+                opts.startRow = finalI;
+                opts.rows = span;
+                opts.random = 56;
+                opts.dataSize = 50;
+                opts.cols = 1;
+                opts.setTableName(tableName);
+                opts.setClientInfo(getClientInfo());
+                VerifyIngest.verifyIngest(c, opts, new ScannerOpts());
+              } catch (Exception ex) {
+                log.warn("Got exception verifying data", ex);
+                fail.set(true);
+              }
             }
-          }
-        };
-        executor.execute(r);
+          };
+          executor.execute(r);
+        }
+        executor.shutdown();
+        executor.awaitTermination(defaultTimeoutSeconds(), TimeUnit.SECONDS);
+        assertFalse("Failed to successfully run all threads, Check the test output for error",
+            fail.get());
       }
-      executor.shutdown();
-      executor.awaitTermination(defaultTimeoutSeconds(), TimeUnit.SECONDS);
-      assertFalse("Failed to successfully run all threads, Check the test output for error",
-          fail.get());
-    }
 
-    int finalCount = countFiles(c);
-    assertTrue(finalCount < beforeCount);
-    try {
-      getClusterControl().adminStopAll();
-    } finally {
-      // Make sure the internal state in the cluster is reset (e.g. processes in MAC)
-      getCluster().stop();
-      if (ClusterType.STANDALONE == getClusterType()) {
-        // Then restart things for the next test if it's a standalone
-        getCluster().start();
+      int finalCount = countFiles(c);
+      assertTrue(finalCount < beforeCount);
+      try {
+        getClusterControl().adminStopAll();
+      } finally {
+        // Make sure the internal state in the cluster is reset (e.g. processes in MAC)
+        getCluster().stop();
+        if (ClusterType.STANDALONE == getClusterType()) {
+          // Then restart things for the next test if it's a standalone
+          getCluster().start();
+        }
       }
     }
   }
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 93c4abe0de..e6d8ac14d9 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
@@ -98,8 +98,9 @@ protected int defaultTimeoutSeconds() {
   // @formatter:on
   @Test
   public void run() throws Exception {
-    AccumuloClient c = getAccumuloClient();
-    runTest(c, getUniqueNames(1)[0]);
+    try (AccumuloClient c = getAccumuloClient()) {
+      runTest(c, getUniqueNames(1)[0]);
+    }
   }
 
   static void runTest(AccumuloClient c, String tableName)
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/ConcurrentDeleteTableIT.java b/test/src/main/java/org/apache/accumulo/test/functional/ConcurrentDeleteTableIT.java
index 137405f05d..55a941c733 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/ConcurrentDeleteTableIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/ConcurrentDeleteTableIT.java
@@ -52,63 +52,64 @@
 
   @Test
   public void testConcurrentDeleteTablesOps() throws Exception {
-    final AccumuloClient c = getAccumuloClient();
-    String[] tables = getUniqueNames(2);
+    try (AccumuloClient c = getAccumuloClient()) {
+      String[] tables = getUniqueNames(2);
 
-    TreeSet<Text> splits = createSplits();
+      TreeSet<Text> splits = createSplits();
 
-    ExecutorService es = Executors.newFixedThreadPool(20);
+      ExecutorService es = Executors.newFixedThreadPool(20);
 
-    int count = 0;
-    for (final String table : tables) {
-      c.tableOperations().create(table);
-      c.tableOperations().addSplits(table, splits);
-      writeData(c, table);
-      if (count == 1) {
-        c.tableOperations().flush(table, null, null, true);
-      }
-      count++;
-
-      int numDeleteOps = 20;
-      final CountDownLatch cdl = new CountDownLatch(numDeleteOps);
-
-      List<Future<?>> futures = new ArrayList<>();
-
-      for (int i = 0; i < numDeleteOps; i++) {
-        Future<?> future = es.submit(new Runnable() {
-
-          @Override
-          public void run() {
-            try {
-              cdl.countDown();
-              cdl.await();
-              c.tableOperations().delete(table);
-            } catch (TableNotFoundException e) {
-              // expected
-            } catch (InterruptedException | AccumuloException | AccumuloSecurityException e) {
-              throw new RuntimeException(e);
+      int count = 0;
+      for (final String table : tables) {
+        c.tableOperations().create(table);
+        c.tableOperations().addSplits(table, splits);
+        writeData(c, table);
+        if (count == 1) {
+          c.tableOperations().flush(table, null, null, true);
+        }
+        count++;
+
+        int numDeleteOps = 20;
+        final CountDownLatch cdl = new CountDownLatch(numDeleteOps);
+
+        List<Future<?>> futures = new ArrayList<>();
+
+        for (int i = 0; i < numDeleteOps; i++) {
+          Future<?> future = es.submit(new Runnable() {
+
+            @Override
+            public void run() {
+              try {
+                cdl.countDown();
+                cdl.await();
+                c.tableOperations().delete(table);
+              } catch (TableNotFoundException e) {
+                // expected
+              } catch (InterruptedException | AccumuloException | AccumuloSecurityException e) {
+                throw new RuntimeException(e);
+              }
             }
-          }
-        });
+          });
 
-        futures.add(future);
-      }
+          futures.add(future);
+        }
 
-      for (Future<?> future : futures) {
-        future.get();
-      }
+        for (Future<?> future : futures) {
+          future.get();
+        }
 
-      try {
-        c.createScanner(table, Authorizations.EMPTY);
-        fail("Expected table " + table + " to be gone.");
-      } catch (TableNotFoundException tnfe) {
-        // expected
+        try {
+          c.createScanner(table, Authorizations.EMPTY);
+          fail("Expected table " + table + " to be gone.");
+        } catch (TableNotFoundException tnfe) {
+          // expected
+        }
+
+        FunctionalTestUtils.assertNoDanglingFateLocks(getClientContext(), getCluster());
       }
 
-      FunctionalTestUtils.assertNoDanglingFateLocks(getClientContext(), getCluster());
+      es.shutdown();
     }
-
-    es.shutdown();
   }
 
   private TreeSet<Text> createSplits() {
@@ -149,113 +150,114 @@ public void run() {
 
   @Test
   public void testConcurrentFateOpsWithDelete() throws Exception {
-    final AccumuloClient c = getAccumuloClient();
-    String[] tables = getUniqueNames(2);
+    try (AccumuloClient c = getAccumuloClient()) {
+      String[] tables = getUniqueNames(2);
 
-    TreeSet<Text> splits = createSplits();
+      TreeSet<Text> splits = createSplits();
 
-    int numOperations = 8;
+      int numOperations = 8;
 
-    ExecutorService es = Executors.newFixedThreadPool(numOperations);
+      ExecutorService es = Executors.newFixedThreadPool(numOperations);
 
-    int count = 0;
-    for (final String table : tables) {
-      c.tableOperations().create(table);
-      c.tableOperations().addSplits(table, splits);
-      writeData(c, table);
-      if (count == 1) {
-        c.tableOperations().flush(table, null, null, true);
-      }
-      count++;
-
-      // increment this for each test
-      final CountDownLatch cdl = new CountDownLatch(numOperations);
-
-      List<Future<?>> futures = new ArrayList<>();
-
-      futures.add(es.submit(new Runnable() {
-        @Override
-        public void run() {
-          try {
-            cdl.countDown();
-            cdl.await();
-            c.tableOperations().delete(table);
-          } catch (TableNotFoundException | TableOfflineException e) {
-            // expected
-          } catch (InterruptedException | AccumuloException | AccumuloSecurityException e) {
-            throw new RuntimeException(e);
-          }
+      int count = 0;
+      for (final String table : tables) {
+        c.tableOperations().create(table);
+        c.tableOperations().addSplits(table, splits);
+        writeData(c, table);
+        if (count == 1) {
+          c.tableOperations().flush(table, null, null, true);
         }
-      }));
+        count++;
 
-      futures.add(es.submit(new DelayedTableOp(cdl) {
-        @Override
-        protected void doTableOp() throws Exception {
-          c.tableOperations().compact(table, new CompactionConfig());
-        }
-      }));
+        // increment this for each test
+        final CountDownLatch cdl = new CountDownLatch(numOperations);
 
-      futures.add(es.submit(new DelayedTableOp(cdl) {
-        @Override
-        protected void doTableOp() throws Exception {
-          c.tableOperations().merge(table, null, null);
-        }
-      }));
-
-      futures.add(es.submit(new DelayedTableOp(cdl) {
-        @Override
-        protected void doTableOp() throws Exception {
-          Map<String,String> m = Collections.emptyMap();
-          Set<String> s = Collections.emptySet();
-          c.tableOperations().clone(table, table + "_clone", true, m, s);
-        }
-      }));
+        List<Future<?>> futures = new ArrayList<>();
 
-      futures.add(es.submit(new DelayedTableOp(cdl) {
-        @Override
-        protected void doTableOp() throws Exception {
-          c.tableOperations().deleteRows(table, null, null);
-        }
-      }));
+        futures.add(es.submit(new Runnable() {
+          @Override
+          public void run() {
+            try {
+              cdl.countDown();
+              cdl.await();
+              c.tableOperations().delete(table);
+            } catch (TableNotFoundException | TableOfflineException e) {
+              // expected
+            } catch (InterruptedException | AccumuloException | AccumuloSecurityException e) {
+              throw new RuntimeException(e);
+            }
+          }
+        }));
 
-      futures.add(es.submit(new DelayedTableOp(cdl) {
-        @Override
-        protected void doTableOp() throws Exception {
-          c.tableOperations().cancelCompaction(table);
-        }
-      }));
+        futures.add(es.submit(new DelayedTableOp(cdl) {
+          @Override
+          protected void doTableOp() throws Exception {
+            c.tableOperations().compact(table, new CompactionConfig());
+          }
+        }));
 
-      futures.add(es.submit(new DelayedTableOp(cdl) {
-        @Override
-        protected void doTableOp() throws Exception {
-          c.tableOperations().rename(table, table + "_renamed");
-        }
-      }));
+        futures.add(es.submit(new DelayedTableOp(cdl) {
+          @Override
+          protected void doTableOp() throws Exception {
+            c.tableOperations().merge(table, null, null);
+          }
+        }));
 
-      futures.add(es.submit(new DelayedTableOp(cdl) {
-        @Override
-        protected void doTableOp() throws Exception {
-          c.tableOperations().offline(table);
-        }
-      }));
+        futures.add(es.submit(new DelayedTableOp(cdl) {
+          @Override
+          protected void doTableOp() throws Exception {
+            Map<String,String> m = Collections.emptyMap();
+            Set<String> s = Collections.emptySet();
+            c.tableOperations().clone(table, table + "_clone", true, m, s);
+          }
+        }));
 
-      assertEquals(numOperations, futures.size());
+        futures.add(es.submit(new DelayedTableOp(cdl) {
+          @Override
+          protected void doTableOp() throws Exception {
+            c.tableOperations().deleteRows(table, null, null);
+          }
+        }));
 
-      for (Future<?> future : futures) {
-        future.get();
-      }
+        futures.add(es.submit(new DelayedTableOp(cdl) {
+          @Override
+          protected void doTableOp() throws Exception {
+            c.tableOperations().cancelCompaction(table);
+          }
+        }));
 
-      try {
-        c.createScanner(table, Authorizations.EMPTY);
-        fail("Expected table " + table + " to be gone.");
-      } catch (TableNotFoundException tnfe) {
-        // expected
+        futures.add(es.submit(new DelayedTableOp(cdl) {
+          @Override
+          protected void doTableOp() throws Exception {
+            c.tableOperations().rename(table, table + "_renamed");
+          }
+        }));
+
+        futures.add(es.submit(new DelayedTableOp(cdl) {
+          @Override
+          protected void doTableOp() throws Exception {
+            c.tableOperations().offline(table);
+          }
+        }));
+
+        assertEquals(numOperations, futures.size());
+
+        for (Future<?> future : futures) {
+          future.get();
+        }
+
+        try {
+          c.createScanner(table, Authorizations.EMPTY);
+          fail("Expected table " + table + " to be gone.");
+        } catch (TableNotFoundException tnfe) {
+          // expected
+        }
+
+        FunctionalTestUtils.assertNoDanglingFateLocks(getClientContext(), getCluster());
       }
 
-      FunctionalTestUtils.assertNoDanglingFateLocks(getClientContext(), getCluster());
+      es.shutdown();
     }
-
-    es.shutdown();
   }
 
   private void writeData(AccumuloClient c, String table)
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 93f8a664ac..2a21e9d5cf 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
@@ -91,40 +91,42 @@ public CompactionPlan getCompactionPlan(MajorCompactionRequest request) throws I
 
   @Test
   public void test() throws Exception {
-    final AccumuloClient c = getClient();
-    final String tableName = getUniqueNames(1)[0];
-    c.tableOperations().create(tableName);
-    c.tableOperations().setProperty(tableName, Property.TABLE_COMPACTION_STRATEGY.getKey(),
-        SimpleCompactionStrategy.class.getName());
-    runTest(c, tableName, 3);
-    c.tableOperations().setProperty(tableName,
-        Property.TABLE_COMPACTION_STRATEGY_PREFIX.getKey() + "count", "" + 5);
-    runTest(c, tableName, 5);
+    try (AccumuloClient c = getClient()) {
+      final String tableName = getUniqueNames(1)[0];
+      c.tableOperations().create(tableName);
+      c.tableOperations().setProperty(tableName, Property.TABLE_COMPACTION_STRATEGY.getKey(),
+          SimpleCompactionStrategy.class.getName());
+      runTest(c, tableName, 3);
+      c.tableOperations().setProperty(tableName,
+          Property.TABLE_COMPACTION_STRATEGY_PREFIX.getKey() + "count", "" + 5);
+      runTest(c, tableName, 5);
+    }
   }
 
   @Test
   public void testPerTableClasspath() throws Exception {
-    final AccumuloClient c = getClient();
-    final String tableName = getUniqueNames(1)[0];
-    File destFile = installJar(getCluster().getConfig().getAccumuloDir(),
-        "/TestCompactionStrat.jar");
-    c.tableOperations().create(tableName);
-    c.instanceOperations().setProperty(
-        Property.VFS_CONTEXT_CLASSPATH_PROPERTY.getKey() + "context1", destFile.toString());
-    c.tableOperations().setProperty(tableName, Property.TABLE_MAJC_RATIO.getKey(), "10");
-    c.tableOperations().setProperty(tableName, Property.TABLE_CLASSPATH.getKey(), "context1");
-    // EfgCompactionStrat will only compact a tablet w/ end row of 'efg'. No other tablets are
-    // compacted.
-    c.tableOperations().setProperty(tableName, Property.TABLE_COMPACTION_STRATEGY.getKey(),
-        "org.apache.accumulo.test.EfgCompactionStrat");
-
-    c.tableOperations().addSplits(tableName, new TreeSet<>(Arrays.asList(new Text("efg"))));
-
-    for (char ch = 'a'; ch < 'l'; ch++)
-      writeFlush(c, tableName, ch + "");
-
-    while (countFiles(c, tableName) != 7) {
-      UtilWaitThread.sleep(200);
+    try (AccumuloClient c = getClient()) {
+      final String tableName = getUniqueNames(1)[0];
+      File destFile = installJar(getCluster().getConfig().getAccumuloDir(),
+          "/TestCompactionStrat.jar");
+      c.tableOperations().create(tableName);
+      c.instanceOperations().setProperty(
+          Property.VFS_CONTEXT_CLASSPATH_PROPERTY.getKey() + "context1", destFile.toString());
+      c.tableOperations().setProperty(tableName, Property.TABLE_MAJC_RATIO.getKey(), "10");
+      c.tableOperations().setProperty(tableName, Property.TABLE_CLASSPATH.getKey(), "context1");
+      // EfgCompactionStrat will only compact a tablet w/ end row of 'efg'. No other tablets are
+      // compacted.
+      c.tableOperations().setProperty(tableName, Property.TABLE_COMPACTION_STRATEGY.getKey(),
+          "org.apache.accumulo.test.EfgCompactionStrat");
+
+      c.tableOperations().addSplits(tableName, new TreeSet<>(Arrays.asList(new Text("efg"))));
+
+      for (char ch = 'a'; ch < 'l'; ch++)
+        writeFlush(c, tableName, ch + "");
+
+      while (countFiles(c, tableName) != 7) {
+        UtilWaitThread.sleep(200);
+      }
     }
   }
 
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 3be0496c08..1e6c3bd226 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
@@ -57,39 +57,40 @@ protected int defaultTimeoutSeconds() {
   @Test
   public void run() throws Exception {
     String[] tableNames = getUniqueNames(3);
-    AccumuloClient c = getAccumuloClient();
-    for (String table : tableNames) {
-      c.tableOperations().create(table);
-      c.tableOperations().addConstraint(table, NumericValueConstraint.class.getName());
-      c.tableOperations().addConstraint(table, AlphaNumKeyConstraint.class.getName());
-    }
+    try (AccumuloClient c = getAccumuloClient()) {
+      for (String table : tableNames) {
+        c.tableOperations().create(table);
+        c.tableOperations().addConstraint(table, NumericValueConstraint.class.getName());
+        c.tableOperations().addConstraint(table, AlphaNumKeyConstraint.class.getName());
+      }
 
-    // A static sleep to just let ZK do its thing
-    Thread.sleep(10 * 1000);
-
-    // Then check that the client has at least gotten the updates
-    for (String table : tableNames) {
-      log.debug("Checking constraints on {}", table);
-      Map<String,Integer> constraints = c.tableOperations().listConstraints(table);
-      while (!constraints.containsKey(NumericValueConstraint.class.getName())
-          || !constraints.containsKey(AlphaNumKeyConstraint.class.getName())) {
-        log.debug("Failed to verify constraints. Sleeping and retrying");
-        Thread.sleep(2000);
-        constraints = c.tableOperations().listConstraints(table);
+      // A static sleep to just let ZK do its thing
+      Thread.sleep(10 * 1000);
+
+      // Then check that the client has at least gotten the updates
+      for (String table : tableNames) {
+        log.debug("Checking constraints on {}", table);
+        Map<String,Integer> constraints = c.tableOperations().listConstraints(table);
+        while (!constraints.containsKey(NumericValueConstraint.class.getName())
+            || !constraints.containsKey(AlphaNumKeyConstraint.class.getName())) {
+          log.debug("Failed to verify constraints. Sleeping and retrying");
+          Thread.sleep(2000);
+          constraints = c.tableOperations().listConstraints(table);
+        }
+        log.debug("Verified all constraints on {}", table);
       }
-      log.debug("Verified all constraints on {}", table);
-    }
 
-    log.debug("Verified constraints on all tables. Running tests");
+      log.debug("Verified constraints on all tables. Running tests");
 
-    test1(tableNames[0]);
+      test1(c, tableNames[0]);
 
-    test2(tableNames[1], false);
-    test2(tableNames[2], true);
+      test2(c, tableNames[1], false);
+      test2(c, tableNames[2], true);
+    }
   }
 
-  private void test1(String tableName) throws Exception {
-    BatchWriter bw = getAccumuloClient().createBatchWriter(tableName, new BatchWriterConfig());
+  private void test1(AccumuloClient client, String tableName) throws Exception {
+    BatchWriter bw = client.createBatchWriter(tableName, new BatchWriterConfig());
 
     Mutation mut1 = new Mutation(new Text("r1"));
     mut1.put(new Text("cf1"), new Text("cq1"), new Value("123".getBytes(UTF_8)));
@@ -99,7 +100,7 @@ private void test1(String tableName) throws Exception {
     // should not throw any exceptions
     bw.close();
 
-    bw = getAccumuloClient().createBatchWriter(tableName, new BatchWriterConfig());
+    bw = client.createBatchWriter(tableName, new BatchWriterConfig());
 
     // create a mutation with a non numeric value
     Mutation mut2 = new Mutation(new Text("r1"));
@@ -139,7 +140,7 @@ private void test1(String tableName) throws Exception {
     }
 
     // verify mutation did not go through
-    try (Scanner scanner = getAccumuloClient().createScanner(tableName, Authorizations.EMPTY)) {
+    try (Scanner scanner = client.createScanner(tableName, Authorizations.EMPTY)) {
       scanner.setRange(new Range(new Text("r1")));
 
       Iterator<Entry<Key,Value>> iter = scanner.iterator();
@@ -159,11 +160,11 @@ private void test1(String tableName) throws Exception {
       }
 
       // remove the numeric value constraint
-      getAccumuloClient().tableOperations().removeConstraint(tableName, 2);
+      client.tableOperations().removeConstraint(tableName, 2);
       sleepUninterruptibly(1, TimeUnit.SECONDS);
 
       // now should be able to add a non numeric value
-      bw = getAccumuloClient().createBatchWriter(tableName, new BatchWriterConfig());
+      bw = client.createBatchWriter(tableName, new BatchWriterConfig());
       bw.addMutation(mut2);
       bw.close();
 
@@ -185,12 +186,12 @@ private void test1(String tableName) throws Exception {
       }
 
       // add a constraint that references a non-existent class
-      getAccumuloClient().tableOperations().setProperty(tableName,
-          Property.TABLE_CONSTRAINT_PREFIX + "1", "com.foobar.nonExistantClass");
+      client.tableOperations().setProperty(tableName, Property.TABLE_CONSTRAINT_PREFIX + "1",
+          "com.foobar.nonExistantClass");
       sleepUninterruptibly(1, TimeUnit.SECONDS);
 
       // add a mutation
-      bw = getAccumuloClient().createBatchWriter(tableName, new BatchWriterConfig());
+      bw = client.createBatchWriter(tableName, new BatchWriterConfig());
 
       Mutation mut3 = new Mutation(new Text("r1"));
       mut3.put(new Text("cf1"), new Text("cq1"), new Value("foo".getBytes(UTF_8)));
@@ -229,11 +230,11 @@ private void test1(String tableName) throws Exception {
       }
 
       // remove the bad constraint
-      getAccumuloClient().tableOperations().removeConstraint(tableName, 1);
+      client.tableOperations().removeConstraint(tableName, 1);
       sleepUninterruptibly(1, TimeUnit.SECONDS);
 
       // try the mutation again
-      bw = getAccumuloClient().createBatchWriter(tableName, new BatchWriterConfig());
+      bw = client.createBatchWriter(tableName, new BatchWriterConfig());
       bw.addMutation(mut3);
       bw.close();
 
@@ -262,13 +263,13 @@ private Mutation newMut(String row, String cf, String cq, String val) {
     return mut1;
   }
 
-  private void test2(String table, boolean doFlush) throws Exception {
+  private void test2(AccumuloClient client, String table, boolean doFlush) throws Exception {
     // test sending multiple mutations with multiple constrain violations... all of the non
     // violating mutations
     // should go through
     int numericErrors = 2;
 
-    BatchWriter bw = getAccumuloClient().createBatchWriter(table, new BatchWriterConfig());
+    BatchWriter bw = client.createBatchWriter(table, new BatchWriterConfig());
     bw.addMutation(newMut("r1", "cf1", "cq1", "123"));
     bw.addMutation(newMut("r1", "cf1", "cq2", "I'm a bad value"));
     if (doFlush) {
@@ -282,7 +283,7 @@ private void test2(String table, boolean doFlush) throws Exception {
         } catch (MutationsRejectedException ex) {
           // ignored
         }
-        bw = getAccumuloClient().createBatchWriter(table, new BatchWriterConfig());
+        bw = client.createBatchWriter(table, new BatchWriterConfig());
         numericErrors = 1;
       }
     }
@@ -325,7 +326,7 @@ private void test2(String table, boolean doFlush) throws Exception {
       throw new Exception("Did not see MutationsRejectedException");
     }
 
-    try (Scanner scanner = getAccumuloClient().createScanner(table, Authorizations.EMPTY)) {
+    try (Scanner scanner = client.createScanner(table, Authorizations.EMPTY)) {
 
       Iterator<Entry<Key,Value>> iter = scanner.iterator();
 
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 7a2d18f663..602f9bfabc 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
@@ -25,6 +25,7 @@
 import java.util.SortedSet;
 import java.util.TreeSet;
 
+import org.apache.accumulo.core.client.AccumuloClient;
 import org.apache.accumulo.core.client.BatchScanner;
 import org.apache.accumulo.core.client.BatchWriter;
 import org.apache.accumulo.core.client.BatchWriterConfig;
@@ -61,72 +62,78 @@ public static void createData() throws Exception {
 
   @Test
   public void verifyDataIsPresent() throws Exception {
-    Text cf = new Text("cf1");
-    Text cq = new Text("cq1");
 
-    String tableName = getUniqueNames(1)[0];
-    getAccumuloClient().tableOperations().create(tableName);
-    getAccumuloClient().tableOperations().addSplits(tableName, splits);
-    BatchWriter bw = getAccumuloClient().createBatchWriter(tableName, new BatchWriterConfig());
+    try (AccumuloClient client = getAccumuloClient()) {
 
-    for (int i = 1; i < 257; i++) {
-      Mutation m = new Mutation(new Text(String.format("%08x", (i << 8) - 16)));
-      m.put(cf, cq, new Value(Integer.toString(i).getBytes(UTF_8)));
+      Text cf = new Text("cf1");
+      Text cq = new Text("cq1");
 
-      bw.addMutation(m);
-    }
+      String tableName = getUniqueNames(1)[0];
+      client.tableOperations().create(tableName);
+      client.tableOperations().addSplits(tableName, splits);
+      BatchWriter bw = client.createBatchWriter(tableName, new BatchWriterConfig());
+
+      for (int i = 1; i < 257; i++) {
+        Mutation m = new Mutation(new Text(String.format("%08x", (i << 8) - 16)));
+        m.put(cf, cq, new Value(Integer.toString(i).getBytes(UTF_8)));
 
-    bw.close();
-    try (Scanner scanner1 = getAccumuloClient().createScanner(tableName, Authorizations.EMPTY)) {
+        bw.addMutation(m);
+      }
 
-      int ei = 1;
+      bw.close();
+      try (Scanner scanner1 = client.createScanner(tableName, Authorizations.EMPTY)) {
 
-      for (Entry<Key,Value> entry : scanner1) {
-        assertEquals(String.format("%08x", (ei << 8) - 16), entry.getKey().getRow().toString());
-        assertEquals(Integer.toString(ei), entry.getValue().toString());
+        int ei = 1;
 
-        ei++;
+        for (Entry<Key,Value> entry : scanner1) {
+          assertEquals(String.format("%08x", (ei << 8) - 16), entry.getKey().getRow().toString());
+          assertEquals(Integer.toString(ei), entry.getValue().toString());
+
+          ei++;
+        }
+        assertEquals("Did not see expected number of rows", 257, ei);
       }
-      assertEquals("Did not see expected number of rows", 257, ei);
     }
   }
 
   @Test
   public void createTableAndScan() throws Exception {
-    String table2 = getUniqueNames(1)[0];
-    getAccumuloClient().tableOperations().create(table2);
-    getAccumuloClient().tableOperations().addSplits(table2, splits);
-    try (Scanner scanner2 = getAccumuloClient().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 (AccumuloClient client = getAccumuloClient()) {
+      String table2 = getUniqueNames(1)[0];
+      client.tableOperations().create(table2);
+      client.tableOperations().addSplits(table2, splits);
+      try (Scanner scanner2 = client.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);
+        }
       }
     }
   }
 
   @Test
   public void createTableAndBatchScan() throws Exception {
-    ArrayList<Range> ranges = new ArrayList<>();
-    for (int i = 1; i < 257; i++) {
-      ranges.add(new Range(new Text(String.format("%08x", (i << 8) - 16))));
-    }
+    try (AccumuloClient client = getAccumuloClient()) {
+      ArrayList<Range> ranges = new ArrayList<>();
+      for (int i = 1; i < 257; i++) {
+        ranges.add(new Range(new Text(String.format("%08x", (i << 8) - 16))));
+      }
 
-    String table3 = getUniqueNames(1)[0];
-    getAccumuloClient().tableOperations().create(table3);
-    getAccumuloClient().tableOperations().addSplits(table3, splits);
-    try (
-        BatchScanner bs = getAccumuloClient().createBatchScanner(table3, Authorizations.EMPTY, 3)) {
-      bs.setRanges(ranges);
-      Iterator<Entry<Key,Value>> iter = bs.iterator();
-      int count = Iterators.size(iter);
+      String table3 = getUniqueNames(1)[0];
+      client.tableOperations().create(table3);
+      client.tableOperations().addSplits(table3, splits);
+      try (BatchScanner bs = client.createBatchScanner(table3, Authorizations.EMPTY, 3)) {
+        bs.setRanges(ranges);
+        Iterator<Entry<Key,Value>> iter = bs.iterator();
+        int count = Iterators.size(iter);
 
-      assertEquals("Did not expect to find any entries", 0, count);
+        assertEquals("Did not expect to find any entries", 0, count);
+      }
     }
   }
-
 }
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/CreateInitialSplitsIT.java b/test/src/main/java/org/apache/accumulo/test/functional/CreateInitialSplitsIT.java
index 0e1da68a5e..67ab8b8297 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/CreateInitialSplitsIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/CreateInitialSplitsIT.java
@@ -41,6 +41,7 @@
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.RawLocalFileSystem;
 import org.apache.hadoop.io.Text;
+import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 
@@ -69,6 +70,11 @@ public void setupInitialSplits() {
     client = getAccumuloClient();
   }
 
+  @After
+  public void closeClient() {
+    client.close();
+  }
+
   /**
    * Verify normal table creation did not get broken.
    */
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/CreateManyScannersIT.java b/test/src/main/java/org/apache/accumulo/test/functional/CreateManyScannersIT.java
index 41bff535c9..69cfa5619d 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/CreateManyScannersIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/CreateManyScannersIT.java
@@ -30,12 +30,12 @@ protected int defaultTimeoutSeconds() {
 
   @Test
   public void run() throws Exception {
-    AccumuloClient c = getAccumuloClient();
-    String tableName = getUniqueNames(1)[0];
-    c.tableOperations().create(tableName);
-    for (int i = 0; i < 100000; i++) {
-      c.createScanner(tableName, Authorizations.EMPTY);
+    try (AccumuloClient c = getAccumuloClient()) {
+      String tableName = getUniqueNames(1)[0];
+      c.tableOperations().create(tableName);
+      for (int i = 0; i < 100000; i++) {
+        c.createScanner(tableName, Authorizations.EMPTY);
+      }
     }
   }
-
 }
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 d56f90ba4c..7ab59e2a49 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
@@ -56,19 +56,20 @@ public int defaultTimeoutSeconds() {
 
   @Before
   public void createLocalUser() throws AccumuloException, AccumuloSecurityException {
-    AccumuloClient client = getAccumuloClient();
-    ClusterUser user = getUser(0);
-    username = user.getPrincipal();
-    saslEnabled = saslEnabled();
-    // Create the user if it doesn't exist
-    Set<String> users = client.securityOperations().listLocalUsers();
-    if (!users.contains(username)) {
-      PasswordToken passwdToken = null;
-      if (!saslEnabled) {
-        password = user.getPassword();
-        passwdToken = new PasswordToken(password);
+    try (AccumuloClient client = getAccumuloClient()) {
+      ClusterUser user = getUser(0);
+      username = user.getPrincipal();
+      saslEnabled = saslEnabled();
+      // Create the user if it doesn't exist
+      Set<String> users = client.securityOperations().listLocalUsers();
+      if (!users.contains(username)) {
+        PasswordToken passwdToken = null;
+        if (!saslEnabled) {
+          password = user.getPassword();
+          passwdToken = new PasswordToken(password);
+        }
+        client.securityOperations().createLocalUser(username, passwdToken);
       }
-      client.securityOperations().createLocalUser(username, passwdToken);
     }
   }
 
@@ -79,7 +80,9 @@ public void deleteLocalUser() throws Exception {
       UserGroupInformation.loginUserFromKeytab(root.getPrincipal(),
           root.getKeytab().getAbsolutePath());
     }
-    getAccumuloClient().securityOperations().dropLocalUser(username);
+    try (AccumuloClient client = getAccumuloClient()) {
+      client.securityOperations().dropLocalUser(username);
+    }
   }
 
   @Test
@@ -88,8 +91,8 @@ public void testConnectorWithDestroyedToken() throws Exception {
     assertFalse(token.isDestroyed());
     token.destroy();
     assertTrue(token.isDestroyed());
-    try {
-      getAccumuloClient().changeUser("non_existent_user", token);
+    try (AccumuloClient client = getAccumuloClient()) {
+      client.changeUser("non_existent_user", token);
       fail();
     } catch (AccumuloSecurityException e) {
       assertEquals(e.getSecurityErrorCode(), SecurityErrorCode.TOKEN_EXPIRED);
@@ -98,25 +101,26 @@ public void testConnectorWithDestroyedToken() throws Exception {
 
   @Test
   public void testDestroyTokenBeforeRPC() throws Exception {
-    AuthenticationToken token = getUser(0).getToken();
-    AccumuloClient userAccumuloClient = getAccumuloClient().changeUser(username, token);
-    try (Scanner scanner = userAccumuloClient.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 (AccumuloClient client = getAccumuloClient()) {
+      AuthenticationToken token = getUser(0).getToken();
+      try (AccumuloClient userAccumuloClient = client.changeUser(username, token);
+          Scanner scanner = userAccumuloClient.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);
-        assertEquals(AccumuloSecurityException.class.cast(e.getCause()).getSecurityErrorCode(),
-            SecurityErrorCode.TOKEN_EXPIRED);
+        } catch (Exception e) {
+          assertTrue(e instanceof RuntimeException);
+          assertTrue(e.getCause() instanceof AccumuloSecurityException);
+          assertEquals(AccumuloSecurityException.class.cast(e.getCause()).getSecurityErrorCode(),
+              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 966acf2982..c37ed79c56 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
@@ -62,60 +62,62 @@ protected int defaultTimeoutSeconds() {
 
   @Before
   public void updateMajcDelay() throws Exception {
-    AccumuloClient c = getAccumuloClient();
-    majcDelay = c.instanceOperations().getSystemConfiguration()
-        .get(Property.TSERV_MAJC_DELAY.getKey());
-    c.instanceOperations().setProperty(Property.TSERV_MAJC_DELAY.getKey(), "1s");
-    if (getClusterType() == ClusterType.STANDALONE) {
-      // Gotta wait for the cluster to get out of the default sleep value
-      Thread.sleep(ConfigurationTypeHelper.getTimeInMillis(majcDelay));
+    try (AccumuloClient c = getAccumuloClient()) {
+      majcDelay = c.instanceOperations().getSystemConfiguration()
+          .get(Property.TSERV_MAJC_DELAY.getKey());
+      c.instanceOperations().setProperty(Property.TSERV_MAJC_DELAY.getKey(), "1s");
+      if (getClusterType() == ClusterType.STANDALONE) {
+        // Gotta wait for the cluster to get out of the default sleep value
+        Thread.sleep(ConfigurationTypeHelper.getTimeInMillis(majcDelay));
+      }
     }
   }
 
   @After
   public void resetMajcDelay() throws Exception {
-    AccumuloClient c = getAccumuloClient();
-    c.instanceOperations().setProperty(Property.TSERV_MAJC_DELAY.getKey(), majcDelay);
+    try (AccumuloClient c = getAccumuloClient()) {
+      c.instanceOperations().setProperty(Property.TSERV_MAJC_DELAY.getKey(), majcDelay);
+    }
   }
 
   @Test
   public void run() throws Exception {
-    AccumuloClient c = getAccumuloClient();
-    String tableName = getUniqueNames(1)[0];
-    c.tableOperations().create(tableName);
-    BatchWriter bw = getAccumuloClient().createBatchWriter(tableName, new BatchWriterConfig());
-    Mutation m = new Mutation(new Text("foo"));
-    m.put(new Text("bar"), new Text("1910"), new Value("5".getBytes(UTF_8)));
-    bw.addMutation(m);
-    bw.flush();
+    try (AccumuloClient c = getAccumuloClient()) {
+      String tableName = getUniqueNames(1)[0];
+      c.tableOperations().create(tableName);
+      BatchWriter bw = c.createBatchWriter(tableName, new BatchWriterConfig());
+      Mutation m = new Mutation(new Text("foo"));
+      m.put(new Text("bar"), new Text("1910"), new Value("5".getBytes(UTF_8)));
+      bw.addMutation(m);
+      bw.flush();
 
-    getAccumuloClient().tableOperations().flush(tableName, null, null, true);
+      c.tableOperations().flush(tableName, null, null, true);
 
-    FunctionalTestUtils.checkRFiles(c, tableName, 1, 1, 1, 1);
+      FunctionalTestUtils.checkRFiles(c, tableName, 1, 1, 1, 1);
 
-    m = new Mutation(new Text("foo"));
-    m.putDelete(new Text("bar"), new Text("1910"));
-    bw.addMutation(m);
-    bw.flush();
+      m = new Mutation(new Text("foo"));
+      m.putDelete(new Text("bar"), new Text("1910"));
+      bw.addMutation(m);
+      bw.flush();
 
-    try (Scanner scanner = getAccumuloClient().createScanner(tableName, Authorizations.EMPTY)) {
-      scanner.setRange(new Range());
-      int count = Iterators.size(scanner.iterator());
-      assertEquals("count == " + count, 0, count);
-      getAccumuloClient().tableOperations().flush(tableName, null, null, true);
+      try (Scanner scanner = c.createScanner(tableName, Authorizations.EMPTY)) {
+        scanner.setRange(new Range());
+        int count = Iterators.size(scanner.iterator());
+        assertEquals("count == " + count, 0, count);
+        c.tableOperations().flush(tableName, null, null, true);
 
-      getAccumuloClient().tableOperations().setProperty(tableName,
-          Property.TABLE_MAJC_RATIO.getKey(), "1.0");
-      sleepUninterruptibly(4, TimeUnit.SECONDS);
+        c.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/DeleteFailIT.java b/test/src/main/java/org/apache/accumulo/test/functional/DeleteFailIT.java
index e20a1b8e36..63091e122b 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/DeleteFailIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/DeleteFailIT.java
@@ -35,24 +35,23 @@
 
   @Test
   public void testFail() throws Exception {
-    AccumuloClient c = getAccumuloClient();
-    String tableName = getUniqueNames(1)[0];
-    NewTableConfiguration ntc = new NewTableConfiguration();
-    ntc.setProperties(
-        Collections.singletonMap(Property.TABLE_DELETE_BEHAVIOR.getKey(), Behavior.FAIL.name()));
-    c.tableOperations().create(tableName, ntc);
-
-    try (BatchWriter writer = c.createBatchWriter(tableName)) {
-      Mutation m = new Mutation("1234");
-      m.putDelete("f1", "q1", 2L);
-      writer.addMutation(m);
+    try (AccumuloClient c = getAccumuloClient()) {
+      String tableName = getUniqueNames(1)[0];
+      NewTableConfiguration ntc = new NewTableConfiguration();
+      ntc.setProperties(
+          Collections.singletonMap(Property.TABLE_DELETE_BEHAVIOR.getKey(), Behavior.FAIL.name()));
+      c.tableOperations().create(tableName, ntc);
+
+      try (BatchWriter writer = c.createBatchWriter(tableName)) {
+        Mutation m = new Mutation("1234");
+        m.putDelete("f1", "q1", 2L);
+        writer.addMutation(m);
+      }
+
+      try (Scanner scanner = c.createScanner(tableName, Authorizations.EMPTY);) {
+        scanner.forEach(e -> {});
+        fail("Expected scan to fail because  deletes are present.");
+      } catch (RuntimeException e) {}
     }
-
-    Scanner scanner = c.createScanner(tableName, Authorizations.EMPTY);
-
-    try {
-      scanner.forEach(e -> {});
-      fail("Expected scan to fail because  deletes are present.");
-    } catch (RuntimeException e) {}
   }
 }
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/DeleteIT.java b/test/src/main/java/org/apache/accumulo/test/functional/DeleteIT.java
index dbd51cd020..3c09d0581b 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/DeleteIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/DeleteIT.java
@@ -43,17 +43,18 @@ protected int defaultTimeoutSeconds() {
 
   @Test
   public void test() throws Exception {
-    AccumuloClient c = getAccumuloClient();
-    String tableName = getUniqueNames(1)[0];
-    c.tableOperations().create(tableName);
-    AuthenticationToken token = getAdminToken();
-    if (token instanceof KerberosToken) {
-      deleteTest(c, getCluster(), getAdminPrincipal(), null, tableName,
-          getAdminUser().getKeytab().getAbsolutePath());
-    } else if (token instanceof PasswordToken) {
-      PasswordToken passwdToken = (PasswordToken) token;
-      deleteTest(c, getCluster(), getAdminPrincipal(), new String(passwdToken.getPassword(), UTF_8),
-          tableName, null);
+    try (AccumuloClient c = getAccumuloClient()) {
+      String tableName = getUniqueNames(1)[0];
+      c.tableOperations().create(tableName);
+      AuthenticationToken token = getAdminToken();
+      if (token instanceof KerberosToken) {
+        deleteTest(c, getCluster(), getAdminPrincipal(), null, tableName,
+            getAdminUser().getKeytab().getAbsolutePath());
+      } else if (token instanceof PasswordToken) {
+        PasswordToken passwdToken = (PasswordToken) token;
+        deleteTest(c, getCluster(), getAdminPrincipal(),
+            new String(passwdToken.getPassword(), UTF_8), tableName, null);
+      }
     }
   }
 
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 a2f1c8cb63..e01d6d32f8 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
@@ -69,54 +69,56 @@ protected int defaultTimeoutSeconds() {
 
   @Test(timeout = 5 * 60 * 1000)
   public void testDeleteAllRows() throws Exception {
-    AccumuloClient c = getAccumuloClient();
-    String[] tableNames = this.getUniqueNames(20);
-    for (String tableName : tableNames) {
-      c.tableOperations().create(tableName);
-      c.tableOperations().deleteRows(tableName, null, null);
-      try (Scanner scanner = c.createScanner(tableName, Authorizations.EMPTY)) {
-        assertEquals(0, Iterators.size(scanner.iterator()));
+    try (AccumuloClient c = getAccumuloClient()) {
+      String[] tableNames = this.getUniqueNames(20);
+      for (String tableName : tableNames) {
+        c.tableOperations().create(tableName);
+        c.tableOperations().deleteRows(tableName, null, null);
+        try (Scanner scanner = c.createScanner(tableName, Authorizations.EMPTY)) {
+          assertEquals(0, Iterators.size(scanner.iterator()));
+        }
       }
     }
   }
 
   @Test
   public void testManyRows() throws Exception {
-    // Delete ranges of rows, and verify the tablets are removed.
-    int i = 0;
-    // Eliminate whole tablets
-    String tableName = getUniqueNames(1)[0];
-    testSplit(tableName + i++, "f", "h", "abcdefijklmnopqrstuvwxyz", 260);
-    // Eliminate whole tablets, partial first tablet
-    testSplit(tableName + i++, "f1", "h", "abcdeff1ijklmnopqrstuvwxyz", 262);
-    // Eliminate whole tablets, partial last tablet
-    testSplit(tableName + i++, "f", "h1", "abcdefijklmnopqrstuvwxyz", 258);
-    // Eliminate whole tablets, partial first and last tablet
-    testSplit(tableName + i++, "f1", "h1", "abcdeff1ijklmnopqrstuvwxyz", 260);
-    // Eliminate one tablet
-    testSplit(tableName + i++, "f", "g", "abcdefhijklmnopqrstuvwxyz", 270);
-    // Eliminate partial tablet, matches start split
-    testSplit(tableName + i++, "f", "f1", "abcdefghijklmnopqrstuvwxyz", 278);
-    // Eliminate partial tablet, matches end split
-    testSplit(tableName + i++, "f1", "g", "abcdeff1hijklmnopqrstuvwxyz", 272);
-    // Eliminate tablets starting at -inf
-    testSplit(tableName + i++, null, "h", "ijklmnopqrstuvwxyz", 200);
-    // Eliminate tablets ending at +inf
-    testSplit(tableName + i++, "t", null, "abcdefghijklmnopqrst", 200);
-    // Eliminate some rows inside one tablet
-    testSplit(tableName + i++, "t0", "t2", "abcdefghijklmnopqrstt0uvwxyz", 278);
-    // Eliminate some rows in the first tablet
-    testSplit(tableName + i++, null, "A1", "abcdefghijklmnopqrstuvwxyz", 278);
-    // Eliminate some rows in the last tablet
-    testSplit(tableName + i++, "{1", null, "abcdefghijklmnopqrstuvwxyz{1", 272);
-    // Delete everything
-    testSplit(tableName + i++, null, null, "", 0);
+    try (AccumuloClient c = getAccumuloClient()) {
+      // Delete ranges of rows, and verify the tablets are removed.
+      int i = 0;
+      // Eliminate whole tablets
+      String tableName = getUniqueNames(1)[0];
+      testSplit(c, tableName + i++, "f", "h", "abcdefijklmnopqrstuvwxyz", 260);
+      // Eliminate whole tablets, partial first tablet
+      testSplit(c, tableName + i++, "f1", "h", "abcdeff1ijklmnopqrstuvwxyz", 262);
+      // Eliminate whole tablets, partial last tablet
+      testSplit(c, tableName + i++, "f", "h1", "abcdefijklmnopqrstuvwxyz", 258);
+      // Eliminate whole tablets, partial first and last tablet
+      testSplit(c, tableName + i++, "f1", "h1", "abcdeff1ijklmnopqrstuvwxyz", 260);
+      // Eliminate one tablet
+      testSplit(c, tableName + i++, "f", "g", "abcdefhijklmnopqrstuvwxyz", 270);
+      // Eliminate partial tablet, matches start split
+      testSplit(c, tableName + i++, "f", "f1", "abcdefghijklmnopqrstuvwxyz", 278);
+      // Eliminate partial tablet, matches end split
+      testSplit(c, tableName + i++, "f1", "g", "abcdeff1hijklmnopqrstuvwxyz", 272);
+      // Eliminate tablets starting at -inf
+      testSplit(c, tableName + i++, null, "h", "ijklmnopqrstuvwxyz", 200);
+      // Eliminate tablets ending at +inf
+      testSplit(c, tableName + i++, "t", null, "abcdefghijklmnopqrst", 200);
+      // Eliminate some rows inside one tablet
+      testSplit(c, tableName + i++, "t0", "t2", "abcdefghijklmnopqrstt0uvwxyz", 278);
+      // Eliminate some rows in the first tablet
+      testSplit(c, tableName + i++, null, "A1", "abcdefghijklmnopqrstuvwxyz", 278);
+      // Eliminate some rows in the last tablet
+      testSplit(c, tableName + i++, "{1", null, "abcdefghijklmnopqrstuvwxyz{1", 272);
+      // Delete everything
+      testSplit(c, tableName + i++, null, null, "", 0);
+    }
   }
 
-  private void testSplit(String table, String start, String end, String result, int entries)
-      throws Exception {
+  private void testSplit(AccumuloClient c, String table, String start, String end, String result,
+      int entries) throws Exception {
     // Put a bunch of rows on each tablet
-    AccumuloClient c = getAccumuloClient();
     c.tableOperations().create(table);
     BatchWriter bw = c.createBatchWriter(table, null);
     for (String row : ROWS) {
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 7f4aa3c61f..e935ea7c8b 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
@@ -67,59 +67,60 @@ public void run() throws Exception {
     // Delete ranges of rows, and verify the are removed
     // Do this while adding many splits
     final String tableName = getUniqueNames(1)[0];
-    final AccumuloClient client = getAccumuloClient();
-
-    // Eliminate whole tablets
-    for (int test = 0; test < 10; test++) {
-      // create a table
-      log.info("Test {}", test);
-      client.tableOperations().create(tableName);
-
-      // put some data in it
-      fillTable(client, tableName);
-
-      // generate a random delete range
-      final Text start = new Text();
-      final Text end = new Text();
-      generateRandomRange(start, end);
-
-      // initiate the delete range
-      final boolean fail[] = {false};
-      Thread t = new Thread() {
-        @Override
-        public void run() {
-          try {
-            // split the table
-            final SortedSet<Text> afterEnd = SPLITS.tailSet(new Text(end + "\0"));
-            client.tableOperations().addSplits(tableName, afterEnd);
-          } catch (Exception ex) {
-            log.error("Exception", ex);
-            synchronized (fail) {
-              fail[0] = true;
+    try (AccumuloClient client = getAccumuloClient()) {
+
+      // Eliminate whole tablets
+      for (int test = 0; test < 10; test++) {
+        // create a table
+        log.info("Test {}", test);
+        client.tableOperations().create(tableName);
+
+        // put some data in it
+        fillTable(client, tableName);
+
+        // generate a random delete range
+        final Text start = new Text();
+        final Text end = new Text();
+        generateRandomRange(start, end);
+
+        // initiate the delete range
+        final boolean fail[] = {false};
+        Thread t = new Thread() {
+          @Override
+          public void run() {
+            try {
+              // split the table
+              final SortedSet<Text> afterEnd = SPLITS.tailSet(new Text(end + "\0"));
+              client.tableOperations().addSplits(tableName, afterEnd);
+            } catch (Exception ex) {
+              log.error("Exception", ex);
+              synchronized (fail) {
+                fail[0] = true;
+              }
             }
           }
-        }
-      };
-      t.start();
-
-      sleepUninterruptibly(test * 2, TimeUnit.MILLISECONDS);
+        };
+        t.start();
 
-      client.tableOperations().deleteRows(tableName, start, end);
+        sleepUninterruptibly(test * 2, TimeUnit.MILLISECONDS);
 
-      t.join();
-      synchronized (fail) {
-        assertTrue(!fail[0]);
-      }
+        client.tableOperations().deleteRows(tableName, start, end);
 
-      // scan the table
-      try (Scanner scanner = client.createScanner(tableName, Authorizations.EMPTY)) {
-        for (Entry<Key,Value> entry : scanner) {
-          Text row = entry.getKey().getRow();
-          assertTrue(row.compareTo(start) <= 0 || row.compareTo(end) > 0);
+        t.join();
+        synchronized (fail) {
+          assertTrue(!fail[0]);
         }
 
-        // delete the table
-        client.tableOperations().delete(tableName);
+        // scan the table
+        try (Scanner scanner = client.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
+          client.tableOperations().delete(tableName);
+        }
       }
     }
   }
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/DeleteTableDuringSplitIT.java b/test/src/main/java/org/apache/accumulo/test/functional/DeleteTableDuringSplitIT.java
index 2d961d20f0..5e3ae3746f 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/DeleteTableDuringSplitIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/DeleteTableDuringSplitIT.java
@@ -26,6 +26,7 @@
 import java.util.TreeSet;
 import java.util.concurrent.Future;
 
+import org.apache.accumulo.core.client.AccumuloClient;
 import org.apache.accumulo.core.client.TableNotFoundException;
 import org.apache.accumulo.core.util.SimpleThreadPool;
 import org.apache.accumulo.fate.util.UtilWaitThread;
@@ -47,66 +48,70 @@ protected int defaultTimeoutSeconds() {
 
   @Test
   public void test() throws Exception {
-    // 96 invocations, 8 at a time
-    int batches = 12, batchSize = 8;
-    String[] tableNames = getUniqueNames(batches * batchSize);
-    // make a bunch of tables
-    for (String tableName : tableNames) {
-      getAccumuloClient().tableOperations().create(tableName);
-    }
-    final SortedSet<Text> splits = new TreeSet<>();
-    for (byte i = 0; i < 100; i++) {
-      splits.add(new Text(new byte[] {0, 0, i}));
-    }
 
-    List<Future<?>> results = new ArrayList<>();
-    List<Runnable> tasks = new ArrayList<>();
-    SimpleThreadPool es = new SimpleThreadPool(batchSize * 2, "concurrent-api-requests");
-    for (String tableName : tableNames) {
-      final String finalName = tableName;
-      tasks.add(new Runnable() {
-        @Override
-        public void run() {
-          try {
-            getAccumuloClient().tableOperations().addSplits(finalName, splits);
-          } catch (TableNotFoundException ex) {
-            // expected, ignore
-          } catch (Exception ex) {
-            throw new RuntimeException(finalName, ex);
+    try (AccumuloClient client = getAccumuloClient()) {
+
+      // 96 invocations, 8 at a time
+      int batches = 12, batchSize = 8;
+      String[] tableNames = getUniqueNames(batches * batchSize);
+      // make a bunch of tables
+      for (String tableName : tableNames) {
+        client.tableOperations().create(tableName);
+      }
+      final SortedSet<Text> splits = new TreeSet<>();
+      for (byte i = 0; i < 100; i++) {
+        splits.add(new Text(new byte[] {0, 0, i}));
+      }
+
+      List<Future<?>> results = new ArrayList<>();
+      List<Runnable> tasks = new ArrayList<>();
+      SimpleThreadPool es = new SimpleThreadPool(batchSize * 2, "concurrent-api-requests");
+      for (String tableName : tableNames) {
+        final String finalName = tableName;
+        tasks.add(new Runnable() {
+          @Override
+          public void run() {
+            try {
+              client.tableOperations().addSplits(finalName, splits);
+            } catch (TableNotFoundException ex) {
+              // expected, ignore
+            } catch (Exception ex) {
+              throw new RuntimeException(finalName, ex);
+            }
           }
-        }
-      });
-      tasks.add(new Runnable() {
-        @Override
-        public void run() {
-          try {
-            UtilWaitThread.sleep(500);
-            getAccumuloClient().tableOperations().delete(finalName);
-          } catch (Exception ex) {
-            throw new RuntimeException(ex);
+        });
+        tasks.add(new Runnable() {
+          @Override
+          public void run() {
+            try {
+              UtilWaitThread.sleep(500);
+              client.tableOperations().delete(finalName);
+            } catch (Exception ex) {
+              throw new RuntimeException(ex);
+            }
           }
+        });
+      }
+      Iterator<Runnable> itr = tasks.iterator();
+      for (int batch = 0; batch < batches; batch++) {
+        for (int i = 0; i < batchSize; i++) {
+          Future<?> f = es.submit(itr.next());
+          results.add(f);
+          f = es.submit(itr.next());
+          results.add(f);
         }
-      });
-    }
-    Iterator<Runnable> itr = tasks.iterator();
-    for (int batch = 0; batch < batches; batch++) {
-      for (int i = 0; i < batchSize; i++) {
-        Future<?> f = es.submit(itr.next());
-        results.add(f);
-        f = es.submit(itr.next());
-        results.add(f);
+        for (Future<?> f : results) {
+          f.get();
+        }
+        results.clear();
       }
-      for (Future<?> f : results) {
-        f.get();
+      // Shut down the ES
+      List<Runnable> queued = es.shutdownNow();
+      assertTrue("Had more tasks to run", queued.isEmpty());
+      assertFalse("Had more tasks that needed to be submitted", itr.hasNext());
+      for (String tableName : tableNames) {
+        assertFalse(client.tableOperations().exists(tableName));
       }
-      results.clear();
-    }
-    // Shut down the ES
-    List<Runnable> queued = es.shutdownNow();
-    assertTrue("Had more tasks to run", queued.isEmpty());
-    assertFalse("Had more tasks that needed to be submitted", itr.hasNext());
-    for (String tableName : tableNames) {
-      assertFalse(getAccumuloClient().tableOperations().exists(tableName));
     }
   }
 
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/DeletedTablesDontFlushIT.java b/test/src/main/java/org/apache/accumulo/test/functional/DeletedTablesDontFlushIT.java
index 0384fa229f..289fadb097 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/DeletedTablesDontFlushIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/DeletedTablesDontFlushIT.java
@@ -51,24 +51,25 @@ public static void teardown() throws Exception {
 
   @Test
   public void test() throws Exception {
-    AccumuloClient c = getClient();
-    String tableName = getUniqueNames(1)[0];
-    c.tableOperations().create(tableName);
-    IteratorSetting setting = new IteratorSetting(100, SlowIterator.class);
-    SlowIterator.setSleepTime(setting, 1000);
-    c.tableOperations().attachIterator(tableName, setting, EnumSet.of(IteratorScope.minc));
-    // let the configuration change propagate through zookeeper
-    UtilWaitThread.sleep(1000);
+    try (AccumuloClient c = getClient()) {
+      String tableName = getUniqueNames(1)[0];
+      c.tableOperations().create(tableName);
+      IteratorSetting setting = new IteratorSetting(100, SlowIterator.class);
+      SlowIterator.setSleepTime(setting, 1000);
+      c.tableOperations().attachIterator(tableName, setting, EnumSet.of(IteratorScope.minc));
+      // let the configuration change propagate through zookeeper
+      UtilWaitThread.sleep(1000);
 
-    Mutation m = new Mutation("xyzzy");
-    for (int i = 0; i < 100; i++) {
-      m.put("cf", "" + i, new Value(new byte[] {}));
+      Mutation m = new Mutation("xyzzy");
+      for (int i = 0; i < 100; i++) {
+        m.put("cf", "" + i, new Value(new byte[] {}));
+      }
+      BatchWriter bw = c.createBatchWriter(tableName, new BatchWriterConfig());
+      bw.addMutation(m);
+      bw.close();
+      // should go fast
+      c.tableOperations().delete(tableName);
     }
-    BatchWriter bw = c.createBatchWriter(tableName, new BatchWriterConfig());
-    bw.addMutation(m);
-    bw.close();
-    // should go fast
-    c.tableOperations().delete(tableName);
   }
 
 }
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/DurabilityIT.java b/test/src/main/java/org/apache/accumulo/test/functional/DurabilityIT.java
index 2adedca86b..2bee65ef18 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/DurabilityIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/DurabilityIT.java
@@ -66,14 +66,13 @@ public static void checkMR() {
 
   static final long N = 100000;
 
-  private String[] init() throws Exception {
+  private String[] init(AccumuloClient c) throws Exception {
     String[] tableNames = getUniqueNames(4);
-    AccumuloClient c = getClient();
     TableOperations tableOps = c.tableOperations();
-    createTable(tableNames[0]);
-    createTable(tableNames[1]);
-    createTable(tableNames[2]);
-    createTable(tableNames[3]);
+    createTable(c, tableNames[0]);
+    createTable(c, tableNames[1]);
+    createTable(c, tableNames[2]);
+    createTable(c, tableNames[3]);
     // default is sync
     tableOps.setProperty(tableNames[1], Property.TABLE_DURABILITY.getKey(), "flush");
     tableOps.setProperty(tableNames[2], Property.TABLE_DURABILITY.getKey(), "log");
@@ -81,98 +80,107 @@ public static void checkMR() {
     return tableNames;
   }
 
-  private void cleanup(String[] tableNames) throws Exception {
-    AccumuloClient c = getClient();
+  private void cleanup(AccumuloClient c, String[] tableNames) throws Exception {
     for (String tableName : tableNames) {
       c.tableOperations().delete(tableName);
     }
   }
 
-  private void createTable(String tableName) throws Exception {
-    TableOperations tableOps = getClient().tableOperations();
-    tableOps.create(tableName);
+  private void createTable(AccumuloClient c, String tableName) throws Exception {
+    c.tableOperations().create(tableName);
   }
 
   @Test(timeout = 2 * 60 * 1000)
   public void testWriteSpeed() throws Exception {
-    TableOperations tableOps = getClient().tableOperations();
-    String tableNames[] = init();
-    // write some gunk, delete the table to keep that table from messing with the performance
-    // numbers of successive calls
-    // sync
-    long t0 = writeSome(tableNames[0], N);
-    tableOps.delete(tableNames[0]);
-    // flush
-    long t1 = writeSome(tableNames[1], N);
-    tableOps.delete(tableNames[1]);
-    // log
-    long t2 = writeSome(tableNames[2], N);
-    tableOps.delete(tableNames[2]);
-    // none
-    long t3 = writeSome(tableNames[3], N);
-    tableOps.delete(tableNames[3]);
-    System.out.println(String.format("sync %d flush %d log %d none %d", t0, t1, t2, t3));
-    assertTrue("flush should be faster than sync", t0 > t1);
-    assertTrue("log should be faster than flush", t1 > t2);
-    assertTrue("no durability should be faster than log", t2 > t3);
+    try (AccumuloClient client = getClient()) {
+      TableOperations tableOps = client.tableOperations();
+      String tableNames[] = init(client);
+      // write some gunk, delete the table to keep that table from messing with the performance
+      // numbers of successive calls
+      // sync
+      long t0 = writeSome(client, tableNames[0], N);
+      tableOps.delete(tableNames[0]);
+      // flush
+      long t1 = writeSome(client, tableNames[1], N);
+      tableOps.delete(tableNames[1]);
+      // log
+      long t2 = writeSome(client, tableNames[2], N);
+      tableOps.delete(tableNames[2]);
+      // none
+      long t3 = writeSome(client, tableNames[3], N);
+      tableOps.delete(tableNames[3]);
+      System.out.println(String.format("sync %d flush %d log %d none %d", t0, t1, t2, t3));
+      assertTrue("flush should be faster than sync", t0 > t1);
+      assertTrue("log should be faster than flush", t1 > t2);
+      assertTrue("no durability should be faster than log", t2 > t3);
+    }
   }
 
   @Test(timeout = 4 * 60 * 1000)
   public void testSync() throws Exception {
-    String tableNames[] = init();
-    // sync table should lose nothing
-    writeSome(tableNames[0], N);
-    restartTServer();
-    assertEquals(N, readSome(tableNames[0]));
-    cleanup(tableNames);
+    try (AccumuloClient client = getClient()) {
+      String tableNames[] = init(client);
+      // sync table should lose nothing
+      writeSome(client, tableNames[0], N);
+      restartTServer();
+      assertEquals(N, readSome(client, tableNames[0]));
+      cleanup(client, tableNames);
+    }
   }
 
   @Test(timeout = 4 * 60 * 1000)
   public void testFlush() throws Exception {
-    String tableNames[] = init();
-    // flush table won't lose anything since we're not losing power/dfs
-    writeSome(tableNames[1], N);
-    restartTServer();
-    assertEquals(N, readSome(tableNames[1]));
-    cleanup(tableNames);
+    try (AccumuloClient client = getClient()) {
+      String tableNames[] = init(client);
+      // flush table won't lose anything since we're not losing power/dfs
+      writeSome(client, tableNames[1], N);
+      restartTServer();
+      assertEquals(N, readSome(client, tableNames[1]));
+      cleanup(client, tableNames);
+    }
   }
 
   @Test(timeout = 4 * 60 * 1000)
   public void testLog() throws Exception {
-    String tableNames[] = init();
-    // we're probably going to lose something the the log setting
-    writeSome(tableNames[2], N);
-    restartTServer();
-    long numResults = readSome(tableNames[2]);
-    assertTrue("Expected " + N + " >= " + numResults, N >= numResults);
-    cleanup(tableNames);
+    try (AccumuloClient client = getClient()) {
+      String tableNames[] = init(client);
+      // we're probably going to lose something the the log setting
+      writeSome(client, tableNames[2], N);
+      restartTServer();
+      long numResults = readSome(client, tableNames[2]);
+      assertTrue("Expected " + N + " >= " + numResults, N >= numResults);
+      cleanup(client, tableNames);
+    }
   }
 
   @Test(timeout = 4 * 60 * 1000)
   public void testNone() throws Exception {
-    String tableNames[] = init();
-    // probably won't get any data back without logging
-    writeSome(tableNames[3], N);
-    restartTServer();
-    long numResults = readSome(tableNames[3]);
-    assertTrue("Expected " + N + " >= " + numResults, N >= numResults);
-    cleanup(tableNames);
+    try (AccumuloClient client = getClient()) {
+      String tableNames[] = init(client);
+      // probably won't get any data back without logging
+      writeSome(client, tableNames[3], N);
+      restartTServer();
+      long numResults = readSome(client, tableNames[3]);
+      assertTrue("Expected " + N + " >= " + numResults, N >= numResults);
+      cleanup(client, tableNames);
+    }
   }
 
   @Test(timeout = 4 * 60 * 1000)
   public void testIncreaseDurability() throws Exception {
-    AccumuloClient c = getClient();
-    String tableName = getUniqueNames(1)[0];
-    c.tableOperations().create(tableName);
-    c.tableOperations().setProperty(tableName, Property.TABLE_DURABILITY.getKey(), "none");
-    writeSome(tableName, N);
-    restartTServer();
-    long numResults = readSome(tableName);
-    assertTrue("Expected " + N + " >= " + numResults, N >= numResults);
-    c.tableOperations().setProperty(tableName, Property.TABLE_DURABILITY.getKey(), "sync");
-    writeSome(tableName, N);
-    restartTServer();
-    assertEquals(N, readSome(tableName));
+    try (AccumuloClient c = getClient()) {
+      String tableName = getUniqueNames(1)[0];
+      c.tableOperations().create(tableName);
+      c.tableOperations().setProperty(tableName, Property.TABLE_DURABILITY.getKey(), "none");
+      writeSome(c, tableName, N);
+      restartTServer();
+      long numResults = readSome(c, tableName);
+      assertTrue("Expected " + N + " >= " + numResults, N >= numResults);
+      c.tableOperations().setProperty(tableName, Property.TABLE_DURABILITY.getKey(), "sync");
+      writeSome(c, tableName, N);
+      restartTServer();
+      assertEquals(N, readSome(c, tableName));
+    }
   }
 
   private static Map<String,String> map(Iterable<Entry<String,String>> entries) {
@@ -185,20 +193,21 @@ public void testIncreaseDurability() throws Exception {
 
   @Test(timeout = 4 * 60 * 1000)
   public void testMetaDurability() throws Exception {
-    AccumuloClient c = getClient();
-    String tableName = getUniqueNames(1)[0];
-    c.instanceOperations().setProperty(Property.TABLE_DURABILITY.getKey(), "none");
-    Map<String,String> props = map(c.tableOperations().getProperties(MetadataTable.NAME));
-    assertEquals("sync", props.get(Property.TABLE_DURABILITY.getKey()));
-    c.tableOperations().create(tableName);
-    props = map(c.tableOperations().getProperties(tableName));
-    assertEquals("none", props.get(Property.TABLE_DURABILITY.getKey()));
-    restartTServer();
-    assertTrue(c.tableOperations().exists(tableName));
+    try (AccumuloClient c = getClient()) {
+      String tableName = getUniqueNames(1)[0];
+      c.instanceOperations().setProperty(Property.TABLE_DURABILITY.getKey(), "none");
+      Map<String,String> props = map(c.tableOperations().getProperties(MetadataTable.NAME));
+      assertEquals("sync", props.get(Property.TABLE_DURABILITY.getKey()));
+      c.tableOperations().create(tableName);
+      props = map(c.tableOperations().getProperties(tableName));
+      assertEquals("none", props.get(Property.TABLE_DURABILITY.getKey()));
+      restartTServer();
+      assertTrue(c.tableOperations().exists(tableName));
+    }
   }
 
-  private long readSome(String table) throws Exception {
-    return Iterators.size(getClient().createScanner(table, Authorizations.EMPTY).iterator());
+  private long readSome(AccumuloClient client, String table) throws Exception {
+    return Iterators.size(client.createScanner(table, Authorizations.EMPTY).iterator());
   }
 
   private void restartTServer() throws Exception {
@@ -208,12 +217,11 @@ private void restartTServer() throws Exception {
     cluster.start();
   }
 
-  private long writeSome(String table, long count) throws Exception {
+  private long writeSome(AccumuloClient c, String table, long count) throws Exception {
     int iterations = 5;
     long[] attempts = new long[iterations];
     for (int attempt = 0; attempt < iterations; attempt++) {
       long now = System.currentTimeMillis();
-      AccumuloClient c = getClient();
       BatchWriter bw = c.createBatchWriter(table, null);
       for (int i = 1; i < count + 1; i++) {
         Mutation m = new Mutation("" + i);
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/DynamicThreadPoolsIT.java b/test/src/main/java/org/apache/accumulo/test/functional/DynamicThreadPoolsIT.java
index 08dd1af805..ff3640c55f 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/DynamicThreadPoolsIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/DynamicThreadPoolsIT.java
@@ -61,67 +61,70 @@ protected int defaultTimeoutSeconds() {
 
   @Before
   public void updateMajcDelay() throws Exception {
-    AccumuloClient c = getAccumuloClient();
-    majcDelay = c.instanceOperations().getSystemConfiguration()
-        .get(Property.TSERV_MAJC_DELAY.getKey());
-    c.instanceOperations().setProperty(Property.TSERV_MAJC_DELAY.getKey(), "100ms");
-    if (getClusterType() == ClusterType.STANDALONE) {
-      Thread.sleep(ConfigurationTypeHelper.getTimeInMillis(majcDelay));
+    try (AccumuloClient c = getAccumuloClient()) {
+      majcDelay = c.instanceOperations().getSystemConfiguration()
+          .get(Property.TSERV_MAJC_DELAY.getKey());
+      c.instanceOperations().setProperty(Property.TSERV_MAJC_DELAY.getKey(), "100ms");
+      if (getClusterType() == ClusterType.STANDALONE) {
+        Thread.sleep(ConfigurationTypeHelper.getTimeInMillis(majcDelay));
+      }
     }
   }
 
   @After
   public void resetMajcDelay() throws Exception {
-    AccumuloClient c = getAccumuloClient();
-    c.instanceOperations().setProperty(Property.TSERV_MAJC_DELAY.getKey(), majcDelay);
+    try (AccumuloClient c = getAccumuloClient()) {
+      c.instanceOperations().setProperty(Property.TSERV_MAJC_DELAY.getKey(), majcDelay);
+    }
   }
 
   @Test
   public void test() throws Exception {
     final String[] tables = getUniqueNames(15);
     String firstTable = tables[0];
-    AccumuloClient c = getAccumuloClient();
-    c.instanceOperations().setProperty(Property.TSERV_MAJC_MAXCONCURRENT.getKey(), "5");
-    TestIngest.Opts opts = new TestIngest.Opts();
-    opts.rows = 500 * 1000;
-    opts.createTable = true;
-    opts.setTableName(firstTable);
-    opts.setClientInfo(getClientInfo());
-    TestIngest.ingest(c, opts, new BatchWriterOpts());
-    c.tableOperations().flush(firstTable, null, null, true);
-    for (int i = 1; i < tables.length; i++)
-      c.tableOperations().clone(firstTable, tables[i], true, null, null);
-    sleepUninterruptibly(11, TimeUnit.SECONDS); // time between checks of the thread pool sizes
-    Credentials creds = new Credentials(getAdminPrincipal(), getAdminToken());
-    for (int i = 1; i < tables.length; i++)
-      c.tableOperations().compact(tables[i], null, null, true, false);
-    for (int i = 0; i < 30; i++) {
-      int count = 0;
-      MasterClientService.Iface client = null;
-      MasterMonitorInfo stats = null;
-      while (true) {
-        try {
-          client = MasterClient.getConnectionWithRetry(getClientContext());
-          stats = client.getMasterStats(Tracer.traceInfo(), creds.toThrift(c.getInstanceID()));
-          break;
-        } catch (ThriftNotActiveServiceException e) {
-          // Let it loop, fetching a new location
-          sleepUninterruptibly(100, TimeUnit.MILLISECONDS);
-        } finally {
-          if (client != null)
-            MasterClient.close(client);
+    try (AccumuloClient c = getAccumuloClient()) {
+      c.instanceOperations().setProperty(Property.TSERV_MAJC_MAXCONCURRENT.getKey(), "5");
+      TestIngest.Opts opts = new TestIngest.Opts();
+      opts.rows = 500 * 1000;
+      opts.createTable = true;
+      opts.setTableName(firstTable);
+      opts.setClientInfo(getClientInfo());
+      TestIngest.ingest(c, opts, new BatchWriterOpts());
+      c.tableOperations().flush(firstTable, null, null, true);
+      for (int i = 1; i < tables.length; i++)
+        c.tableOperations().clone(firstTable, tables[i], true, null, null);
+      sleepUninterruptibly(11, TimeUnit.SECONDS); // time between checks of the thread pool sizes
+      Credentials creds = new Credentials(getAdminPrincipal(), getAdminToken());
+      for (int i = 1; i < tables.length; i++)
+        c.tableOperations().compact(tables[i], null, null, true, false);
+      for (int i = 0; i < 30; i++) {
+        int count = 0;
+        MasterClientService.Iface client = null;
+        MasterMonitorInfo stats = null;
+        while (true) {
+          try {
+            client = MasterClient.getConnectionWithRetry(getClientContext());
+            stats = client.getMasterStats(Tracer.traceInfo(), creds.toThrift(c.getInstanceID()));
+            break;
+          } catch (ThriftNotActiveServiceException e) {
+            // Let it loop, fetching a new location
+            sleepUninterruptibly(100, TimeUnit.MILLISECONDS);
+          } finally {
+            if (client != null)
+              MasterClient.close(client);
+          }
         }
-      }
-      for (TabletServerStatus server : stats.tServerInfo) {
-        for (TableInfo table : server.tableMap.values()) {
-          count += table.majors.running;
+        for (TabletServerStatus server : stats.tServerInfo) {
+          for (TableInfo table : server.tableMap.values()) {
+            count += table.majors.running;
+          }
         }
+        System.out.println("count " + count);
+        if (count > 3)
+          return;
+        sleepUninterruptibly(500, TimeUnit.MILLISECONDS);
       }
-      System.out.println("count " + count);
-      if (count > 3)
-        return;
-      sleepUninterruptibly(500, TimeUnit.MILLISECONDS);
+      fail("Could not observe higher number of threads after changing the config");
     }
-    fail("Could not observe higher number of threads after changing the config");
   }
 }
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/FateStarvationIT.java b/test/src/main/java/org/apache/accumulo/test/functional/FateStarvationIT.java
index f95cba8ecd..4bbbb1ab64 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/FateStarvationIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/FateStarvationIT.java
@@ -41,36 +41,36 @@ protected int defaultTimeoutSeconds() {
   @Test
   public void run() throws Exception {
     String tableName = getUniqueNames(1)[0];
-    AccumuloClient c = getAccumuloClient();
-    c.tableOperations().create(tableName);
+    try (AccumuloClient c = getAccumuloClient()) {
+      c.tableOperations().create(tableName);
 
-    c.tableOperations().addSplits(tableName, TestIngest.getSplitPoints(0, 100000, 50));
+      c.tableOperations().addSplits(tableName, TestIngest.getSplitPoints(0, 100000, 50));
 
-    TestIngest.Opts opts = new TestIngest.Opts();
-    opts.random = 89;
-    opts.timestamp = 7;
-    opts.dataSize = 50;
-    opts.rows = 100000;
-    opts.cols = 1;
-    opts.setTableName(tableName);
-    opts.setClientInfo(getClientInfo());
-    TestIngest.ingest(c, opts, new BatchWriterOpts());
+      TestIngest.Opts opts = new TestIngest.Opts();
+      opts.random = 89;
+      opts.timestamp = 7;
+      opts.dataSize = 50;
+      opts.rows = 100000;
+      opts.cols = 1;
+      opts.setTableName(tableName);
+      opts.setClientInfo(getClientInfo());
+      TestIngest.ingest(c, opts, new BatchWriterOpts());
 
-    c.tableOperations().flush(tableName, null, null, true);
+      c.tableOperations().flush(tableName, null, null, true);
 
-    List<Text> splits = new ArrayList<>(TestIngest.getSplitPoints(0, 100000, 67));
-    Random rand = new SecureRandom();
+      List<Text> splits = new ArrayList<>(TestIngest.getSplitPoints(0, 100000, 67));
+      Random rand = new SecureRandom();
 
-    for (int i = 0; i < 100; i++) {
-      int idx1 = rand.nextInt(splits.size() - 1);
-      int idx2 = rand.nextInt(splits.size() - (idx1 + 1)) + idx1 + 1;
+      for (int i = 0; i < 100; i++) {
+        int idx1 = rand.nextInt(splits.size() - 1);
+        int idx2 = rand.nextInt(splits.size() - (idx1 + 1)) + idx1 + 1;
 
-      c.tableOperations().compact(tableName, splits.get(idx1), splits.get(idx2), false, false);
-    }
+        c.tableOperations().compact(tableName, splits.get(idx1), splits.get(idx2), false, false);
+      }
 
-    c.tableOperations().offline(tableName);
+      c.tableOperations().offline(tableName);
 
-    FunctionalTestUtils.assertNoDanglingFateLocks(getClientContext(), getCluster());
+      FunctionalTestUtils.assertNoDanglingFateLocks(getClientContext(), getCluster());
+    }
   }
-
 }
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 dd903249a3..69260b6efc 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
@@ -115,32 +115,33 @@ private void killMacGc() throws ProcessNotFoundException, InterruptedException,
   @Test
   public void gcTest() throws Exception {
     killMacGc();
-    AccumuloClient c = getClient();
-    c.tableOperations().create("test_ingest");
-    c.tableOperations().setProperty("test_ingest", Property.TABLE_SPLIT_THRESHOLD.getKey(), "5K");
-    TestIngest.Opts opts = new TestIngest.Opts();
-    VerifyIngest.Opts vopts = new VerifyIngest.Opts();
-    vopts.rows = opts.rows = 10000;
-    vopts.cols = opts.cols = 1;
-    opts.setClientInfo(getClientInfo());
-    vopts.setClientInfo(getClientInfo());
-    TestIngest.ingest(c, cluster.getFileSystem(), opts, new BatchWriterOpts());
-    c.tableOperations().compact("test_ingest", null, null, true, true);
-    int before = countFiles();
-    while (true) {
-      sleepUninterruptibly(1, TimeUnit.SECONDS);
-      int more = countFiles();
-      if (more <= before)
-        break;
-      before = more;
-    }
+    try (AccumuloClient c = getClient()) {
+      c.tableOperations().create("test_ingest");
+      c.tableOperations().setProperty("test_ingest", Property.TABLE_SPLIT_THRESHOLD.getKey(), "5K");
+      TestIngest.Opts opts = new TestIngest.Opts();
+      VerifyIngest.Opts vopts = new VerifyIngest.Opts();
+      vopts.rows = opts.rows = 10000;
+      vopts.cols = opts.cols = 1;
+      opts.setClientInfo(getClientInfo());
+      vopts.setClientInfo(getClientInfo());
+      TestIngest.ingest(c, cluster.getFileSystem(), opts, new BatchWriterOpts());
+      c.tableOperations().compact("test_ingest", null, null, true, true);
+      int before = countFiles();
+      while (true) {
+        sleepUninterruptibly(1, TimeUnit.SECONDS);
+        int more = countFiles();
+        if (more <= before)
+          break;
+        before = more;
+      }
 
-    // restart GC
-    getCluster().start();
-    sleepUninterruptibly(15, TimeUnit.SECONDS);
-    int after = countFiles();
-    VerifyIngest.verifyIngest(c, vopts, new ScannerOpts());
-    assertTrue(after < before);
+      // restart GC
+      getCluster().start();
+      sleepUninterruptibly(15, TimeUnit.SECONDS);
+      int after = countFiles();
+      VerifyIngest.verifyIngest(c, vopts, new ScannerOpts());
+      assertTrue(after < before);
+    }
   }
 
   @Test
@@ -148,45 +149,47 @@ public void gcLotsOfCandidatesIT() throws Exception {
     killMacGc();
 
     log.info("Filling metadata table with bogus delete flags");
-    AccumuloClient c = getClient();
-    addEntries(c, new BatchWriterOpts());
-    cluster.getConfig().setDefaultMemory(10, MemoryUnit.MEGABYTE);
-    Process gc = cluster.exec(SimpleGarbageCollector.class);
-    sleepUninterruptibly(20, TimeUnit.SECONDS);
-    String output = "";
-    while (!output.contains("delete candidates has exceeded")) {
-      byte buffer[] = new byte[10 * 1024];
-      try {
-        int n = gc.getInputStream().read(buffer);
-        output = new String(buffer, 0, n, UTF_8);
-      } catch (IOException ex) {
-        break;
+    try (AccumuloClient c = getClient()) {
+      addEntries(c, new BatchWriterOpts());
+      cluster.getConfig().setDefaultMemory(10, MemoryUnit.MEGABYTE);
+      Process gc = cluster.exec(SimpleGarbageCollector.class);
+      sleepUninterruptibly(20, TimeUnit.SECONDS);
+      String output = "";
+      while (!output.contains("delete candidates has exceeded")) {
+        byte buffer[] = new byte[10 * 1024];
+        try {
+          int n = gc.getInputStream().read(buffer);
+          output = new String(buffer, 0, n, UTF_8);
+        } catch (IOException ex) {
+          break;
+        }
       }
+      gc.destroy();
+      assertTrue(output.contains("delete candidates has exceeded"));
     }
-    gc.destroy();
-    assertTrue(output.contains("delete candidates has exceeded"));
   }
 
   @Test
   public void dontGCRootLog() throws Exception {
     killMacGc();
     // dirty metadata
-    AccumuloClient c = getClient();
-    String table = getUniqueNames(1)[0];
-    c.tableOperations().create(table);
-    // let gc run for a bit
-    cluster.start();
-    sleepUninterruptibly(20, TimeUnit.SECONDS);
-    killMacGc();
-    // kill tservers
-    for (ProcessReference ref : cluster.getProcesses().get(ServerType.TABLET_SERVER)) {
-      cluster.killProcess(ServerType.TABLET_SERVER, ref);
-    }
-    // run recovery
-    cluster.start();
-    // did it recover?
-    try (Scanner scanner = c.createScanner(MetadataTable.NAME, Authorizations.EMPTY)) {
-      Iterators.size(scanner.iterator());
+    try (AccumuloClient c = getClient()) {
+      String table = getUniqueNames(1)[0];
+      c.tableOperations().create(table);
+      // let gc run for a bit
+      cluster.start();
+      sleepUninterruptibly(20, TimeUnit.SECONDS);
+      killMacGc();
+      // kill tservers
+      for (ProcessReference ref : cluster.getProcesses().get(ServerType.TABLET_SERVER)) {
+        cluster.killProcess(ServerType.TABLET_SERVER, ref);
+      }
+      // run recovery
+      cluster.start();
+      // did it recover?
+      try (Scanner scanner = c.createScanner(MetadataTable.NAME, Authorizations.EMPTY)) {
+        Iterators.size(scanner.iterator());
+      }
     }
   }
 
@@ -200,99 +203,101 @@ private Mutation createDelMutation(String path, String cf, String cq, String val
   @Test
   public void testInvalidDelete() throws Exception {
     killMacGc();
+    try (AccumuloClient c = getClient()) {
+      String table = getUniqueNames(1)[0];
+      c.tableOperations().create(table);
 
-    String table = getUniqueNames(1)[0];
-    getClient().tableOperations().create(table);
+      BatchWriter bw2 = c.createBatchWriter(table, new BatchWriterConfig());
+      Mutation m1 = new Mutation("r1");
+      m1.put("cf1", "cq1", "v1");
+      bw2.addMutation(m1);
+      bw2.close();
 
-    BatchWriter bw2 = getClient().createBatchWriter(table, new BatchWriterConfig());
-    Mutation m1 = new Mutation("r1");
-    m1.put("cf1", "cq1", "v1");
-    bw2.addMutation(m1);
-    bw2.close();
+      c.tableOperations().flush(table, null, null, true);
 
-    getClient().tableOperations().flush(table, null, null, true);
+      // ensure an invalid delete entry does not cause GC to go berserk ACCUMULO-2520
+      c.securityOperations().grantTablePermission(c.whoami(), MetadataTable.NAME,
+          TablePermission.WRITE);
+      BatchWriter bw3 = c.createBatchWriter(MetadataTable.NAME, new BatchWriterConfig());
 
-    // ensure an invalid delete entry does not cause GC to go berserk ACCUMULO-2520
-    getClient().securityOperations().grantTablePermission(getClient().whoami(), MetadataTable.NAME,
-        TablePermission.WRITE);
-    BatchWriter bw3 = getClient().createBatchWriter(MetadataTable.NAME, new BatchWriterConfig());
-
-    bw3.addMutation(createDelMutation("", "", "", ""));
-    bw3.addMutation(createDelMutation("", "testDel", "test", "valueTest"));
-    bw3.addMutation(createDelMutation("/", "", "", ""));
-    bw3.close();
+      bw3.addMutation(createDelMutation("", "", "", ""));
+      bw3.addMutation(createDelMutation("", "testDel", "test", "valueTest"));
+      bw3.addMutation(createDelMutation("/", "", "", ""));
+      bw3.close();
 
-    Process gc = cluster.exec(SimpleGarbageCollector.class);
-    try {
-      String output = "";
-      while (!output.contains("Ignoring invalid deletion candidate")) {
-        sleepUninterruptibly(250, TimeUnit.MILLISECONDS);
-        try {
-          output = FunctionalTestUtils.readAll(cluster, SimpleGarbageCollector.class, gc);
-        } catch (IOException ioe) {
-          log.error("Could not read all from cluster.", ioe);
+      Process gc = cluster.exec(SimpleGarbageCollector.class);
+      try {
+        String output = "";
+        while (!output.contains("Ignoring invalid deletion candidate")) {
+          sleepUninterruptibly(250, TimeUnit.MILLISECONDS);
+          try {
+            output = FunctionalTestUtils.readAll(cluster, SimpleGarbageCollector.class, gc);
+          } catch (IOException ioe) {
+            log.error("Could not read all from cluster.", ioe);
+          }
         }
+      } finally {
+        gc.destroy();
       }
-    } finally {
-      gc.destroy();
-    }
 
-    try (Scanner scanner = getClient().createScanner(table, Authorizations.EMPTY)) {
-      Iterator<Entry<Key,Value>> iter = scanner.iterator();
-      assertTrue(iter.hasNext());
-      Entry<Key,Value> entry = iter.next();
-      assertEquals("r1", entry.getKey().getRow().toString());
-      assertEquals("cf1", entry.getKey().getColumnFamily().toString());
-      assertEquals("cq1", entry.getKey().getColumnQualifier().toString());
-      assertEquals("v1", entry.getValue().toString());
-      assertFalse(iter.hasNext());
+      try (Scanner scanner = c.createScanner(table, Authorizations.EMPTY)) {
+        Iterator<Entry<Key,Value>> iter = scanner.iterator();
+        assertTrue(iter.hasNext());
+        Entry<Key,Value> entry = iter.next();
+        assertEquals("r1", entry.getKey().getRow().toString());
+        assertEquals("cf1", entry.getKey().getColumnFamily().toString());
+        assertEquals("cq1", entry.getKey().getColumnQualifier().toString());
+        assertEquals("v1", entry.getValue().toString());
+        assertFalse(iter.hasNext());
+      }
     }
   }
 
   @Test
   public void testProperPortAdvertisement() throws Exception {
 
-    AccumuloClient client = getClient();
+    try (AccumuloClient client = getClient()) {
 
-    ZooReaderWriter zk = new ZooReaderWriter(cluster.getZooKeepers(), 30000, OUR_SECRET);
-    String path = ZooUtil.getRoot(client.getInstanceID()) + Constants.ZGC_LOCK;
-    for (int i = 0; i < 5; i++) {
-      List<String> locks;
-      try {
-        locks = zk.getChildren(path, null);
-      } catch (NoNodeException e) {
-        Thread.sleep(5000);
-        continue;
-      }
+      ZooReaderWriter zk = new ZooReaderWriter(cluster.getZooKeepers(), 30000, OUR_SECRET);
+      String path = ZooUtil.getRoot(client.getInstanceID()) + Constants.ZGC_LOCK;
+      for (int i = 0; i < 5; i++) {
+        List<String> locks;
+        try {
+          locks = zk.getChildren(path, null);
+        } catch (NoNodeException e) {
+          Thread.sleep(5000);
+          continue;
+        }
 
-      if (locks != null && locks.size() > 0) {
-        Collections.sort(locks);
+        if (locks != null && locks.size() > 0) {
+          Collections.sort(locks);
 
-        String lockPath = path + "/" + locks.get(0);
+          String lockPath = path + "/" + locks.get(0);
 
-        String gcLoc = new String(zk.getData(lockPath, null));
+          String gcLoc = new String(zk.getData(lockPath, null));
 
-        assertTrue("Found unexpected data in zookeeper for GC location: " + gcLoc,
-            gcLoc.startsWith(Service.GC_CLIENT.name()));
-        int loc = gcLoc.indexOf(ServerServices.SEPARATOR_CHAR);
-        assertNotEquals("Could not find split point of GC location for: " + gcLoc, -1, loc);
-        String addr = gcLoc.substring(loc + 1);
+          assertTrue("Found unexpected data in zookeeper for GC location: " + gcLoc,
+              gcLoc.startsWith(Service.GC_CLIENT.name()));
+          int loc = gcLoc.indexOf(ServerServices.SEPARATOR_CHAR);
+          assertNotEquals("Could not find split point of GC location for: " + gcLoc, -1, loc);
+          String addr = gcLoc.substring(loc + 1);
 
-        int addrSplit = addr.indexOf(':');
-        assertNotEquals("Could not find split of GC host:port for: " + addr, -1, addrSplit);
+          int addrSplit = addr.indexOf(':');
+          assertNotEquals("Could not find split of GC host:port for: " + addr, -1, addrSplit);
 
-        String host = addr.substring(0, addrSplit), port = addr.substring(addrSplit + 1);
-        // We shouldn't have the "bindall" address in zk
-        assertNotEquals("0.0.0.0", host);
-        // Nor should we have the "random port" in zk
-        assertNotEquals(0, Integer.parseInt(port));
-        return;
+          String host = addr.substring(0, addrSplit), port = addr.substring(addrSplit + 1);
+          // We shouldn't have the "bindall" address in zk
+          assertNotEquals("0.0.0.0", host);
+          // Nor should we have the "random port" in zk
+          assertNotEquals(0, Integer.parseInt(port));
+          return;
+        }
+
+        Thread.sleep(5000);
       }
 
-      Thread.sleep(5000);
+      fail("Could not find advertised GC address");
     }
-
-    fail("Could not find advertised GC address");
   }
 
   private int countFiles() throws Exception {
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/HalfDeadTServerIT.java b/test/src/main/java/org/apache/accumulo/test/functional/HalfDeadTServerIT.java
index 704aa937dd..f0cacf2880 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/HalfDeadTServerIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/HalfDeadTServerIT.java
@@ -119,90 +119,91 @@ public String test(int seconds) throws Exception {
   public String test(int seconds, boolean expectTserverDied) throws Exception {
     if (!makeDiskFailureLibrary())
       return null;
-    AccumuloClient c = getClient();
-    assertEquals(1, c.instanceOperations().getTabletServers().size());
-
-    // create our own tablet server with the special test library
-    String javaHome = System.getProperty("java.home");
-    String javaBin = javaHome + File.separator + "bin" + File.separator + "java";
-    String classpath = System.getProperty("java.class.path");
-    classpath = new File(cluster.getConfig().getDir(), "conf") + File.pathSeparator + classpath;
-    String className = TabletServer.class.getName();
-    ArrayList<String> argList = new ArrayList<>();
-    argList.addAll(Arrays.asList(javaBin, "-cp", classpath));
-    argList.addAll(Arrays.asList(Main.class.getName(), className));
-    ProcessBuilder builder = new ProcessBuilder(argList);
-    Map<String,String> env = builder.environment();
-    env.put("ACCUMULO_HOME", cluster.getConfig().getDir().getAbsolutePath());
-    env.put("ACCUMULO_LOG_DIR", cluster.getConfig().getLogDir().getAbsolutePath());
-    String trickFilename = cluster.getConfig().getLogDir().getAbsolutePath() + "/TRICK_FILE";
-    env.put("TRICK_FILE", trickFilename);
-    String libPath = System.getProperty("user.dir") + "/target/fake_disk_failure.so";
-    env.put("LD_PRELOAD", libPath);
-    env.put("DYLD_INSERT_LIBRARIES", libPath);
-    env.put("DYLD_FORCE_FLAT_NAMESPACE", "true");
-    Process ingest = null;
-    Process tserver = builder.start();
-    DumpOutput t = new DumpOutput(tserver.getInputStream());
-    try {
-      t.start();
-      sleepUninterruptibly(1, TimeUnit.SECONDS);
-      // don't need the regular tablet server
-      cluster.killProcess(ServerType.TABLET_SERVER,
-          cluster.getProcesses().get(ServerType.TABLET_SERVER).iterator().next());
-      sleepUninterruptibly(1, TimeUnit.SECONDS);
-      c.tableOperations().create("test_ingest");
+    try (AccumuloClient c = getClient()) {
       assertEquals(1, c.instanceOperations().getTabletServers().size());
-      int rows = 100 * 1000;
-      ingest = cluster.exec(TestIngest.class, "-u", "root", "-i", cluster.getInstanceName(), "-z",
-          cluster.getZooKeepers(), "-p", ROOT_PASSWORD, "--rows", rows + "");
-      sleepUninterruptibly(500, TimeUnit.MILLISECONDS);
 
-      // block I/O with some side-channel trickiness
-      File trickFile = new File(trickFilename);
+      // create our own tablet server with the special test library
+      String javaHome = System.getProperty("java.home");
+      String javaBin = javaHome + File.separator + "bin" + File.separator + "java";
+      String classpath = System.getProperty("java.class.path");
+      classpath = new File(cluster.getConfig().getDir(), "conf") + File.pathSeparator + classpath;
+      String className = TabletServer.class.getName();
+      ArrayList<String> argList = new ArrayList<>();
+      argList.addAll(Arrays.asList(javaBin, "-cp", classpath));
+      argList.addAll(Arrays.asList(Main.class.getName(), className));
+      ProcessBuilder builder = new ProcessBuilder(argList);
+      Map<String,String> env = builder.environment();
+      env.put("ACCUMULO_HOME", cluster.getConfig().getDir().getAbsolutePath());
+      env.put("ACCUMULO_LOG_DIR", cluster.getConfig().getLogDir().getAbsolutePath());
+      String trickFilename = cluster.getConfig().getLogDir().getAbsolutePath() + "/TRICK_FILE";
+      env.put("TRICK_FILE", trickFilename);
+      String libPath = System.getProperty("user.dir") + "/target/fake_disk_failure.so";
+      env.put("LD_PRELOAD", libPath);
+      env.put("DYLD_INSERT_LIBRARIES", libPath);
+      env.put("DYLD_FORCE_FLAT_NAMESPACE", "true");
+      Process ingest = null;
+      Process tserver = builder.start();
+      DumpOutput t = new DumpOutput(tserver.getInputStream());
       try {
-        assertTrue(trickFile.createNewFile());
-        sleepUninterruptibly(seconds, TimeUnit.SECONDS);
-      } finally {
-        if (!trickFile.delete()) {
-          log.error("Couldn't delete {}", trickFile);
-        }
-      }
-
-      if (seconds <= 10) {
-        assertEquals(0, ingest.waitFor());
-        VerifyIngest.Opts vopts = new VerifyIngest.Opts();
-        vopts.rows = rows;
-        vopts.setClientInfo(getClientInfo());
-        VerifyIngest.verifyIngest(c, vopts, new ScannerOpts());
-      } else {
-        sleepUninterruptibly(5, TimeUnit.SECONDS);
-        tserver.waitFor();
-        t.join();
-        tserver = null;
-      }
-      // verify the process was blocked
-      String results = t.toString();
-      assertTrue(results.contains("sleeping\nsleeping\nsleeping\n"));
-      return results;
-    } finally {
-      if (ingest != null) {
-        ingest.destroy();
-        ingest.waitFor();
-      }
-      if (tserver != null) {
+        t.start();
+        sleepUninterruptibly(1, TimeUnit.SECONDS);
+        // don't need the regular tablet server
+        cluster.killProcess(ServerType.TABLET_SERVER,
+            cluster.getProcesses().get(ServerType.TABLET_SERVER).iterator().next());
+        sleepUninterruptibly(1, TimeUnit.SECONDS);
+        c.tableOperations().create("test_ingest");
+        assertEquals(1, c.instanceOperations().getTabletServers().size());
+        int rows = 100 * 1000;
+        ingest = cluster.exec(TestIngest.class, "-u", "root", "-i", cluster.getInstanceName(), "-z",
+            cluster.getZooKeepers(), "-p", ROOT_PASSWORD, "--rows", rows + "");
+        sleepUninterruptibly(500, TimeUnit.MILLISECONDS);
+
+        // block I/O with some side-channel trickiness
+        File trickFile = new File(trickFilename);
         try {
-          if (expectTserverDied) {
-            try {
-              tserver.exitValue();
-            } catch (IllegalThreadStateException e) {
-              fail("Expected TServer to kill itself, but it is still running");
-            }
-          }
+          assertTrue(trickFile.createNewFile());
+          sleepUninterruptibly(seconds, TimeUnit.SECONDS);
         } finally {
-          tserver.destroy();
+          if (!trickFile.delete()) {
+            log.error("Couldn't delete {}", trickFile);
+          }
+        }
+
+        if (seconds <= 10) {
+          assertEquals(0, ingest.waitFor());
+          VerifyIngest.Opts vopts = new VerifyIngest.Opts();
+          vopts.rows = rows;
+          vopts.setClientInfo(getClientInfo());
+          VerifyIngest.verifyIngest(c, vopts, new ScannerOpts());
+        } else {
+          sleepUninterruptibly(5, TimeUnit.SECONDS);
           tserver.waitFor();
           t.join();
+          tserver = null;
+        }
+        // verify the process was blocked
+        String results = t.toString();
+        assertTrue(results.contains("sleeping\nsleeping\nsleeping\n"));
+        return results;
+      } finally {
+        if (ingest != null) {
+          ingest.destroy();
+          ingest.waitFor();
+        }
+        if (tserver != null) {
+          try {
+            if (expectTserverDied) {
+              try {
+                tserver.exitValue();
+              } catch (IllegalThreadStateException e) {
+                fail("Expected TServer to kill itself, but it is still running");
+              }
+            }
+          } finally {
+            tserver.destroy();
+            tserver.waitFor();
+            t.join();
+          }
         }
       }
     }
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 d77c8b7156..0f5ef44ecb 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
@@ -94,17 +94,19 @@ public void getTimeoutFactor() throws Exception {
     REG_TABLE_NAME = names[0];
     PRE_SPLIT_TABLE_NAME = names[1];
 
-    AccumuloClient c = getAccumuloClient();
-    tservMajcDelay = c.instanceOperations().getSystemConfiguration()
-        .get(Property.TSERV_MAJC_DELAY.getKey());
-    c.instanceOperations().setProperty(Property.TSERV_MAJC_DELAY.getKey(), "10ms");
+    try (AccumuloClient c = getAccumuloClient()) {
+      tservMajcDelay = c.instanceOperations().getSystemConfiguration()
+          .get(Property.TSERV_MAJC_DELAY.getKey());
+      c.instanceOperations().setProperty(Property.TSERV_MAJC_DELAY.getKey(), "10ms");
+    }
   }
 
   @After
   public void resetMajcDelay() throws Exception {
     if (null != tservMajcDelay) {
-      AccumuloClient client = getAccumuloClient();
-      client.instanceOperations().setProperty(Property.TSERV_MAJC_DELAY.getKey(), tservMajcDelay);
+      try (AccumuloClient client = getAccumuloClient()) {
+        client.instanceOperations().setProperty(Property.TSERV_MAJC_DELAY.getKey(), tservMajcDelay);
+      }
     }
   }
 
@@ -121,15 +123,16 @@ public void run() throws Exception {
       TestIngest.toPrintableChars(rowData);
       splitPoints.add(new Text(rowData));
     }
-    AccumuloClient c = getAccumuloClient();
-    c.tableOperations().create(REG_TABLE_NAME);
-    c.tableOperations().create(PRE_SPLIT_TABLE_NAME);
-    c.tableOperations().setProperty(PRE_SPLIT_TABLE_NAME, Property.TABLE_MAX_END_ROW_SIZE.getKey(),
-        "256K");
-    sleepUninterruptibly(3, TimeUnit.SECONDS);
-    c.tableOperations().addSplits(PRE_SPLIT_TABLE_NAME, splitPoints);
-    test1(c);
-    test2(c);
+    try (AccumuloClient c = getAccumuloClient()) {
+      c.tableOperations().create(REG_TABLE_NAME);
+      c.tableOperations().create(PRE_SPLIT_TABLE_NAME);
+      c.tableOperations().setProperty(PRE_SPLIT_TABLE_NAME,
+          Property.TABLE_MAX_END_ROW_SIZE.getKey(), "256K");
+      sleepUninterruptibly(3, TimeUnit.SECONDS);
+      c.tableOperations().addSplits(PRE_SPLIT_TABLE_NAME, splitPoints);
+      test1(c);
+      test2(c);
+    }
   }
 
   private void test1(AccumuloClient c) throws Exception {
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 86b5ebfe5c..fdf9dbd691 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
@@ -45,46 +45,48 @@ protected int defaultTimeoutSeconds() {
   public void run() throws Exception {
     int tc = 0;
     String tableName = getUniqueNames(1)[0];
-    AccumuloClient c = getAccumuloClient();
-    runMergeTest(c, tableName + tc++, new String[] {"m"}, new String[] {"a"}, null, null, "b", 2L);
-    runMergeTest(c, tableName + tc++, new String[] {"m"}, new String[] {"z"}, null, null, "b", 2L);
-    runMergeTest(c, tableName + tc++, new String[] {"m"}, new String[] {"a", "z"}, null, null, "b",
-        2L);
-    runMergeTest(c, tableName + tc++, new String[] {"m"}, new String[] {"a", "c", "z"}, null, null,
-        "b", 3L);
-    runMergeTest(c, tableName + tc++, new String[] {"m"}, new String[] {"a", "y", "z"}, null, null,
-        "b", 3L);
-
-    runMergeTest(c, tableName + tc++, new String[] {"g", "r"}, new String[] {"a"}, null, null, "b",
-        2L);
-    runMergeTest(c, tableName + tc++, new String[] {"g", "r"}, new String[] {"h"}, null, null, "b",
-        2L);
-    runMergeTest(c, tableName + tc++, new String[] {"g", "r"}, new String[] {"s"}, null, null, "b",
-        2L);
-    runMergeTest(c, tableName + tc++, new String[] {"g", "r"}, new String[] {"a", "h", "s"}, null,
-        null, "b", 2L);
-    runMergeTest(c, tableName + tc++, new String[] {"g", "r"}, new String[] {"a", "c", "h", "s"},
-        null, null, "b", 3L);
-    runMergeTest(c, tableName + tc++, new String[] {"g", "r"}, new String[] {"a", "h", "s", "i"},
-        null, null, "b", 3L);
-    runMergeTest(c, tableName + tc++, new String[] {"g", "r"}, new String[] {"t", "a", "h", "s"},
-        null, null, "b", 3L);
-
-    runMergeTest(c, tableName + tc++, new String[] {"g", "r"}, new String[] {"a"}, null, "h", "b",
-        2L);
-    runMergeTest(c, tableName + tc++, new String[] {"g", "r"}, new String[] {"h"}, null, "h", "b",
-        2L);
-    runMergeTest(c, tableName + tc++, new String[] {"g", "r"}, new String[] {"s"}, null, "h", "b",
-        1L);
-    runMergeTest(c, tableName + tc++, new String[] {"g", "r"}, new String[] {"a", "h", "s"}, null,
-        "h", "b", 2L);
-    runMergeTest(c, tableName + tc++, new String[] {"g", "r"}, new String[] {"a", "c", "h", "s"},
-        null, "h", "b", 3L);
-    runMergeTest(c, tableName + tc++, new String[] {"g", "r"}, new String[] {"a", "h", "s", "i"},
-        null, "h", "b", 3L);
-    runMergeTest(c, tableName + tc++, new String[] {"g", "r"}, new String[] {"t", "a", "h", "s"},
-        null, "h", "b", 2L);
-
+    try (AccumuloClient c = getAccumuloClient()) {
+      runMergeTest(c, tableName + tc++, new String[] {"m"}, new String[] {"a"}, null, null, "b",
+          2L);
+      runMergeTest(c, tableName + tc++, new String[] {"m"}, new String[] {"z"}, null, null, "b",
+          2L);
+      runMergeTest(c, tableName + tc++, new String[] {"m"}, new String[] {"a", "z"}, null, null,
+          "b", 2L);
+      runMergeTest(c, tableName + tc++, new String[] {"m"}, new String[] {"a", "c", "z"}, null,
+          null, "b", 3L);
+      runMergeTest(c, tableName + tc++, new String[] {"m"}, new String[] {"a", "y", "z"}, null,
+          null, "b", 3L);
+
+      runMergeTest(c, tableName + tc++, new String[] {"g", "r"}, new String[] {"a"}, null, null,
+          "b", 2L);
+      runMergeTest(c, tableName + tc++, new String[] {"g", "r"}, new String[] {"h"}, null, null,
+          "b", 2L);
+      runMergeTest(c, tableName + tc++, new String[] {"g", "r"}, new String[] {"s"}, null, null,
+          "b", 2L);
+      runMergeTest(c, tableName + tc++, new String[] {"g", "r"}, new String[] {"a", "h", "s"}, null,
+          null, "b", 2L);
+      runMergeTest(c, tableName + tc++, new String[] {"g", "r"}, new String[] {"a", "c", "h", "s"},
+          null, null, "b", 3L);
+      runMergeTest(c, tableName + tc++, new String[] {"g", "r"}, new String[] {"a", "h", "s", "i"},
+          null, null, "b", 3L);
+      runMergeTest(c, tableName + tc++, new String[] {"g", "r"}, new String[] {"t", "a", "h", "s"},
+          null, null, "b", 3L);
+
+      runMergeTest(c, tableName + tc++, new String[] {"g", "r"}, new String[] {"a"}, null, "h", "b",
+          2L);
+      runMergeTest(c, tableName + tc++, new String[] {"g", "r"}, new String[] {"h"}, null, "h", "b",
+          2L);
+      runMergeTest(c, tableName + tc++, new String[] {"g", "r"}, new String[] {"s"}, null, "h", "b",
+          1L);
+      runMergeTest(c, tableName + tc++, new String[] {"g", "r"}, new String[] {"a", "h", "s"}, null,
+          "h", "b", 2L);
+      runMergeTest(c, tableName + tc++, new String[] {"g", "r"}, new String[] {"a", "c", "h", "s"},
+          null, "h", "b", 3L);
+      runMergeTest(c, tableName + tc++, new String[] {"g", "r"}, new String[] {"a", "h", "s", "i"},
+          null, "h", "b", 3L);
+      runMergeTest(c, tableName + tc++, new String[] {"g", "r"}, new String[] {"t", "a", "h", "s"},
+          null, "h", "b", 2L);
+    }
   }
 
   private void runMergeTest(AccumuloClient client, String table, String[] splits, String[] inserts,
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 ea95724c5a..eda9cf6364 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
@@ -64,7 +64,9 @@ protected int defaultTimeoutSeconds() {
 
   @Test
   public void test() throws Exception {
-    runTest(getClient(), getCluster());
+    try (AccumuloClient client = getClient()) {
+      runTest(client, getCluster());
+    }
   }
 
   @SuppressFBWarnings(value = "WEAK_MESSAGE_DIGEST_MD5", justification = "md5 is okay for testing")
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 ca7b6d063f..9d76ee3e13 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
@@ -46,46 +46,47 @@ protected int defaultTimeoutSeconds() {
 
   @Test
   public void test() throws Exception {
-    AccumuloClient c = getAccumuloClient();
-    String tableName = super.getUniqueNames(1)[0];
-    c.tableOperations().create(tableName);
-    String tableId = c.tableOperations().tableIdMap().get(tableName);
-    // wait for the table to be online
-    TabletLocationState newTablet;
-    do {
-      UtilWaitThread.sleep(250);
-      newTablet = getTabletLocationState(c, tableId);
-    } while (newTablet.current == null);
-    assertNull(newTablet.last);
-    assertNull(newTablet.future);
+    try (AccumuloClient c = getAccumuloClient()) {
+      String tableName = super.getUniqueNames(1)[0];
+      c.tableOperations().create(tableName);
+      String tableId = c.tableOperations().tableIdMap().get(tableName);
+      // wait for the table to be online
+      TabletLocationState newTablet;
+      do {
+        UtilWaitThread.sleep(250);
+        newTablet = getTabletLocationState(c, tableId);
+      } while (newTablet.current == null);
+      assertNull(newTablet.last);
+      assertNull(newTablet.future);
 
-    // put something in it
-    BatchWriter bw = c.createBatchWriter(tableName, new BatchWriterConfig());
-    Mutation m = new Mutation("a");
-    m.put("b", "c", "d");
-    bw.addMutation(m);
-    bw.close();
-    // give it a last location
-    c.tableOperations().flush(tableName, null, null, true);
+      // put something in it
+      BatchWriter bw = c.createBatchWriter(tableName, new BatchWriterConfig());
+      Mutation m = new Mutation("a");
+      m.put("b", "c", "d");
+      bw.addMutation(m);
+      bw.close();
+      // give it a last location
+      c.tableOperations().flush(tableName, null, null, true);
 
-    TabletLocationState flushed = getTabletLocationState(c, tableId);
-    assertEquals(newTablet.current, flushed.current);
-    assertEquals(flushed.current, flushed.last);
-    assertNull(newTablet.future);
+      TabletLocationState flushed = getTabletLocationState(c, tableId);
+      assertEquals(newTablet.current, flushed.current);
+      assertEquals(flushed.current, flushed.last);
+      assertNull(newTablet.future);
 
-    // take the tablet offline
-    c.tableOperations().offline(tableName, true);
-    TabletLocationState offline = getTabletLocationState(c, tableId);
-    assertNull(offline.future);
-    assertNull(offline.current);
-    assertEquals(flushed.current, offline.last);
+      // take the tablet offline
+      c.tableOperations().offline(tableName, true);
+      TabletLocationState offline = getTabletLocationState(c, tableId);
+      assertNull(offline.future);
+      assertNull(offline.current);
+      assertEquals(flushed.current, offline.last);
 
-    // put it back online
-    c.tableOperations().online(tableName, true);
-    TabletLocationState online = getTabletLocationState(c, tableId);
-    assertNull(online.future);
-    assertNotNull(online.current);
-    assertEquals(online.current, online.last);
+      // put it back online
+      c.tableOperations().online(tableName, true);
+      TabletLocationState online = getTabletLocationState(c, tableId);
+      assertNull(online.future);
+      assertNotNull(online.current);
+      assertEquals(online.current, online.last);
+    }
   }
 
   private TabletLocationState getTabletLocationState(AccumuloClient c, String tableId)
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/MasterFailoverIT.java b/test/src/main/java/org/apache/accumulo/test/functional/MasterFailoverIT.java
index 104e59b648..602a9e18e6 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/MasterFailoverIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/MasterFailoverIT.java
@@ -49,23 +49,24 @@ protected int defaultTimeoutSeconds() {
 
   @Test
   public void test() throws Exception {
-    AccumuloClient c = getAccumuloClient();
-    String[] names = getUniqueNames(2);
-    c.tableOperations().create(names[0]);
-    TestIngest.Opts opts = new TestIngest.Opts();
-    opts.setTableName(names[0]);
-    opts.setClientInfo(getClientInfo());
-    TestIngest.ingest(c, opts, new BatchWriterOpts());
+    try (AccumuloClient c = getAccumuloClient()) {
+      String[] names = getUniqueNames(2);
+      c.tableOperations().create(names[0]);
+      TestIngest.Opts opts = new TestIngest.Opts();
+      opts.setTableName(names[0]);
+      opts.setClientInfo(getClientInfo());
+      TestIngest.ingest(c, opts, new BatchWriterOpts());
 
-    ClusterControl control = cluster.getClusterControl();
-    control.stopAllServers(ServerType.MASTER);
-    // start up a new one
-    control.startAllServers(ServerType.MASTER);
-    // talk to it
-    c.tableOperations().rename(names[0], names[1]);
-    VerifyIngest.Opts vopts = new VerifyIngest.Opts();
-    vopts.setTableName(names[1]);
-    vopts.setClientInfo(getClientInfo());
-    VerifyIngest.verifyIngest(c, vopts, new ScannerOpts());
+      ClusterControl control = cluster.getClusterControl();
+      control.stopAllServers(ServerType.MASTER);
+      // start up a new one
+      control.startAllServers(ServerType.MASTER);
+      // talk to it
+      c.tableOperations().rename(names[0], names[1]);
+      VerifyIngest.Opts vopts = new VerifyIngest.Opts();
+      vopts.setTableName(names[1]);
+      vopts.setClientInfo(getClientInfo());
+      VerifyIngest.verifyIngest(c, vopts, new ScannerOpts());
+    }
   }
 }
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 454798bbe3..7b2acb922c 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
@@ -65,24 +65,28 @@ protected int defaultTimeoutSeconds() {
 
   @Before
   public void alterConfig() throws Exception {
-    InstanceOperations iops = getAccumuloClient().instanceOperations();
-    Map<String,String> sysConfig = iops.getSystemConfiguration();
-    scanMaxOpenFiles = sysConfig.get(Property.TSERV_SCAN_MAX_OPENFILES.getKey());
-    majcConcurrent = sysConfig.get(Property.TSERV_MAJC_MAXCONCURRENT.getKey());
-    majcThreadMaxOpen = sysConfig.get(Property.TSERV_MAJC_THREAD_MAXOPEN.getKey());
+    try (AccumuloClient client = getAccumuloClient()) {
+      InstanceOperations iops = client.instanceOperations();
+      Map<String,String> sysConfig = iops.getSystemConfiguration();
+      scanMaxOpenFiles = sysConfig.get(Property.TSERV_SCAN_MAX_OPENFILES.getKey());
+      majcConcurrent = sysConfig.get(Property.TSERV_MAJC_MAXCONCURRENT.getKey());
+      majcThreadMaxOpen = sysConfig.get(Property.TSERV_MAJC_THREAD_MAXOPEN.getKey());
+    }
   }
 
   @After
   public void restoreConfig() throws Exception {
-    InstanceOperations iops = getAccumuloClient().instanceOperations();
-    if (null != scanMaxOpenFiles) {
-      iops.setProperty(Property.TSERV_SCAN_MAX_OPENFILES.getKey(), scanMaxOpenFiles);
-    }
-    if (null != majcConcurrent) {
-      iops.setProperty(Property.TSERV_MAJC_MAXCONCURRENT.getKey(), majcConcurrent);
-    }
-    if (null != majcThreadMaxOpen) {
-      iops.setProperty(Property.TSERV_MAJC_THREAD_MAXOPEN.getKey(), majcThreadMaxOpen);
+    try (AccumuloClient client = getAccumuloClient()) {
+      InstanceOperations iops = client.instanceOperations();
+      if (null != scanMaxOpenFiles) {
+        iops.setProperty(Property.TSERV_SCAN_MAX_OPENFILES.getKey(), scanMaxOpenFiles);
+      }
+      if (null != majcConcurrent) {
+        iops.setProperty(Property.TSERV_MAJC_MAXCONCURRENT.getKey(), majcConcurrent);
+      }
+      if (null != majcThreadMaxOpen) {
+        iops.setProperty(Property.TSERV_MAJC_THREAD_MAXOPEN.getKey(), majcThreadMaxOpen);
+      }
     }
   }
 
@@ -91,43 +95,43 @@ public void restoreConfig() throws Exception {
 
   @Test
   public void run() throws Exception {
-    final AccumuloClient c = getAccumuloClient();
-    final String tableName = getUniqueNames(1)[0];
-    c.tableOperations().create(tableName);
-    c.tableOperations().setProperty(tableName, Property.TABLE_MAJC_RATIO.getKey(), "10");
-    c.tableOperations().addSplits(tableName,
-        TestIngest.getSplitPoints(0, NUM_TO_INGEST, NUM_TABLETS));
-
-    // the following loop should create three tablets in each map file
-    for (int i = 0; i < 3; i++) {
-      TestIngest.Opts opts = new TestIngest.Opts();
-      opts.timestamp = i;
-      opts.dataSize = 50;
-      opts.rows = NUM_TO_INGEST;
-      opts.cols = 1;
-      opts.random = i;
-      opts.setTableName(tableName);
-      opts.setClientInfo(getClientInfo());
-      TestIngest.ingest(c, opts, new BatchWriterOpts());
-
-      c.tableOperations().flush(tableName, null, null, true);
-      FunctionalTestUtils.checkRFiles(c, tableName, NUM_TABLETS, NUM_TABLETS, i + 1, i + 1);
-    }
-
-    List<Range> ranges = new ArrayList<>(NUM_TO_INGEST);
+    try (AccumuloClient c = getAccumuloClient()) {
+      final String tableName = getUniqueNames(1)[0];
+      c.tableOperations().create(tableName);
+      c.tableOperations().setProperty(tableName, Property.TABLE_MAJC_RATIO.getKey(), "10");
+      c.tableOperations().addSplits(tableName,
+          TestIngest.getSplitPoints(0, NUM_TO_INGEST, NUM_TABLETS));
+
+      // the following loop should create three tablets in each map file
+      for (int i = 0; i < 3; i++) {
+        TestIngest.Opts opts = new TestIngest.Opts();
+        opts.timestamp = i;
+        opts.dataSize = 50;
+        opts.rows = NUM_TO_INGEST;
+        opts.cols = 1;
+        opts.random = i;
+        opts.setTableName(tableName);
+        opts.setClientInfo(getClientInfo());
+        TestIngest.ingest(c, opts, new BatchWriterOpts());
+
+        c.tableOperations().flush(tableName, null, null, true);
+        FunctionalTestUtils.checkRFiles(c, tableName, NUM_TABLETS, NUM_TABLETS, i + 1, i + 1);
+      }
 
-    for (int i = 0; i < NUM_TO_INGEST; i++) {
-      ranges.add(new Range(TestIngest.generateRow(i, 0)));
-    }
+      List<Range> ranges = new ArrayList<>(NUM_TO_INGEST);
 
-    long time1 = batchScan(c, tableName, ranges, 1);
-    // run it again, now that stuff is cached on the client and sever
-    time1 = batchScan(c, tableName, ranges, 1);
-    long time2 = batchScan(c, tableName, ranges, NUM_TABLETS);
+      for (int i = 0; i < NUM_TO_INGEST; i++) {
+        ranges.add(new Range(TestIngest.generateRow(i, 0)));
+      }
 
-    System.out.printf("Single thread scan time   %6.2f %n", time1 / 1000.0);
-    System.out.printf("Multiple thread scan time %6.2f %n", time2 / 1000.0);
+      long time1 = batchScan(c, tableName, ranges, 1);
+      // run it again, now that stuff is cached on the client and sever
+      time1 = batchScan(c, tableName, ranges, 1);
+      long time2 = batchScan(c, tableName, ranges, NUM_TABLETS);
 
+      System.out.printf("Single thread scan time   %6.2f %n", time1 / 1000.0);
+      System.out.printf("Multiple thread scan time %6.2f %n", time2 / 1000.0);
+    }
   }
 
   @SuppressFBWarnings(value = "PREDICTABLE_RANDOM",
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 a2eb76e5e1..f4e501a041 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
@@ -56,43 +56,45 @@ public int defaultTimeoutSeconds() {
 
   @Test
   public void merge() throws Exception {
-    AccumuloClient c = getAccumuloClient();
-    String tableName = getUniqueNames(1)[0];
-    c.tableOperations().create(tableName);
-    c.tableOperations().addSplits(tableName, splits("a b c d e f g h i j k".split(" ")));
-    BatchWriter bw = c.createBatchWriter(tableName, null);
-    for (String row : "a b c d e f g h i j k".split(" ")) {
-      Mutation m = new Mutation(row);
-      m.put("cf", "cq", "value");
-      bw.addMutation(m);
+    try (AccumuloClient c = getAccumuloClient()) {
+      String tableName = getUniqueNames(1)[0];
+      c.tableOperations().create(tableName);
+      c.tableOperations().addSplits(tableName, splits("a b c d e f g h i j k".split(" ")));
+      BatchWriter bw = c.createBatchWriter(tableName, null);
+      for (String row : "a b c d e f g h i j k".split(" ")) {
+        Mutation m = new Mutation(row);
+        m.put("cf", "cq", "value");
+        bw.addMutation(m);
+      }
+      bw.close();
+      c.tableOperations().flush(tableName, null, null, true);
+      c.tableOperations().merge(tableName, new Text("c1"), new Text("f1"));
+      assertEquals(8, c.tableOperations().listSplits(tableName).size());
     }
-    bw.close();
-    c.tableOperations().flush(tableName, null, null, true);
-    c.tableOperations().merge(tableName, new Text("c1"), new Text("f1"));
-    assertEquals(8, c.tableOperations().listSplits(tableName).size());
   }
 
   @Test
   public void mergeSize() throws Exception {
-    AccumuloClient c = getAccumuloClient();
-    String tableName = getUniqueNames(1)[0];
-    c.tableOperations().create(tableName);
-    c.tableOperations().addSplits(tableName,
-        splits("a b c d e f g h i j k l m n o p q r s t u v w x y z".split(" ")));
-    BatchWriter bw = c.createBatchWriter(tableName, null);
-    for (String row : "c e f y".split(" ")) {
-      Mutation m = new Mutation(row);
-      m.put("cf", "cq", "mersydotesanddozeydotesanlittolamsiedives");
-      bw.addMutation(m);
+    try (AccumuloClient c = getAccumuloClient()) {
+      String tableName = getUniqueNames(1)[0];
+      c.tableOperations().create(tableName);
+      c.tableOperations().addSplits(tableName,
+          splits("a b c d e f g h i j k l m n o p q r s t u v w x y z".split(" ")));
+      BatchWriter bw = c.createBatchWriter(tableName, null);
+      for (String row : "c e f y".split(" ")) {
+        Mutation m = new Mutation(row);
+        m.put("cf", "cq", "mersydotesanddozeydotesanlittolamsiedives");
+        bw.addMutation(m);
+      }
+      bw.close();
+      c.tableOperations().flush(tableName, null, null, true);
+      Merge merge = new Merge();
+      merge.mergomatic(c, tableName, null, null, 100, false);
+      assertArrayEquals("b c d e f x y".split(" "),
+          toStrings(c.tableOperations().listSplits(tableName)));
+      merge.mergomatic(c, tableName, null, null, 100, true);
+      assertArrayEquals("c e f y".split(" "), toStrings(c.tableOperations().listSplits(tableName)));
     }
-    bw.close();
-    c.tableOperations().flush(tableName, null, null, true);
-    Merge merge = new Merge();
-    merge.mergomatic(c, tableName, null, null, 100, false);
-    assertArrayEquals("b c d e f x y".split(" "),
-        toStrings(c.tableOperations().listSplits(tableName)));
-    merge.mergomatic(c, tableName, null, null, 100, true);
-    assertArrayEquals("c e f y".split(" "), toStrings(c.tableOperations().listSplits(tableName)));
   }
 
   private String[] toStrings(Collection<Text> listSplits) {
@@ -111,38 +113,39 @@ public void mergeSize() throws Exception {
   @Test
   public void mergeTest() throws Exception {
     int tc = 0;
-    AccumuloClient c = getAccumuloClient();
-    String tableName = getUniqueNames(1)[0];
-    runMergeTest(c, tableName + tc++, ns(), ns(), ns("l", "m", "n"), ns(null, "l"), ns(null, "n"));
-
-    runMergeTest(c, tableName + tc++, ns("m"), ns(), ns("l", "m", "n"), ns(null, "l"),
-        ns(null, "n"));
-    runMergeTest(c, tableName + tc++, ns("m"), ns("m"), ns("l", "m", "n"), ns("m", "n"),
-        ns(null, "z"));
-    runMergeTest(c, tableName + tc++, ns("m"), ns("m"), ns("l", "m", "n"), ns(null, "b"),
-        ns("l", "m"));
-
-    runMergeTest(c, tableName + tc++, ns("b", "m", "r"), ns(),
-        ns("a", "b", "c", "l", "m", "n", "q", "r", "s"), ns(null, "a"), ns(null, "s"));
-    runMergeTest(c, tableName + tc++, ns("b", "m", "r"), ns("m", "r"),
-        ns("a", "b", "c", "l", "m", "n", "q", "r", "s"), ns(null, "a"), ns("c", "m"));
-    runMergeTest(c, tableName + tc++, ns("b", "m", "r"), ns("r"),
-        ns("a", "b", "c", "l", "m", "n", "q", "r", "s"), ns(null, "a"), ns("n", "r"));
-    runMergeTest(c, tableName + tc++, ns("b", "m", "r"), ns("b"),
-        ns("a", "b", "c", "l", "m", "n", "q", "r", "s"), ns("b", "c"), ns(null, "s"));
-    runMergeTest(c, tableName + tc++, ns("b", "m", "r"), ns("b", "m"),
-        ns("a", "b", "c", "l", "m", "n", "q", "r", "s"), ns("m", "n"), ns(null, "s"));
-    runMergeTest(c, tableName + tc++, ns("b", "m", "r"), ns("b", "r"),
-        ns("a", "b", "c", "l", "m", "n", "q", "r", "s"), ns("b", "c"), ns("q", "r"));
-    runMergeTest(c, tableName + tc++, ns("b", "m", "r"), ns("b", "m", "r"),
-        ns("a", "b", "c", "l", "m", "n", "q", "r", "s"), ns(null, "a"), ns("aa", "b"));
-    runMergeTest(c, tableName + tc++, ns("b", "m", "r"), ns("b", "m", "r"),
-        ns("a", "b", "c", "l", "m", "n", "q", "r", "s"), ns("r", "s"), ns(null, "z"));
-    runMergeTest(c, tableName + tc++, ns("b", "m", "r"), ns("b", "m", "r"),
-        ns("a", "b", "c", "l", "m", "n", "q", "r", "s"), ns("b", "c"), ns("l", "m"));
-    runMergeTest(c, tableName + tc++, ns("b", "m", "r"), ns("b", "m", "r"),
-        ns("a", "b", "c", "l", "m", "n", "q", "r", "s"), ns("m", "n"), ns("q", "r"));
-
+    try (AccumuloClient c = getAccumuloClient()) {
+      String tableName = getUniqueNames(1)[0];
+      runMergeTest(c, tableName + tc++, ns(), ns(), ns("l", "m", "n"), ns(null, "l"),
+          ns(null, "n"));
+
+      runMergeTest(c, tableName + tc++, ns("m"), ns(), ns("l", "m", "n"), ns(null, "l"),
+          ns(null, "n"));
+      runMergeTest(c, tableName + tc++, ns("m"), ns("m"), ns("l", "m", "n"), ns("m", "n"),
+          ns(null, "z"));
+      runMergeTest(c, tableName + tc++, ns("m"), ns("m"), ns("l", "m", "n"), ns(null, "b"),
+          ns("l", "m"));
+
+      runMergeTest(c, tableName + tc++, ns("b", "m", "r"), ns(),
+          ns("a", "b", "c", "l", "m", "n", "q", "r", "s"), ns(null, "a"), ns(null, "s"));
+      runMergeTest(c, tableName + tc++, ns("b", "m", "r"), ns("m", "r"),
+          ns("a", "b", "c", "l", "m", "n", "q", "r", "s"), ns(null, "a"), ns("c", "m"));
+      runMergeTest(c, tableName + tc++, ns("b", "m", "r"), ns("r"),
+          ns("a", "b", "c", "l", "m", "n", "q", "r", "s"), ns(null, "a"), ns("n", "r"));
+      runMergeTest(c, tableName + tc++, ns("b", "m", "r"), ns("b"),
+          ns("a", "b", "c", "l", "m", "n", "q", "r", "s"), ns("b", "c"), ns(null, "s"));
+      runMergeTest(c, tableName + tc++, ns("b", "m", "r"), ns("b", "m"),
+          ns("a", "b", "c", "l", "m", "n", "q", "r", "s"), ns("m", "n"), ns(null, "s"));
+      runMergeTest(c, tableName + tc++, ns("b", "m", "r"), ns("b", "r"),
+          ns("a", "b", "c", "l", "m", "n", "q", "r", "s"), ns("b", "c"), ns("q", "r"));
+      runMergeTest(c, tableName + tc++, ns("b", "m", "r"), ns("b", "m", "r"),
+          ns("a", "b", "c", "l", "m", "n", "q", "r", "s"), ns(null, "a"), ns("aa", "b"));
+      runMergeTest(c, tableName + tc++, ns("b", "m", "r"), ns("b", "m", "r"),
+          ns("a", "b", "c", "l", "m", "n", "q", "r", "s"), ns("r", "s"), ns(null, "z"));
+      runMergeTest(c, tableName + tc++, ns("b", "m", "r"), ns("b", "m", "r"),
+          ns("a", "b", "c", "l", "m", "n", "q", "r", "s"), ns("b", "c"), ns("l", "m"));
+      runMergeTest(c, tableName + tc++, ns("b", "m", "r"), ns("b", "m", "r"),
+          ns("a", "b", "c", "l", "m", "n", "q", "r", "s"), ns("m", "n"), ns("q", "r"));
+    }
   }
 
   private void runMergeTest(AccumuloClient c, String table, String[] splits,
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 9dd7c7959a..8882ea623d 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
@@ -61,92 +61,95 @@ public int defaultTimeoutSeconds() {
 
   @Test
   public void testFlushAndCompact() throws Exception {
-    AccumuloClient c = getAccumuloClient();
-    String tableNames[] = getUniqueNames(2);
+    try (AccumuloClient c = getAccumuloClient()) {
+      String tableNames[] = getUniqueNames(2);
 
-    // create a table to write some data to metadata table
-    c.tableOperations().create(tableNames[0]);
+      // create a table to write some data to metadata table
+      c.tableOperations().create(tableNames[0]);
 
-    try (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
-      assertTrue(files2.size() > 0);
-      assertNotEquals(files1, files2);
+        // flush of metadata table should change file set in root table
+        assertTrue(files2.size() > 0);
+        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
-      assertNotEquals(files2, files3);
+        // compaction of metadata table should change file set in root table
+        assertNotEquals(files2, files3);
+      }
     }
   }
 
   @Test
   public void mergeMeta() throws Exception {
-    AccumuloClient c = getAccumuloClient();
-    String[] names = getUniqueNames(5);
-    SortedSet<Text> splits = new TreeSet<>();
-    for (String id : "1 2 3 4 5".split(" ")) {
-      splits.add(new Text(id));
-    }
-    c.tableOperations().addSplits(MetadataTable.NAME, splits);
-    for (String tableName : names) {
-      c.tableOperations().create(tableName);
-    }
-    c.tableOperations().merge(MetadataTable.NAME, null, null);
-    try (Scanner s = c.createScanner(RootTable.NAME, Authorizations.EMPTY)) {
-      s.setRange(MetadataSchema.DeletesSection.getRange());
-      while (Iterators.size(s.iterator()) == 0) {
-        sleepUninterruptibly(100, TimeUnit.MILLISECONDS);
+    try (AccumuloClient c = getAccumuloClient()) {
+      String[] names = getUniqueNames(5);
+      SortedSet<Text> splits = new TreeSet<>();
+      for (String id : "1 2 3 4 5".split(" ")) {
+        splits.add(new Text(id));
+      }
+      c.tableOperations().addSplits(MetadataTable.NAME, splits);
+      for (String tableName : names) {
+        c.tableOperations().create(tableName);
+      }
+      c.tableOperations().merge(MetadataTable.NAME, null, null);
+      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
   public void batchScanTest() throws Exception {
-    AccumuloClient c = getAccumuloClient();
-    String tableName = getUniqueNames(1)[0];
-    c.tableOperations().create(tableName);
-
-    // batch scan regular metadata table
-    int count = 0;
-    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++;
-      }
-    }
+    try (AccumuloClient c = getAccumuloClient()) {
+      String tableName = getUniqueNames(1)[0];
+      c.tableOperations().create(tableName);
 
-    assertTrue(count > 0);
+      // batch scan regular metadata table
+      int count = 0;
+      try (BatchScanner s = c.createBatchScanner(MetadataTable.NAME, Authorizations.EMPTY, 1)) {
 
-    // batch scan root metadata table
-    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++;
+        s.setRanges(Collections.singleton(new Range()));
+        for (Entry<Key,Value> e : s) {
+          if (e != null)
+            count++;
+        }
       }
+
       assertTrue(count > 0);
+
+      // batch scan root metadata table
+      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);
+      }
     }
   }
 
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/MetadataMaxFilesIT.java b/test/src/main/java/org/apache/accumulo/test/functional/MetadataMaxFilesIT.java
index 7e23684b07..492fd79793 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/MetadataMaxFilesIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/MetadataMaxFilesIT.java
@@ -60,59 +60,60 @@ protected int defaultTimeoutSeconds() {
 
   @Test
   public void test() throws Exception {
-    AccumuloClient c = getClient();
-    SortedSet<Text> splits = new TreeSet<>();
-    for (int i = 0; i < 1000; i++) {
-      splits.add(new Text(String.format("%03d", i)));
-    }
-    c.tableOperations().setProperty(MetadataTable.NAME, Property.TABLE_SPLIT_THRESHOLD.getKey(),
-        "10000");
-    // propagation time
-    sleepUninterruptibly(5, TimeUnit.SECONDS);
-    for (int i = 0; i < 5; i++) {
-      String tableName = "table" + i;
-      log.info("Creating {}", tableName);
-      c.tableOperations().create(tableName);
-      log.info("adding splits");
-      c.tableOperations().addSplits(tableName, splits);
-      log.info("flushing");
-      c.tableOperations().flush(MetadataTable.NAME, null, null, true);
-      c.tableOperations().flush(RootTable.NAME, null, null, true);
-    }
-    log.info("shutting down");
-    assertEquals(0, cluster.exec(Admin.class, "stopAll").waitFor());
-    cluster.stop();
-    log.info("starting up");
-    cluster.start();
-
-    while (true) {
-      MasterMonitorInfo stats = null;
-      Client client = null;
-      try {
-        ClientContext context = getClientContext();
-        client = MasterClient.getConnectionWithRetry(context);
-        log.info("Fetching stats");
-        stats = client.getMasterStats(Tracer.traceInfo(), context.rpcCreds());
-      } catch (ThriftNotActiveServiceException e) {
-        // Let it loop, fetching a new location
-        sleepUninterruptibly(100, TimeUnit.MILLISECONDS);
-        continue;
-      } finally {
-        if (client != null)
-          MasterClient.close(client);
+    try (AccumuloClient c = getClient()) {
+      SortedSet<Text> splits = new TreeSet<>();
+      for (int i = 0; i < 1000; i++) {
+        splits.add(new Text(String.format("%03d", i)));
       }
-      int tablets = 0;
-      for (TabletServerStatus tserver : stats.tServerInfo) {
-        for (Entry<String,TableInfo> entry : tserver.tableMap.entrySet()) {
-          if (entry.getKey().startsWith("!") || entry.getKey().startsWith("+"))
-            continue;
-          tablets += entry.getValue().onlineTablets;
+      c.tableOperations().setProperty(MetadataTable.NAME, Property.TABLE_SPLIT_THRESHOLD.getKey(),
+          "10000");
+      // propagation time
+      sleepUninterruptibly(5, TimeUnit.SECONDS);
+      for (int i = 0; i < 5; i++) {
+        String tableName = "table" + i;
+        log.info("Creating {}", tableName);
+        c.tableOperations().create(tableName);
+        log.info("adding splits");
+        c.tableOperations().addSplits(tableName, splits);
+        log.info("flushing");
+        c.tableOperations().flush(MetadataTable.NAME, null, null, true);
+        c.tableOperations().flush(RootTable.NAME, null, null, true);
+      }
+      log.info("shutting down");
+      assertEquals(0, cluster.exec(Admin.class, "stopAll").waitFor());
+      cluster.stop();
+      log.info("starting up");
+      cluster.start();
+
+      while (true) {
+        MasterMonitorInfo stats = null;
+        Client client = null;
+        try {
+          ClientContext context = getClientContext();
+          client = MasterClient.getConnectionWithRetry(context);
+          log.info("Fetching stats");
+          stats = client.getMasterStats(Tracer.traceInfo(), context.rpcCreds());
+        } catch (ThriftNotActiveServiceException e) {
+          // Let it loop, fetching a new location
+          sleepUninterruptibly(100, TimeUnit.MILLISECONDS);
+          continue;
+        } finally {
+          if (client != null)
+            MasterClient.close(client);
+        }
+        int tablets = 0;
+        for (TabletServerStatus tserver : stats.tServerInfo) {
+          for (Entry<String,TableInfo> entry : tserver.tableMap.entrySet()) {
+            if (entry.getKey().startsWith("!") || entry.getKey().startsWith("+"))
+              continue;
+            tablets += entry.getValue().onlineTablets;
+          }
         }
+        log.info("Online tablets " + tablets);
+        if (tablets == 5005)
+          break;
+        sleepUninterruptibly(1, TimeUnit.SECONDS);
       }
-      log.info("Online tablets " + tablets);
-      if (tablets == 5005)
-        break;
-      sleepUninterruptibly(1, TimeUnit.SECONDS);
     }
   }
 }
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/MetadataSplitIT.java b/test/src/main/java/org/apache/accumulo/test/functional/MetadataSplitIT.java
index 3a54181769..c75f074bd1 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/MetadataSplitIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/MetadataSplitIT.java
@@ -44,15 +44,16 @@ protected int defaultTimeoutSeconds() {
 
   @Test
   public void test() throws Exception {
-    AccumuloClient c = getClient();
-    assertEquals(1, c.tableOperations().listSplits(MetadataTable.NAME).size());
-    c.tableOperations().setProperty(MetadataTable.NAME, Property.TABLE_SPLIT_THRESHOLD.getKey(),
-        "500");
-    for (int i = 0; i < 10; i++) {
-      c.tableOperations().create("table" + i);
-      c.tableOperations().flush(MetadataTable.NAME, null, null, true);
+    try (AccumuloClient c = getClient()) {

  (This diff was longer than 20,000 lines, and has been truncated...)


 

----------------------------------------------------------------
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