public void registerWithStream(final long workerId, final List<String> storageTierAliases,
      final Map<String, Long> totalBytesOnTiers, final Map<String, Long> usedBytesOnTiers,
      final Map<BlockStoreLocation, List<Long>> currentBlocksOnLocation,
      final Map<String, List<String>> lostStorage,
      final List<ConfigProperty> configList) throws IOException {
    AtomicReference<IOException> ioe = new AtomicReference<>();
    // The retry logic only takes care of connection issues.
    // If the master side sends back an error,
    // no retry will be attempted and the worker will quit.
    retryRPC(() -> {
      // The gRPC stream lifecycle is managed internal to the RegisterStreamer
      // When an exception is thrown, the stream has been closed and error propagated
      // to the other side, so no extra handling is required here.
      RegisterStreamer stream = new RegisterStreamer(mAsyncClient,
          workerId, storageTierAliases, totalBytesOnTiers, usedBytesOnTiers,
          currentBlocksOnLocation, lostStorage, configList);
      try {
        stream.registerWithMaster();
      } catch (IOException e) {
        ioe.set(e);
      } catch (InterruptedException e) {
        ioe.set(new IOException(e));
      }
      return null;
    }, LOG, "Register", "workerId=%d", workerId);

    if (ioe.get() != null) {
      throw ioe.get();
    }
  }
@Test
  public void registerWithStream() throws Exception {
    register(true);
  }