@@ -306,7 +306,7 @@ public void testGoodNetGWTimeout() throws Exception {
306
306
final int port = serverSocket .getLocalPort ();
307
307
AbstractClientConnectionFactory ccf = buildCF (port );
308
308
ccf .start ();
309
- testGoodNetGWTimeoutGuts (port , ccf , serverSocket );
309
+ testGoodNetGWTimeoutGuts (ccf , serverSocket );
310
310
serverSocket .close ();
311
311
}
312
312
@@ -317,7 +317,7 @@ public void testGoodNetGWTimeoutCached() throws Exception {
317
317
AbstractClientConnectionFactory ccf = buildCF (port );
318
318
CachingClientConnectionFactory cccf = new CachingClientConnectionFactory (ccf , 1 );
319
319
cccf .start ();
320
- testGoodNetGWTimeoutGuts (port , cccf , serverSocket );
320
+ testGoodNetGWTimeoutGuts (cccf , serverSocket );
321
321
serverSocket .close ();
322
322
}
323
323
@@ -336,8 +336,9 @@ private AbstractClientConnectionFactory buildCF(final int port) {
336
336
* own response, not that for the first.
337
337
* @throws Exception
338
338
*/
339
- private void testGoodNetGWTimeoutGuts (final int port , AbstractClientConnectionFactory ccf ,
339
+ private void testGoodNetGWTimeoutGuts (AbstractClientConnectionFactory ccf ,
340
340
final ServerSocket server ) throws InterruptedException {
341
+
341
342
final CountDownLatch latch = new CountDownLatch (1 );
342
343
final AtomicBoolean done = new AtomicBoolean ();
343
344
/*
@@ -366,12 +367,14 @@ private void testGoodNetGWTimeoutGuts(final int port, AbstractClientConnectionFa
366
367
oos .writeObject (request .replace ("Test" , "Reply" ));
367
368
logger .debug ("Replied to " + request );
368
369
lastReceived .set (request );
369
- serverLatch .countDown ();
370
370
}
371
371
catch (IOException e1 ) {
372
- logger .debug ("error on write " + e1 .getClass (). getSimpleName ());
372
+ logger .debug ("error on write " + e1 .getMessage ());
373
373
socket .close ();
374
374
}
375
+ finally {
376
+ serverLatch .countDown ();
377
+ }
375
378
}
376
379
}
377
380
}
@@ -392,7 +395,7 @@ private void testGoodNetGWTimeoutGuts(final int port, AbstractClientConnectionFa
392
395
Expression remoteTimeoutExpression = Mockito .mock (Expression .class );
393
396
394
397
when (remoteTimeoutExpression .getValue (Mockito .any (EvaluationContext .class ), Mockito .any (Message .class ),
395
- Mockito .eq (Long .class ))).thenReturn (50L , 10000L );
398
+ Mockito .eq (Long .class ))).thenReturn (50L , 60000L );
396
399
397
400
gateway .setRemoteTimeoutExpression (remoteTimeoutExpression );
398
401
@@ -620,7 +623,7 @@ public void testNetGWPropagatesSocketClose() throws Exception {
620
623
ccf .setSoTimeout (10000 );
621
624
ccf .setSingleUse (false );
622
625
ccf .start ();
623
- testGWPropagatesSocketCloseGuts (port , ccf , serverSocket );
626
+ testGWPropagatesSocketCloseGuts (ccf , serverSocket );
624
627
serverSocket .close ();
625
628
}
626
629
@@ -634,7 +637,7 @@ public void testNioGWPropagatesSocketClose() throws Exception {
634
637
ccf .setSoTimeout (10000 );
635
638
ccf .setSingleUse (false );
636
639
ccf .start ();
637
- testGWPropagatesSocketCloseGuts (port , ccf , serverSocket );
640
+ testGWPropagatesSocketCloseGuts (ccf , serverSocket );
638
641
serverSocket .close ();
639
642
}
640
643
@@ -649,7 +652,7 @@ public void testCachedGWPropagatesSocketClose() throws Exception {
649
652
ccf .setSingleUse (false );
650
653
CachingClientConnectionFactory cccf = new CachingClientConnectionFactory (ccf , 1 );
651
654
cccf .start ();
652
- testGWPropagatesSocketCloseGuts (port , cccf , serverSocket );
655
+ testGWPropagatesSocketCloseGuts (cccf , serverSocket );
653
656
serverSocket .close ();
654
657
}
655
658
@@ -665,12 +668,13 @@ public void testFailoverGWPropagatesSocketClose() throws Exception {
665
668
FailoverClientConnectionFactory focf = new FailoverClientConnectionFactory (
666
669
Collections .singletonList (ccf ));
667
670
focf .start ();
668
- testGWPropagatesSocketCloseGuts (port , focf , serverSocket );
671
+ testGWPropagatesSocketCloseGuts (focf , serverSocket );
669
672
serverSocket .close ();
670
673
}
671
674
672
- private void testGWPropagatesSocketCloseGuts (final int port , AbstractClientConnectionFactory ccf ,
675
+ private void testGWPropagatesSocketCloseGuts (AbstractClientConnectionFactory ccf ,
673
676
final ServerSocket server ) throws Exception {
677
+
674
678
final CountDownLatch latch = new CountDownLatch (1 );
675
679
final AtomicBoolean done = new AtomicBoolean ();
676
680
final AtomicReference <String > lastReceived = new AtomicReference <>();
@@ -693,6 +697,7 @@ private void testGWPropagatesSocketCloseGuts(final int port, AbstractClientConne
693
697
serverLatch .countDown ();
694
698
}
695
699
catch (IOException e1 ) {
700
+ logger .debug ("error on write " + e1 .getMessage ());
696
701
socket1 .close ();
697
702
}
698
703
}
@@ -707,7 +712,7 @@ private void testGWPropagatesSocketCloseGuts(final int port, AbstractClientConne
707
712
try {
708
713
socket2 .close ();
709
714
}
710
- catch (IOException e3 ) {
715
+ catch (@ SuppressWarnings ( "unused" ) IOException e3 ) {
711
716
}
712
717
}
713
718
});
@@ -748,7 +753,7 @@ public void testNetGWPropagatesSocketTimeout() throws Exception {
748
753
ccf .setSoTimeout (100 );
749
754
ccf .setSingleUse (false );
750
755
ccf .start ();
751
- testGWPropagatesSocketTimeoutGuts (port , ccf , serverSocket );
756
+ testGWPropagatesSocketTimeoutGuts (ccf , serverSocket );
752
757
serverSocket .close ();
753
758
}
754
759
@@ -762,7 +767,7 @@ public void testNioGWPropagatesSocketTimeout() throws Exception {
762
767
ccf .setSoTimeout (100 );
763
768
ccf .setSingleUse (false );
764
769
ccf .start ();
765
- testGWPropagatesSocketTimeoutGuts (port , ccf , serverSocket );
770
+ testGWPropagatesSocketTimeoutGuts (ccf , serverSocket );
766
771
serverSocket .close ();
767
772
}
768
773
@@ -776,7 +781,7 @@ public void testNetGWPropagatesSocketTimeoutSingleUse() throws Exception {
776
781
ccf .setSoTimeout (100 );
777
782
ccf .setSingleUse (true );
778
783
ccf .start ();
779
- testGWPropagatesSocketTimeoutGuts (port , ccf , serverSocket );
784
+ testGWPropagatesSocketTimeoutGuts (ccf , serverSocket );
780
785
serverSocket .close ();
781
786
}
782
787
@@ -790,12 +795,13 @@ public void testNioGWPropagatesSocketTimeoutSingleUse() throws Exception {
790
795
ccf .setSoTimeout (100 );
791
796
ccf .setSingleUse (true );
792
797
ccf .start ();
793
- testGWPropagatesSocketTimeoutGuts (port , ccf , serverSocket );
798
+ testGWPropagatesSocketTimeoutGuts (ccf , serverSocket );
794
799
serverSocket .close ();
795
800
}
796
801
797
- private void testGWPropagatesSocketTimeoutGuts (final int port , AbstractClientConnectionFactory ccf ,
802
+ private void testGWPropagatesSocketTimeoutGuts (AbstractClientConnectionFactory ccf ,
798
803
final ServerSocket server ) throws Exception {
804
+
799
805
final CountDownLatch latch = new CountDownLatch (1 );
800
806
final AtomicBoolean done = new AtomicBoolean ();
801
807
@@ -816,7 +822,7 @@ private void testGWPropagatesSocketTimeoutGuts(final int port, AbstractClientCon
816
822
try {
817
823
socket .close ();
818
824
}
819
- catch (IOException e2 ) {
825
+ catch (@ SuppressWarnings ( "unused" ) IOException e2 ) {
820
826
}
821
827
}
822
828
});
@@ -873,7 +879,7 @@ public void testNioSecondChance() throws Exception {
873
879
try {
874
880
socket .close ();
875
881
}
876
- catch (IOException e2 ) {
882
+ catch (@ SuppressWarnings ( "unused" ) IOException e2 ) {
877
883
}
878
884
}
879
885
});
0 commit comments