RemoteBaggageRestrictionManager implements BaggageRestrictionManager { void updateBaggageRestrictions() { List<BaggageRestrictionResponse> response; try { response = proxy.getBaggageRestrictions(serviceName); if (response == null || response.isEmpty()) { throw new BaggageRestrictionManagerException("empty restrictions response"); } } catch (BaggageRestrictionManagerException e) { metrics.baggageRestrictionsUpdateFailure.inc(1); return; } updateBaggageRestrictions(response); metrics.baggageRestrictionsUpdateSuccess.inc(1); } protected  RemoteBaggageRestrictionManager(
      String serviceName,
      BaggageRestrictionManagerProxy proxy,
      Metrics metrics,
      boolean denyBaggageOnInitializationFailure,
      int refreshIntervalMs,
      int initialDelayMs
  ); boolean isReady(); void close(); @Override Restriction getRestriction(String service, String key);  }
@Test public void testUpdateBaggageRestrictions() throws Exception { when(baggageRestrictionProxy.getBaggageRestrictions(SERVICE_NAME)) .thenReturn(new ArrayList<>(Arrays.asList(RESTRICTION))); undertest = new RemoteBaggageRestrictionManager.Builder(SERVICE_NAME) .withProxy(baggageRestrictionProxy) .withMetrics(metrics) .withDenyBaggageInitializationFailure(false) .build(); undertest.updateBaggageRestrictions(); assertEquals(Restriction.of(true, MAX_VALUE_LENGTH), undertest.getRestriction(SERVICE_NAME, BAGGAGE_KEY)); assertFalse(undertest.getRestriction(SERVICE_NAME, "bad-key").isKeyAllowed()); assertTrue( metricsFactory.getCounter("jaeger_tracer_baggage_restrictions_updates.result=ok", Collections.emptyMap()) > 0L); }