@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 decodeDelegatesCall() {
        final Map<String, Object> ret = ImmutableMap.of("message", "abcdef");

        codec = Mockito.spy(new AbstractCodec() {
            @Override
            public void decode(final ByteBuffer buffer, final Consumer<Map<String, Object>> eventConsumer) {
                eventConsumer.accept(ret);
            }
        });

        final JavaCodecDelegator codecDelegator = constructCodecDelegator();

        final ByteBuffer buf = ByteBuffer.wrap(new byte[] {1, 2, 3});
        @SuppressWarnings("unchecked")
        final Consumer<Map<String, Object>> consumer = (Consumer<Map<String, Object>>) Mockito.mock(Consumer.class);

        codecDelegator.decode(buf, consumer);

        Mockito.verify(codec, Mockito.times(1)).decode(Mockito.eq(buf), Mockito.any());
        Mockito.verify(consumer, Mockito.times(1)).accept(ret);
    }