@Test(expected = MessageDeliveryException.class) public void invokePoxSourceTimeout() throws Exception { gateway.setRequestTimeout(10); gateway.setReplyTimeout(10); when(requestChannel.send(isA(Message.class), anyLong())).thenReturn(false); when(request.getPayloadSource()).thenReturn(payloadSource); gateway.invoke(context); }
@Test public void invokePoxSourceWithReply() throws Exception { when(requestChannel.send(isA(Message.class), eq(1000L))).thenAnswer(withReplyTo(replyChannel)); when(request.getPayloadSource()).thenReturn(payloadSource); gateway.start(); gateway.invoke(context); verify(requestChannel).send(messageWithPayload(payloadSource), eq(1000L)); assertTrue(output.toString().endsWith(input)); }