@Override
    protected void doProcess(Exchange exchange, MetricsEndpoint endpoint, MetricRegistry registry, String metricsName)
            throws Exception {
        Message in = exchange.getIn();
        MetricsTimerAction action = endpoint.getAction();
        MetricsTimerAction finalAction = in.getHeader(HEADER_TIMER_ACTION, action, MetricsTimerAction.class);
        if (finalAction == MetricsTimerAction.start) {
            handleStart(exchange, registry, metricsName);
        } else if (finalAction == MetricsTimerAction.stop) {
            handleStop(exchange, metricsName);
        } else {
            LOG.warn("No action provided for timer \"{}\"", metricsName);
        }
    }
@Test
    public void testProcessStop() throws Exception {
        when(endpoint.getAction()).thenReturn(MetricsTimerAction.stop);
        when(in.getHeader(HEADER_TIMER_ACTION, MetricsTimerAction.stop, MetricsTimerAction.class))
                .thenReturn(MetricsTimerAction.stop);
        when(exchange.getProperty(PROPERTY_NAME, Timer.Context.class)).thenReturn(context);
        producer.doProcess(exchange, endpoint, registry, METRICS_NAME);
        inOrder.verify(exchange, times(1)).getIn();
        inOrder.verify(endpoint, times(1)).getAction();
        inOrder.verify(in, times(1)).getHeader(HEADER_TIMER_ACTION, MetricsTimerAction.stop, MetricsTimerAction.class);
        inOrder.verify(exchange, times(1)).getProperty(PROPERTY_NAME, Timer.Context.class);
        inOrder.verify(context, times(1)).stop();
        inOrder.verify(exchange, times(1)).removeProperty(PROPERTY_NAME);
        inOrder.verifyNoMoreInteractions();
    }