@Test
  public void compatibleConversionService() throws Exception {
    HttpRequestExecutingMessageHandler handler =
        new HttpRequestExecutingMessageHandler("http://www.springsource.org/spring-integration");
    ConfigurableListableBeanFactory bf = new DefaultListableBeanFactory();
    ProxyFactory pf =
        new ProxyFactory(new Class<?>[] {ConversionService.class, ConverterRegistry.class});
    final AtomicInteger converterCount = new AtomicInteger();
    pf.addAdvice(
        new MethodInterceptor() {

          public Object invoke(MethodInvocation invocation) throws Throwable {
            if (invocation.getMethod().getName().equals("addConverter")) {
              converterCount.incrementAndGet();
            }
            return null;
          }
        });
    ConversionService mockConversionService = (ConversionService) pf.getProxy();
    bf.registerSingleton("integrationConversionService", mockConversionService);
    handler.setBeanFactory(bf);
    handler.afterPropertiesSet();
    assertEquals(2, converterCount.get());
    assertSame(mockConversionService, TestUtils.getPropertyValue(handler, "conversionService"));
  }
 @Test
 public void nonCompatibleConversionService() throws Exception {
   HttpRequestExecutingMessageHandler handler =
       new HttpRequestExecutingMessageHandler("http://www.springsource.org/spring-integration");
   ConfigurableListableBeanFactory bf = new DefaultListableBeanFactory();
   ConversionService mockConversionService = mock(ConversionService.class);
   bf.registerSingleton("integrationConversionService", mockConversionService);
   handler.setBeanFactory(bf);
   try {
     handler.afterPropertiesSet();
   } catch (Exception e) {
     fail("Unexpected exception during initialization " + e.getMessage());
   }
   assertSame(mockConversionService, TestUtils.getPropertyValue(handler, "conversionService"));
 }
 private void setBeanFactory(HttpRequestExecutingMessageHandler handler) {
   handler.setBeanFactory(mock(BeanFactory.class));
 }