@@ -114,7 +114,17 @@ public void run() {
114114 @ Test (timeout = TIMEOUT )
115115 public void shouldChangeSocketIdUponReconnection () throws InterruptedException {
116116 final BlockingQueue <Optional > values = new LinkedBlockingQueue <>();
117- socket = client ();
117+
118+ IO .Options opts = createOptions ();
119+ opts .forceNew = true ;
120+ try {
121+ JSONObject auth = new JSONObject ();
122+ auth .put ("noRecovery" , true );
123+ opts .auth = auth ;
124+ } catch (JSONException ignored ) {
125+ }
126+
127+ socket = client (opts );
118128 socket .once (Socket .EVENT_CONNECT , new Emitter .Listener () {
119129 @ Override
120130 public void call (Object ... objects ) {
@@ -160,7 +170,7 @@ public void shouldAcceptAQueryStringOnDefaultNamespace() throws InterruptedExcep
160170 socket .emit ("getHandshake" , new Ack () {
161171 @ Override
162172 public void call (Object ... args ) {
163- JSONObject handshake = (JSONObject )args [0 ];
173+ JSONObject handshake = (JSONObject ) args [0 ];
164174 values .offer (Optional .ofNullable (handshake ));
165175 }
166176 });
@@ -181,7 +191,7 @@ public void shouldAcceptAQueryString() throws InterruptedException, JSONExceptio
181191 socket .on ("handshake" , new Emitter .Listener () {
182192 @ Override
183193 public void call (Object ... args ) {
184- JSONObject handshake = (JSONObject )args [0 ];
194+ JSONObject handshake = (JSONObject ) args [0 ];
185195 values .offer (Optional .ofNullable (handshake ));
186196 }
187197 });
@@ -208,7 +218,7 @@ public void shouldAcceptAnAuthOption() throws InterruptedException, JSONExceptio
208218 socket .on ("handshake" , new Emitter .Listener () {
209219 @ Override
210220 public void call (Object ... args ) {
211- JSONObject handshake = (JSONObject )args [0 ];
221+ JSONObject handshake = (JSONObject ) args [0 ];
212222 values .offer (Optional .ofNullable (handshake ));
213223 }
214224 });
@@ -375,7 +385,7 @@ public void shouldNotTimeoutWhenTheServerDoesAcknowledgeTheEvent() throws Interr
375385 socket .on (Socket .EVENT_CONNECT , new Emitter .Listener () {
376386 @ Override
377387 public void call (Object ... args ) {
378- socket .emit ("ack" , 1 , "2" , new byte [] { 3 }, new AckWithTimeout (200 ) {
388+ socket .emit ("ack" , 1 , "2" , new byte []{ 3 }, new AckWithTimeout (200 ) {
379389 @ Override
380390 public void onTimeout () {
381391 fail ();
@@ -395,7 +405,7 @@ public void onSuccess(Object... args) {
395405
396406 assertThat ((Integer ) values .take (), is (1 ));
397407 assertThat ((String ) values .take (), is ("2" ));
398- assertThat ((byte []) values .take (), is (new byte [] { 3 }));
408+ assertThat ((byte []) values .take (), is (new byte []{ 3 }));
399409 }
400410
401411 @ Test (timeout = TIMEOUT )
@@ -405,7 +415,7 @@ public void shouldCallCatchAllListenerForIncomingPackets() throws InterruptedExc
405415 socket = client ();
406416
407417 socket .on ("message" , args -> {
408- socket .emit ("echo" , 1 , "2" , new byte [] { 3 });
418+ socket .emit ("echo" , 1 , "2" , new byte []{ 3 });
409419
410420 socket .onAnyIncoming (args1 -> {
411421 for (Object arg : args1 ) {
@@ -419,7 +429,7 @@ public void shouldCallCatchAllListenerForIncomingPackets() throws InterruptedExc
419429 assertThat ((String ) values .take (), is ("echoBack" ));
420430 assertThat ((Integer ) values .take (), is (1 ));
421431 assertThat ((String ) values .take (), is ("2" ));
422- assertThat ((byte []) values .take (), is (new byte [] { 3 }));
432+ assertThat ((byte []) values .take (), is (new byte []{ 3 }));
423433 }
424434
425435 @ Test (timeout = TIMEOUT )
@@ -428,7 +438,7 @@ public void shouldCallCatchAllListenerForOutgoingPackets() throws InterruptedExc
428438
429439 socket = client ();
430440
431- socket .emit ("echo" , 1 , "2" , new byte [] { 3 });
441+ socket .emit ("echo" , 1 , "2" , new byte []{ 3 });
432442
433443 socket .onAnyOutgoing (args -> {
434444 for (Object arg : args ) {
@@ -441,6 +451,6 @@ public void shouldCallCatchAllListenerForOutgoingPackets() throws InterruptedExc
441451 assertThat ((String ) values .take (), is ("echo" ));
442452 assertThat ((Integer ) values .take (), is (1 ));
443453 assertThat ((String ) values .take (), is ("2" ));
444- assertThat ((byte []) values .take (), is (new byte [] { 3 }));
454+ assertThat ((byte []) values .take (), is (new byte []{ 3 }));
445455 }
446456}
0 commit comments