@@ -60,7 +60,7 @@ public void verifySendMulticast(MulticastCondition multicastCondition) throws Ex
6060 }
6161 final int testPort = socket .getLocalPort ();
6262 final String multicastAddress = multicastCondition .getGroup ();
63- final String payload = "foo " ;
63+ final String payload = "test " ;
6464 final CountDownLatch listening = new CountDownLatch (2 );
6565 final CountDownLatch received = new CountDownLatch (2 );
6666 Runnable catcher = () -> {
@@ -90,7 +90,7 @@ public void verifySendMulticast(MulticastCondition multicastCondition) throws Ex
9090 Executor executor = new SimpleAsyncTaskExecutor ("verifySendMulticast-" );
9191 executor .execute (catcher );
9292 executor .execute (catcher );
93- assertThat (listening .await (10000 , TimeUnit .MILLISECONDS )).isTrue ();
93+ assertThat (listening .await (20 , TimeUnit .SECONDS )).isTrue ();
9494 MulticastSendingMessageHandler handler = new MulticastSendingMessageHandler (multicastAddress , testPort );
9595 handler .setBeanFactory (mock (BeanFactory .class ));
9696 NetworkInterface nic = multicastCondition .getNic ();
@@ -113,26 +113,19 @@ public void verifySendMulticast(MulticastCondition multicastCondition) throws Ex
113113 }
114114 handler .afterPropertiesSet ();
115115 handler .handleMessage (MessageBuilder .withPayload (payload ).build ());
116- assertThat (received .await (10000 , TimeUnit .MILLISECONDS )).isTrue ();
116+ assertThat (received .await (20000 , TimeUnit .MILLISECONDS )).isTrue ();
117117 handler .stop ();
118118 socket .close ();
119119 }
120120
121121 @ Test
122122 public void verifySendMulticastWithAcks (MulticastCondition multicastCondition ) throws Exception {
123-
124- MulticastSocket socket ;
125- try {
126- socket = new MulticastSocket ();
127- }
128- catch (Exception e ) {
129- return ;
130- }
123+ MulticastSocket socket = new MulticastSocket ();
131124 final int testPort = socket .getLocalPort ();
132125 final AtomicInteger ackPort = new AtomicInteger ();
133126
134127 final String multicastAddress = multicastCondition .getGroup ();
135- final String payload = "foobar " ;
128+ final String payload = "test_test " ;
136129 final CountDownLatch listening = new CountDownLatch (2 );
137130 final CountDownLatch ackListening = new CountDownLatch (1 );
138131 final CountDownLatch ackSent = new CountDownLatch (2 );
@@ -147,14 +140,14 @@ public void verifySendMulticastWithAcks(MulticastCondition multicastCondition) t
147140 InetAddress group = InetAddress .getByName (multicastAddress );
148141 socket1 .joinGroup (new InetSocketAddress (group , 0 ), null );
149142 listening .countDown ();
150- assertThat (ackListening .await (10 , TimeUnit .SECONDS )).isTrue ();
143+ assertThat (ackListening .await (20 , TimeUnit .SECONDS )).isTrue ();
151144 socket1 .receive (receivedPacket );
152145 socket1 .close ();
153146 byte [] src = receivedPacket .getData ();
154147 int length = receivedPacket .getLength ();
155148 int offset = receivedPacket .getOffset ();
156- byte [] dest = new byte [6 ];
157- System .arraycopy (src , offset + length - 6 , dest , 0 , 6 );
149+ byte [] dest = new byte [9 ];
150+ System .arraycopy (src , offset + length - 9 , dest , 0 , 9 );
158151 assertThat (new String (dest )).isEqualTo (payload );
159152 DatagramPacketMessageMapper mapper = new DatagramPacketMessageMapper ();
160153 mapper .setAcknowledge (true );
@@ -191,9 +184,9 @@ public void verifySendMulticastWithAcks(MulticastCondition multicastCondition) t
191184 Executor executor = new SimpleAsyncTaskExecutor ("verifySendMulticastWithAcks-" );
192185 executor .execute (catcher );
193186 executor .execute (catcher );
194- assertThat (listening .await (10000 , TimeUnit .MILLISECONDS )).isTrue ();
187+ assertThat (listening .await (20000 , TimeUnit .MILLISECONDS )).isTrue ();
195188 MulticastSendingMessageHandler handler =
196- new MulticastSendingMessageHandler (multicastAddress , testPort , true , true , "localhost" , 0 , 10000 );
189+ new MulticastSendingMessageHandler (multicastAddress , testPort , true , true , "localhost" , 0 , 20000 );
197190
198191 if (nic != null ) {
199192 String hostName = null ;
@@ -220,7 +213,7 @@ public void verifySendMulticastWithAcks(MulticastCondition multicastCondition) t
220213 ackPort .set (handler .getAckPort ());
221214 ackListening .countDown ();
222215 handler .handleMessage (MessageBuilder .withPayload (payload ).build ());
223- assertThat (ackSent .await (10000 , TimeUnit .MILLISECONDS )).isTrue ();
216+ assertThat (ackSent .await (20000 , TimeUnit .MILLISECONDS )).isTrue ();
224217 handler .stop ();
225218 socket .close ();
226219 }
0 commit comments