@@ -312,7 +312,7 @@ public void testGoodNetGWTimeout() throws Exception {
312
312
final int port = serverSocket .getLocalPort ();
313
313
AbstractClientConnectionFactory ccf = buildCF (port );
314
314
ccf .start ();
315
- testGoodNetGWTimeoutGuts (port , ccf , serverSocket );
315
+ testGoodNetGWTimeoutGuts (ccf , serverSocket );
316
316
serverSocket .close ();
317
317
}
318
318
@@ -323,7 +323,7 @@ public void testGoodNetGWTimeoutCached() throws Exception {
323
323
AbstractClientConnectionFactory ccf = buildCF (port );
324
324
CachingClientConnectionFactory cccf = new CachingClientConnectionFactory (ccf , 1 );
325
325
cccf .start ();
326
- testGoodNetGWTimeoutGuts (port , cccf , serverSocket );
326
+ testGoodNetGWTimeoutGuts (cccf , serverSocket );
327
327
serverSocket .close ();
328
328
}
329
329
@@ -342,8 +342,9 @@ private AbstractClientConnectionFactory buildCF(final int port) {
342
342
* own response, not that for the first.
343
343
* @throws Exception
344
344
*/
345
- private void testGoodNetGWTimeoutGuts (final int port , AbstractClientConnectionFactory ccf ,
345
+ private void testGoodNetGWTimeoutGuts (AbstractClientConnectionFactory ccf ,
346
346
final ServerSocket server ) throws InterruptedException {
347
+
347
348
final CountDownLatch latch = new CountDownLatch (1 );
348
349
final AtomicBoolean done = new AtomicBoolean ();
349
350
/*
@@ -372,12 +373,14 @@ private void testGoodNetGWTimeoutGuts(final int port, AbstractClientConnectionFa
372
373
oos .writeObject (request .replace ("Test" , "Reply" ));
373
374
logger .debug ("Replied to " + request );
374
375
lastReceived .set (request );
375
- serverLatch .countDown ();
376
376
}
377
377
catch (IOException e1 ) {
378
- logger .debug ("error on write " + e1 .getClass (). getSimpleName ());
378
+ logger .debug ("error on write " + e1 .getMessage ());
379
379
socket .close ();
380
380
}
381
+ finally {
382
+ serverLatch .countDown ();
383
+ }
381
384
}
382
385
}
383
386
}
@@ -398,7 +401,7 @@ private void testGoodNetGWTimeoutGuts(final int port, AbstractClientConnectionFa
398
401
Expression remoteTimeoutExpression = Mockito .mock (Expression .class );
399
402
400
403
when (remoteTimeoutExpression .getValue (Mockito .any (EvaluationContext .class ), Mockito .any (Message .class ),
401
- Mockito .eq (Long .class ))).thenReturn (50L , 10000L );
404
+ Mockito .eq (Long .class ))).thenReturn (50L , 60000L );
402
405
403
406
gateway .setRemoteTimeoutExpression (remoteTimeoutExpression );
404
407
@@ -626,7 +629,7 @@ public void testNetGWPropagatesSocketClose() throws Exception {
626
629
ccf .setSoTimeout (10000 );
627
630
ccf .setSingleUse (false );
628
631
ccf .start ();
629
- testGWPropagatesSocketCloseGuts (port , ccf , serverSocket );
632
+ testGWPropagatesSocketCloseGuts (ccf , serverSocket );
630
633
serverSocket .close ();
631
634
}
632
635
@@ -640,7 +643,7 @@ public void testNioGWPropagatesSocketClose() throws Exception {
640
643
ccf .setSoTimeout (10000 );
641
644
ccf .setSingleUse (false );
642
645
ccf .start ();
643
- testGWPropagatesSocketCloseGuts (port , ccf , serverSocket );
646
+ testGWPropagatesSocketCloseGuts (ccf , serverSocket );
644
647
serverSocket .close ();
645
648
}
646
649
@@ -655,7 +658,7 @@ public void testCachedGWPropagatesSocketClose() throws Exception {
655
658
ccf .setSingleUse (false );
656
659
CachingClientConnectionFactory cccf = new CachingClientConnectionFactory (ccf , 1 );
657
660
cccf .start ();
658
- testGWPropagatesSocketCloseGuts (port , cccf , serverSocket );
661
+ testGWPropagatesSocketCloseGuts (cccf , serverSocket );
659
662
serverSocket .close ();
660
663
}
661
664
@@ -671,12 +674,13 @@ public void testFailoverGWPropagatesSocketClose() throws Exception {
671
674
FailoverClientConnectionFactory focf = new FailoverClientConnectionFactory (
672
675
Collections .singletonList (ccf ));
673
676
focf .start ();
674
- testGWPropagatesSocketCloseGuts (port , focf , serverSocket );
677
+ testGWPropagatesSocketCloseGuts (focf , serverSocket );
675
678
serverSocket .close ();
676
679
}
677
680
678
- private void testGWPropagatesSocketCloseGuts (final int port , AbstractClientConnectionFactory ccf ,
681
+ private void testGWPropagatesSocketCloseGuts (AbstractClientConnectionFactory ccf ,
679
682
final ServerSocket server ) throws Exception {
683
+
680
684
final CountDownLatch latch = new CountDownLatch (1 );
681
685
final AtomicBoolean done = new AtomicBoolean ();
682
686
final AtomicReference <String > lastReceived = new AtomicReference <>();
@@ -699,6 +703,7 @@ private void testGWPropagatesSocketCloseGuts(final int port, AbstractClientConne
699
703
serverLatch .countDown ();
700
704
}
701
705
catch (IOException e1 ) {
706
+ logger .debug ("error on write " + e1 .getMessage ());
702
707
socket1 .close ();
703
708
}
704
709
}
@@ -713,7 +718,7 @@ private void testGWPropagatesSocketCloseGuts(final int port, AbstractClientConne
713
718
try {
714
719
socket2 .close ();
715
720
}
716
- catch (IOException e3 ) {
721
+ catch (@ SuppressWarnings ( "unused" ) IOException e3 ) {
717
722
}
718
723
}
719
724
});
@@ -754,7 +759,7 @@ public void testNetGWPropagatesSocketTimeout() throws Exception {
754
759
ccf .setSoTimeout (100 );
755
760
ccf .setSingleUse (false );
756
761
ccf .start ();
757
- testGWPropagatesSocketTimeoutGuts (port , ccf , serverSocket );
762
+ testGWPropagatesSocketTimeoutGuts (ccf , serverSocket );
758
763
serverSocket .close ();
759
764
}
760
765
@@ -768,7 +773,7 @@ public void testNioGWPropagatesSocketTimeout() throws Exception {
768
773
ccf .setSoTimeout (100 );
769
774
ccf .setSingleUse (false );
770
775
ccf .start ();
771
- testGWPropagatesSocketTimeoutGuts (port , ccf , serverSocket );
776
+ testGWPropagatesSocketTimeoutGuts (ccf , serverSocket );
772
777
serverSocket .close ();
773
778
}
774
779
@@ -782,7 +787,7 @@ public void testNetGWPropagatesSocketTimeoutSingleUse() throws Exception {
782
787
ccf .setSoTimeout (100 );
783
788
ccf .setSingleUse (true );
784
789
ccf .start ();
785
- testGWPropagatesSocketTimeoutGuts (port , ccf , serverSocket );
790
+ testGWPropagatesSocketTimeoutGuts (ccf , serverSocket );
786
791
serverSocket .close ();
787
792
}
788
793
@@ -796,12 +801,13 @@ public void testNioGWPropagatesSocketTimeoutSingleUse() throws Exception {
796
801
ccf .setSoTimeout (100 );
797
802
ccf .setSingleUse (true );
798
803
ccf .start ();
799
- testGWPropagatesSocketTimeoutGuts (port , ccf , serverSocket );
804
+ testGWPropagatesSocketTimeoutGuts (ccf , serverSocket );
800
805
serverSocket .close ();
801
806
}
802
807
803
- private void testGWPropagatesSocketTimeoutGuts (final int port , AbstractClientConnectionFactory ccf ,
808
+ private void testGWPropagatesSocketTimeoutGuts (AbstractClientConnectionFactory ccf ,
804
809
final ServerSocket server ) throws Exception {
810
+
805
811
final CountDownLatch latch = new CountDownLatch (1 );
806
812
final AtomicBoolean done = new AtomicBoolean ();
807
813
@@ -822,7 +828,7 @@ private void testGWPropagatesSocketTimeoutGuts(final int port, AbstractClientCon
822
828
try {
823
829
socket .close ();
824
830
}
825
- catch (IOException e2 ) {
831
+ catch (@ SuppressWarnings ( "unused" ) IOException e2 ) {
826
832
}
827
833
}
828
834
});
@@ -879,7 +885,7 @@ public void testNioSecondChance() throws Exception {
879
885
try {
880
886
socket .close ();
881
887
}
882
- catch (IOException e2 ) {
888
+ catch (@ SuppressWarnings ( "unused" ) IOException e2 ) {
883
889
}
884
890
}
885
891
});
0 commit comments