public void onMessage(Message message) {
        LOG.trace("Invoking MessageEndpoint.onMethod()");
        state.onMessage(this, message);
    }
@Test(timeout = 60000)
    public void testOnMessageFailure() throws Exception {
        setupBeforeDeliverySuccessful();

        context.checking(new Expectations() {{
            oneOf (mockEndpointAndListener).onMessage(with(same(stubMessage)));
            will(throwException(new RuntimeException()));
        }});

        setupAfterDeliverySuccessful();

        doBeforeDeliveryExpectSuccess();
        try {
            endpointProxy.onMessage(stubMessage);
            fail("An exception should have been thrown");
        } catch (Exception e) {
            assertTrue(true);
        }
        doAfterDeliveryExpectSuccess();

    }