@@ -420,8 +420,8 @@ public void reconnectDelayShouldIncreaseEveryTime() throws URISyntaxException, I
420420 IO .Options opts = createOptions ();
421421 opts .reconnection = true ;
422422 opts .timeout = 0 ;
423- opts .reconnectionAttempts = 5 ;
424- opts .reconnectionDelay = 10 ;
423+ opts .reconnectionAttempts = 3 ;
424+ opts .reconnectionDelay = 100 ;
425425 opts .randomizationFactor = 0.2 ;
426426 final Manager manager = new Manager (new URI (uri ()), opts );
427427 socket = manager .socket ("/timeout" );
@@ -458,9 +458,8 @@ public void call(Object... args) {
458458
459459 socket .connect ();
460460 values .take ();
461- assertThat (reconnects [0 ], is (5 ));
462- // this fails sometimes
463- //assertThat(increasingDelay[0], is(true));
461+ assertThat (reconnects [0 ], is (3 ));
462+ assertThat (increasingDelay [0 ], is (true ));
464463 socket .close ();
465464 manager .close ();
466465 }
@@ -545,6 +544,32 @@ public void run() {
545544 assertThat ((Boolean ) values .take (), is (true ));
546545 }
547546
547+ @ Test (timeout = TIMEOUT )
548+ public void reconnectAfterStoppingReconnection () throws URISyntaxException , InterruptedException {
549+ final BlockingQueue <Object > values = new LinkedBlockingQueue <Object >();
550+ IO .Options opts = createOptions ();
551+ opts .forceNew = true ;
552+ opts .timeout = 0 ;
553+ opts .reconnectionDelay = 10 ;
554+ socket = client ("/invalid" , opts );
555+ socket .once (Socket .EVENT_RECONNECT_ATTEMPT , new Emitter .Listener () {
556+ @ Override
557+ public void call (Object ... args ) {
558+ socket .once (Socket .EVENT_RECONNECT_ATTEMPT , new Emitter .Listener () {
559+ @ Override
560+ public void call (Object ... args ) {
561+ values .offer ("done" );
562+ }
563+ });
564+ socket .disconnect ();
565+ socket .connect ();
566+ }
567+ });
568+ socket .connect ();
569+ values .take ();
570+ socket .disconnect ();
571+ }
572+
548573 @ Test (timeout = TIMEOUT )
549574 public void stopReconnectingOnASocketAndKeepToReconnectOnAnother () throws URISyntaxException , InterruptedException {
550575 final BlockingQueue <Object > values = new LinkedBlockingQueue <Object >();
0 commit comments