File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed
main/java/com/google/firebase/remoteconfig/internal
test/java/com/google/firebase/remoteconfig Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -119,7 +119,7 @@ public void listenForNotifications() {
119119 handleNotifications (inputStream );
120120 } catch (IOException ex ) {
121121 // If the real-time connection is at an unexpected lifecycle state when the app is
122- // backgrounded, it's expected closing the InputStream will throw an exception.
122+ // backgrounded, it's expected closing the httpURLConnection will throw an exception.
123123 if (!isInBackground ) {
124124 // Otherwise, the real-time server connection was closed due to a transient issue.
125125 Log .d (TAG , "Real-time connection was closed due to an exception." , ex );
Original file line number Diff line number Diff line change @@ -1566,6 +1566,18 @@ public void realtime_stream_listen_get_inputstream_fail() throws Exception {
15661566 verify (inputStream ).close ();
15671567 }
15681568
1569+ @ Test
1570+ public void realtime_stream_listen_get_inputstream_exception_handling () throws Exception {
1571+ ConfigAutoFetch configAutoFetchSpy = spy (configAutoFetch );
1572+ InputStream inputStream = mock (InputStream .class );
1573+ when (mockHttpURLConnection .getResponseCode ()).thenReturn (200 );
1574+ when (mockHttpURLConnection .getInputStream ()).thenThrow (IOException .class );
1575+ configAutoFetchSpy .listenForNotifications ();
1576+
1577+ verify (mockHttpURLConnection , times (1 )).getInputStream ();
1578+ verify (inputStream , never ()).close ();
1579+ }
1580+
15691581 @ Test
15701582 public void realtime_stream_autofetch_success () throws Exception {
15711583 // Setup activated configs with keys "string_param", "long_param"
You can’t perform that action at this time.
0 commit comments