@Before public void setup() { gateway.setRequestChannel(requestChannel); gateway.setReplyChannel(replyChannel); gateway.setBeanFactory(mock(BeanFactory.class)); when(context.getResponse()).thenReturn(response); when(response.getPayloadResult()).thenReturn(payloadResult); when(context.getRequest()).thenReturn(request); }
@Override public boolean handleResponse(MessageContext messageContext, Object endpoint) throws Exception { System.out.println("test response logging from interceptor: "); ByteArrayOutputStream bos = new ByteArrayOutputStream(); messageContext.getRequest().writeTo(bos); System.out.println(bos.toString("UTF-8")); dbService.saveRequestToDb(bos.toString("UTF-8")); return true; }