### Question:
TransportExecutors { public static void loop(Executor executor, Supplier<Boolean> task) { Runnable command = new Runnable() { @Override public void run() { if (task.get()) { try { executor.execute(this); } catch (RejectedExecutionException e) { } catch (Exception e) { LOGGER.error(e.toString()); } } } }; executor.execute(command); }  static Executor newWorker(String name); static void loop(Executor executor, Supplier<Boolean> task); static void shutdown(Executor executor);  }### Answer:
@Test public void should_loop_commands_until_false_is_returned() { AtomicInteger i = new AtomicInteger(5); TransportExecutors.loop(Runnable::run, () -> i.decrementAndGet() > 0); assertEquals(0, i.get()); }