@@ -53,6 +53,8 @@ public class BroadcasterTest extends JerseyTest {
5353 static final CountDownLatch txLatch = new CountDownLatch (4 );
5454 private static boolean isSingleton = false ;
5555
56+ private static int LATCH_WAIT_TIMEOUT = 16000 ; //timeout to be waited for asynchronous events to be completed
57+
5658 @ Path ("sse" )
5759 @ Singleton
5860 public static class SseResource {
@@ -142,14 +144,14 @@ public void test() throws InterruptedException {
142144 target ().path ("sse/push/secondBroadcast" ).request ().get (String .class );
143145
144146 Assert .assertTrue ("Waiting for resultsA1 to be complete failed." ,
145- a1Latch .await (3000 , TimeUnit .MILLISECONDS ));
147+ a1Latch .await (LATCH_WAIT_TIMEOUT , TimeUnit .MILLISECONDS ));
146148 Assert .assertTrue ("Waiting for resultsA2 to be complete failed." ,
147- a2Latch .await (3000 , TimeUnit .MILLISECONDS ));
149+ a2Latch .await (LATCH_WAIT_TIMEOUT , TimeUnit .MILLISECONDS ));
148150
149151 Assert .assertTrue ("Waiting for resultsB1 to be complete failed." ,
150- b1Latch .await (3000 , TimeUnit .MILLISECONDS ));
152+ b1Latch .await (LATCH_WAIT_TIMEOUT , TimeUnit .MILLISECONDS ));
151153 Assert .assertTrue ("Waiting for resultsB2 to be complete failed." ,
152- b2Latch .await (3000 , TimeUnit .MILLISECONDS ));
154+ b2Latch .await (LATCH_WAIT_TIMEOUT , TimeUnit .MILLISECONDS ));
153155
154156 Assert .assertTrue (txLatch .await (5000 , TimeUnit .MILLISECONDS ));
155157
@@ -184,7 +186,7 @@ public void test() throws InterruptedException {
184186 && resultsB2 .get (2 ).equals ("Event3" )
185187 && resultsB2 .get (3 ).equals ("secondBroadcast" ));
186188 target ().path ("sse/close" ).request ().get ();
187- Assert .assertTrue (closeLatch .await (3000 , TimeUnit .MILLISECONDS ));
189+ Assert .assertTrue (closeLatch .await (LATCH_WAIT_TIMEOUT , TimeUnit .MILLISECONDS ));
188190 Assert .assertTrue ("Sse instances injected into resource and constructor differ. Sse should have been injected"
189191 + "as a singleton" , isSingleton );
190192 }
0 commit comments