@Test public void shouldReadFreeMemory() throws Exception { target.event( new EventScheduler() { @Override public void schedule(long delay, TimeUnit timeUnit) { assertEquals(100, timeUnit.toMillis(delay)); schedules++; } }, new EventAdder() { @Override public void add(byte[] event) { assertEquals(2, event.length); adds++; } } ); assertEquals(1, schedules); assertEquals(1, adds); }
@Override public void event(EventScheduler scheduler, EventAdder adder) { long freeMemory = Runtime.getRuntime().freeMemory(); adder.add(Util.twoLeastSignificantBytes(freeMemory)); scheduler.schedule(100, TimeUnit.MILLISECONDS); }
FreeMemoryEntropySource implements EntropySource { @Override public void event(EventScheduler scheduler, EventAdder adder) { long freeMemory = Runtime.getRuntime().freeMemory(); adder.add(Util.twoLeastSignificantBytes(freeMemory)); scheduler.schedule(100, TimeUnit.MILLISECONDS); } }
FreeMemoryEntropySource implements EntropySource { @Override public void event(EventScheduler scheduler, EventAdder adder) { long freeMemory = Runtime.getRuntime().freeMemory(); adder.add(Util.twoLeastSignificantBytes(freeMemory)); scheduler.schedule(100, TimeUnit.MILLISECONDS); }  }
FreeMemoryEntropySource implements EntropySource { @Override public void event(EventScheduler scheduler, EventAdder adder) { long freeMemory = Runtime.getRuntime().freeMemory(); adder.add(Util.twoLeastSignificantBytes(freeMemory)); scheduler.schedule(100, TimeUnit.MILLISECONDS); }  @Override void event(EventScheduler scheduler, EventAdder adder); }
FreeMemoryEntropySource implements EntropySource { @Override public void event(EventScheduler scheduler, EventAdder adder) { long freeMemory = Runtime.getRuntime().freeMemory(); adder.add(Util.twoLeastSignificantBytes(freeMemory)); scheduler.schedule(100, TimeUnit.MILLISECONDS); }  @Override void event(EventScheduler scheduler, EventAdder adder);  }