@Override
    public void decode(final ByteBuffer buffer, final Consumer<Map<String, Object>> eventConsumer) {
        decodeMetricIn.increment();

        decodeMetricTime.time(() -> codec.decode(buffer, (event) -> {
            decodeMetricOut.increment();
            eventConsumer.accept(event);
        }));
    }
@Test
    public void decodeIncrementsEventCount() {
        codec = new AbstractCodec() {
            @Override
            public void decode(final ByteBuffer buffer, final Consumer<Map<String, Object>> eventConsumer) {
                eventConsumer.accept(ImmutableMap.of("message", "abcdef"));
                eventConsumer.accept(ImmutableMap.of("message", "1234567"));
            }
        };

        final JavaCodecDelegator codecDelegator = constructCodecDelegator();

        codecDelegator.decode(ByteBuffer.wrap(new byte[] {1, 2, 3}), (e) -> {});

        assertEquals(1, getMetricLongValue("decode", "writes_in"));
        assertEquals(2, getMetricLongValue("decode", "out"));
    }