Java UnicastReceivingChannelAdapter Example

说明

java unicastreceivingchanneladapter示例是从最受好评的开源项目中提取的实现代码,你可以参考下面示例的使用方式。

编程语言: Java

命名空间/包名称: org.springframework.integration.ip.udp

示例#1
文件: ParserUnitTests.java项目: spring-projects/spring-integration

 @Test
 public void testInUdp() {
   DirectFieldAccessor dfa = new DirectFieldAccessor(udpIn);
   assertTrue(udpIn.getPort() >= 5000);
   assertEquals(27, dfa.getPropertyValue("poolSize"));
   assertEquals(29, dfa.getPropertyValue("receiveBufferSize"));
   assertEquals(30, dfa.getPropertyValue("soReceiveBufferSize"));
   assertEquals(31, dfa.getPropertyValue("soSendBufferSize"));
   assertEquals(32, dfa.getPropertyValue("soTimeout"));
   assertEquals("testInUdp", udpIn.getComponentName());
   assertEquals("ip:udp-inbound-channel-adapter", udpIn.getComponentType());
   assertEquals("127.0.0.1", dfa.getPropertyValue("localAddress"));
   assertSame(taskExecutor, dfa.getPropertyValue("taskExecutor"));
   assertEquals(errorChannel, dfa.getPropertyValue("errorChannel"));
   DatagramPacketMessageMapper mapper =
       (DatagramPacketMessageMapper) dfa.getPropertyValue("mapper");
   DirectFieldAccessor mapperAccessor = new DirectFieldAccessor(mapper);
   assertFalse((Boolean) mapperAccessor.getPropertyValue("lookupHost"));
   assertFalse(TestUtils.getPropertyValue(udpIn, "autoStartup", Boolean.class));
   assertEquals(1234, dfa.getPropertyValue("phase"));
 }

展开阅读全文