@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();
}