2020import static io .grpc .internal .ClientStreamListener .RpcProgress .MISCARRIED ;
2121import static io .grpc .internal .ClientStreamListener .RpcProgress .PROCESSED ;
2222import static io .grpc .internal .ClientStreamListener .RpcProgress .REFUSED ;
23- import static io .grpc .internal .SimpleDisconnectError .SUBCHANNEL_SHUTDOWN ;
2423import static io .grpc .okhttp .Headers .CONTENT_TYPE_HEADER ;
2524import static io .grpc .okhttp .Headers .HTTP_SCHEME_HEADER ;
2625import static io .grpc .okhttp .Headers .METHOD_HEADER ;
7271import io .grpc .internal .ClientStream ;
7372import io .grpc .internal .ClientStreamListener ;
7473import io .grpc .internal .ClientTransport ;
74+ import io .grpc .internal .DisconnectError ;
7575import io .grpc .internal .FakeClock ;
7676import io .grpc .internal .GoAwayDisconnectError ;
7777import io .grpc .internal .GrpcUtil ;
@@ -486,7 +486,7 @@ public void nextFrameThrowIoException() throws Exception {
486486 assertEquals (Status .INTERNAL .getCode (), listener2 .status .getCode ());
487487 assertEquals (NETWORK_ISSUE_MESSAGE , listener2 .status .getCause ().getMessage ());
488488 verify (transportListener , timeout (TIME_OUT_MS )).transportShutdown (isA (Status .class ),
489- eq ( SimpleDisconnectError . SUBCHANNEL_SHUTDOWN ));
489+ any ( DisconnectError . class ));
490490 verify (transportListener , timeout (TIME_OUT_MS )).transportTerminated ();
491491 shutdownAndVerify ();
492492 }
@@ -513,7 +513,7 @@ public void nextFrameThrowsError() throws Exception {
513513 assertEquals (Status .INTERNAL .getCode (), listener .status .getCode ());
514514 assertEquals (ERROR_MESSAGE , listener .status .getCause ().getMessage ());
515515 verify (transportListener , timeout (TIME_OUT_MS )).transportShutdown (isA (Status .class ),
516- eq ( SimpleDisconnectError . SUBCHANNEL_SHUTDOWN ));
516+ any ( DisconnectError . class ));
517517 verify (transportListener , timeout (TIME_OUT_MS )).transportTerminated ();
518518 shutdownAndVerify ();
519519 }
@@ -530,7 +530,7 @@ public void nextFrameReturnFalse() throws Exception {
530530 listener .waitUntilStreamClosed ();
531531 assertEquals (Status .UNAVAILABLE .getCode (), listener .status .getCode ());
532532 verify (transportListener , timeout (TIME_OUT_MS )).transportShutdown (isA (Status .class ),
533- eq ( SimpleDisconnectError . SUBCHANNEL_SHUTDOWN ));
533+ any ( DisconnectError . class ));
534534 verify (transportListener , timeout (TIME_OUT_MS )).transportTerminated ();
535535 shutdownAndVerify ();
536536 }
@@ -573,7 +573,7 @@ public void receivedHeadersForInvalidStreamShouldKillConnection() throws Excepti
573573 verify (frameWriter , timeout (TIME_OUT_MS ))
574574 .goAway (eq (0 ), eq (ErrorCode .PROTOCOL_ERROR ), any (byte [].class ));
575575 verify (transportListener ).transportShutdown (isA (Status .class ),
576- eq ( SimpleDisconnectError . SUBCHANNEL_SHUTDOWN ));
576+ any ( DisconnectError . class ));
577577 verify (transportListener , timeout (TIME_OUT_MS )).transportTerminated ();
578578 shutdownAndVerify ();
579579 }
@@ -586,7 +586,7 @@ public void receivedDataForInvalidStreamShouldKillConnection() throws Exception
586586 verify (frameWriter , timeout (TIME_OUT_MS ))
587587 .goAway (eq (0 ), eq (ErrorCode .PROTOCOL_ERROR ), any (byte [].class ));
588588 verify (transportListener ).transportShutdown (isA (Status .class ),
589- eq ( SimpleDisconnectError . SUBCHANNEL_SHUTDOWN ));
589+ any ( DisconnectError . class ));
590590 verify (transportListener , timeout (TIME_OUT_MS )).transportTerminated ();
591591 shutdownAndVerify ();
592592 }
@@ -1218,7 +1218,7 @@ public void receiveGoAway() throws Exception {
12181218
12191219 // Transport should be in STOPPING state.
12201220 verify (transportListener ).transportShutdown (isA (Status .class ),
1221- eq ( SimpleDisconnectError . SUBCHANNEL_SHUTDOWN ));
1221+ any ( DisconnectError . class ));
12221222 verify (transportListener , never ()).transportTerminated ();
12231223
12241224 // Stream 2 should be closed.
@@ -1289,7 +1289,7 @@ public void streamIdExhausted() throws Exception {
12891289 assertEquals (message , listener .messages .get (0 ));
12901290 verify (frameWriter , timeout (TIME_OUT_MS )).rstStream (eq (startId ), eq (ErrorCode .CANCEL ));
12911291 verify (transportListener ).transportShutdown (isA (Status .class ),
1292- eq ( SimpleDisconnectError . SUBCHANNEL_SHUTDOWN ));
1292+ any ( DisconnectError . class ));
12931293 verify (transportListener , timeout (TIME_OUT_MS )).transportTerminated ();
12941294 shutdownAndVerify ();
12951295 }
@@ -1601,7 +1601,7 @@ public void receiveDataForUnknownStreamUpdateConnectionWindow() throws Exception
16011601 verify (frameWriter , timeout (TIME_OUT_MS ))
16021602 .goAway (eq (0 ), eq (ErrorCode .PROTOCOL_ERROR ), any (byte [].class ));
16031603 verify (transportListener ).transportShutdown (isA (Status .class ),
1604- eq ( SimpleDisconnectError . SUBCHANNEL_SHUTDOWN ));
1604+ any ( DisconnectError . class ));
16051605 verify (transportListener , timeout (TIME_OUT_MS )).transportTerminated ();
16061606 shutdownAndVerify ();
16071607 }
@@ -1622,7 +1622,7 @@ public void receiveWindowUpdateForUnknownStream() throws Exception {
16221622 verify (frameWriter , timeout (TIME_OUT_MS ))
16231623 .goAway (eq (0 ), eq (ErrorCode .PROTOCOL_ERROR ), any (byte [].class ));
16241624 verify (transportListener ).transportShutdown (isA (Status .class ),
1625- eq ( SimpleDisconnectError . SUBCHANNEL_SHUTDOWN ));
1625+ any ( DisconnectError . class ));
16261626 verify (transportListener , timeout (TIME_OUT_MS )).transportTerminated ();
16271627 shutdownAndVerify ();
16281628 }
@@ -1837,7 +1837,7 @@ public void unreachableServer() throws Exception {
18371837 clientTransport .start (listener );
18381838 ArgumentCaptor <Status > captor = ArgumentCaptor .forClass (Status .class );
18391839 verify (listener , timeout (TIME_OUT_MS )).transportShutdown (captor .capture (),
1840- eq ( SimpleDisconnectError . SUBCHANNEL_SHUTDOWN ));
1840+ any ( DisconnectError . class ));
18411841 Status status = captor .getValue ();
18421842 assertEquals (Status .UNAVAILABLE .getCode (), status .getCode ());
18431843 assertTrue (status .getCause ().toString (), status .getCause () instanceof IOException );
@@ -1869,7 +1869,7 @@ public void customSocketFactory() throws Exception {
18691869 clientTransport .start (listener );
18701870 ArgumentCaptor <Status > captor = ArgumentCaptor .forClass (Status .class );
18711871 verify (listener , timeout (TIME_OUT_MS )).transportShutdown (captor .capture (),
1872- eq ( SimpleDisconnectError . SUBCHANNEL_SHUTDOWN ));
1872+ any ( DisconnectError . class ));
18731873 Status status = captor .getValue ();
18741874 assertEquals (Status .UNAVAILABLE .getCode (), status .getCode ());
18751875 assertSame (exception , status .getCause ());
@@ -1920,7 +1920,7 @@ public void proxy_200() throws Exception {
19201920 sock .getOutputStream ().flush ();
19211921
19221922 verify (transportListener , timeout (TIME_OUT_MS )).transportShutdown (isA (Status .class ),
1923- eq ( SUBCHANNEL_SHUTDOWN ));
1923+ any ( DisconnectError . class ));
19241924 while (sock .getInputStream ().read () != -1 ) {}
19251925 verify (transportListener , timeout (TIME_OUT_MS )).transportTerminated ();
19261926 sock .close ();
@@ -1962,7 +1962,7 @@ public void proxy_500() throws Exception {
19621962
19631963 ArgumentCaptor <Status > captor = ArgumentCaptor .forClass (Status .class );
19641964 verify (transportListener , timeout (TIME_OUT_MS )).transportShutdown (captor .capture (),
1965- eq ( SUBCHANNEL_SHUTDOWN ));
1965+ any ( DisconnectError . class ));
19661966 Status error = captor .getValue ();
19671967 assertTrue ("Status didn't contain error code: " + captor .getValue (),
19681968 error .getDescription ().contains ("500" ));
@@ -2000,7 +2000,7 @@ public void proxy_immediateServerClose() throws Exception {
20002000
20012001 ArgumentCaptor <Status > captor = ArgumentCaptor .forClass (Status .class );
20022002 verify (transportListener , timeout (TIME_OUT_MS )).transportShutdown (captor .capture (),
2003- eq ( SUBCHANNEL_SHUTDOWN ));
2003+ any ( DisconnectError . class ));
20042004 Status error = captor .getValue ();
20052005 assertTrue ("Status didn't contain proxy: " + captor .getValue (),
20062006 error .getDescription ().contains ("proxy" ));
@@ -2037,7 +2037,7 @@ public void proxy_serverHangs() throws Exception {
20372037 while (!"" .equals (reader .readLine ())) {}
20382038
20392039 verify (transportListener , timeout (200 )).transportShutdown (any (Status .class ),
2040- eq ( SUBCHANNEL_SHUTDOWN ));
2040+ any ( DisconnectError . class ));
20412041 verify (transportListener , timeout (TIME_OUT_MS )).transportTerminated ();
20422042 sock .close ();
20432043 }
0 commit comments