@@ -1835,12 +1835,16 @@ public void unreachableServer() throws Exception {
1835
1835
1836
1836
ManagedClientTransport .Listener listener = mock (ManagedClientTransport .Listener .class );
1837
1837
clientTransport .start (listener );
1838
- ArgumentCaptor <Status > captor = ArgumentCaptor .forClass (Status .class );
1839
- verify (listener , timeout (TIME_OUT_MS )).transportShutdown (captor .capture (),
1840
- any (DisconnectError .class ));
1841
- Status status = captor .getValue ();
1838
+ ArgumentCaptor <Status > statusCaptor = ArgumentCaptor .forClass (Status .class );
1839
+ ArgumentCaptor <DisconnectError > errorCaptor = ArgumentCaptor .forClass (DisconnectError .class );
1840
+
1841
+ verify (listener , timeout (TIME_OUT_MS )).transportShutdown (statusCaptor .capture (),
1842
+ errorCaptor .capture ());
1843
+ Status status = statusCaptor .getValue ();
1844
+ DisconnectError error = errorCaptor .getValue ();
1842
1845
assertEquals (Status .UNAVAILABLE .getCode (), status .getCode ());
1843
1846
assertTrue (status .getCause ().toString (), status .getCause () instanceof IOException );
1847
+ assertEquals (new GoAwayDisconnectError (GrpcUtil .Http2Error .INTERNAL_ERROR ), error );
1844
1848
1845
1849
MockStreamListener streamListener = new MockStreamListener ();
1846
1850
clientTransport .newStream (method , new Metadata (), CallOptions .DEFAULT , tracers )
@@ -1867,11 +1871,14 @@ public void customSocketFactory() throws Exception {
1867
1871
1868
1872
ManagedClientTransport .Listener listener = mock (ManagedClientTransport .Listener .class );
1869
1873
clientTransport .start (listener );
1870
- ArgumentCaptor <Status > captor = ArgumentCaptor .forClass (Status .class );
1871
- verify (listener , timeout (TIME_OUT_MS )).transportShutdown (captor .capture (),
1872
- any (DisconnectError .class ));
1873
- Status status = captor .getValue ();
1874
+ ArgumentCaptor <Status > statusCaptor = ArgumentCaptor .forClass (Status .class );
1875
+ ArgumentCaptor <DisconnectError > errorCaptor = ArgumentCaptor .forClass (DisconnectError .class );
1876
+ verify (listener , timeout (TIME_OUT_MS )).transportShutdown (statusCaptor .capture (),
1877
+ errorCaptor .capture ());
1878
+ Status status = statusCaptor .getValue ();
1879
+ DisconnectError error = errorCaptor .getValue ();
1874
1880
assertEquals (Status .UNAVAILABLE .getCode (), status .getCode ());
1881
+ assertEquals (new GoAwayDisconnectError (GrpcUtil .Http2Error .INTERNAL_ERROR ), error );
1875
1882
assertSame (exception , status .getCause ());
1876
1883
}
1877
1884
@@ -1960,18 +1967,21 @@ public void proxy_500() throws Exception {
1960
1967
1961
1968
assertEquals (-1 , sock .getInputStream ().read ());
1962
1969
1963
- ArgumentCaptor <Status > captor = ArgumentCaptor .forClass (Status .class );
1964
- verify (transportListener , timeout (TIME_OUT_MS )).transportShutdown (captor .capture (),
1965
- any (DisconnectError .class ));
1966
- Status error = captor .getValue ();
1967
- assertTrue ("Status didn't contain error code: " + captor .getValue (),
1968
- error .getDescription ().contains ("500" ));
1969
- assertTrue ("Status didn't contain error description: " + captor .getValue (),
1970
- error .getDescription ().contains ("OH NO" ));
1971
- assertTrue ("Status didn't contain error text: " + captor .getValue (),
1972
- error .getDescription ().contains (errorText ));
1973
- assertEquals ("Not UNAVAILABLE: " + captor .getValue (),
1974
- Status .UNAVAILABLE .getCode (), error .getCode ());
1970
+ ArgumentCaptor <Status > statusCaptor = ArgumentCaptor .forClass (Status .class );
1971
+ ArgumentCaptor <DisconnectError > errorCaptor = ArgumentCaptor .forClass (DisconnectError .class );
1972
+ verify (transportListener , timeout (TIME_OUT_MS )).transportShutdown (statusCaptor .capture (),
1973
+ errorCaptor .capture ());
1974
+ Status status = statusCaptor .getValue ();
1975
+ DisconnectError error = errorCaptor .getValue ();
1976
+ assertTrue ("Status didn't contain error code: " + statusCaptor .getValue (),
1977
+ status .getDescription ().contains ("500" ));
1978
+ assertTrue ("Status didn't contain error description: " + statusCaptor .getValue (),
1979
+ status .getDescription ().contains ("OH NO" ));
1980
+ assertTrue ("Status didn't contain error text: " + statusCaptor .getValue (),
1981
+ status .getDescription ().contains (errorText ));
1982
+ assertEquals ("Not UNAVAILABLE: " + statusCaptor .getValue (),
1983
+ Status .UNAVAILABLE .getCode (), status .getCode ());
1984
+ assertEquals (new GoAwayDisconnectError (GrpcUtil .Http2Error .INTERNAL_ERROR ), error );
1975
1985
sock .close ();
1976
1986
verify (transportListener , timeout (TIME_OUT_MS )).transportTerminated ();
1977
1987
}
@@ -1998,14 +2008,17 @@ public void proxy_immediateServerClose() throws Exception {
1998
2008
serverSocket .close ();
1999
2009
sock .close ();
2000
2010
2001
- ArgumentCaptor <Status > captor = ArgumentCaptor .forClass (Status .class );
2002
- verify (transportListener , timeout (TIME_OUT_MS )).transportShutdown (captor .capture (),
2003
- any (DisconnectError .class ));
2004
- Status error = captor .getValue ();
2005
- assertTrue ("Status didn't contain proxy: " + captor .getValue (),
2006
- error .getDescription ().contains ("proxy" ));
2007
- assertEquals ("Not UNAVAILABLE: " + captor .getValue (),
2008
- Status .UNAVAILABLE .getCode (), error .getCode ());
2011
+ ArgumentCaptor <Status > statusCaptor = ArgumentCaptor .forClass (Status .class );
2012
+ ArgumentCaptor <DisconnectError > errorCaptor = ArgumentCaptor .forClass (DisconnectError .class );
2013
+ verify (transportListener , timeout (TIME_OUT_MS )).transportShutdown (statusCaptor .capture (),
2014
+ errorCaptor .capture ());
2015
+ Status status = statusCaptor .getValue ();
2016
+ DisconnectError error = errorCaptor .getValue ();
2017
+ assertTrue ("Status didn't contain proxy: " + statusCaptor .getValue (),
2018
+ status .getDescription ().contains ("proxy" ));
2019
+ assertEquals ("Not UNAVAILABLE: " + statusCaptor .getValue (),
2020
+ Status .UNAVAILABLE .getCode (), status .getCode ());
2021
+ assertEquals (SimpleDisconnectError .SUBCHANNEL_SHUTDOWN , error );
2009
2022
verify (transportListener , timeout (TIME_OUT_MS )).transportTerminated ();
2010
2023
}
2011
2024
0 commit comments