RpcTimeoutConnection(Configuration conf, boolean managed, ExecutorService pool, User user)
     throws IOException {
   super(conf, managed);
   // Mock up my stub so an exists call -- which turns into a get -- throws an exception
   this.stub = Mockito.mock(ClientService.BlockingInterface.class);
   try {
     Mockito.when(
             stub.get((RpcController) Mockito.any(), (ClientProtos.GetRequest) Mockito.any()))
         .thenThrow(new ServiceException(new RegionServerStoppedException("From Mockito")));
   } catch (ServiceException e) {
     throw new IOException(e);
   }
 }
 RegionServerStoppedOnScannerOpenConnection(
     Configuration conf, boolean managed, ExecutorService pool, User user) throws IOException {
   super(conf, managed);
   // Mock up my stub so open scanner returns a scanner id and then on next, we throw
   // exceptions for three times and then after that, we return no more to scan.
   this.stub = Mockito.mock(ClientService.BlockingInterface.class);
   long sid = 12345L;
   try {
     Mockito.when(
             stub.scan((RpcController) Mockito.any(), (ClientProtos.ScanRequest) Mockito.any()))
         .thenReturn(ClientProtos.ScanResponse.newBuilder().setScannerId(sid).build())
         .thenThrow(new ServiceException(new RegionServerStoppedException("From Mockito")))
         .thenReturn(
             ClientProtos.ScanResponse.newBuilder()
                 .setScannerId(sid)
                 .setMoreResults(false)
                 .build());
   } catch (ServiceException e) {
     throw new IOException(e);
   }
 }