@@ -58,6 +58,7 @@ public class ApacheHttp2TransportIT {
5858
5959 // Sets a 5 second delay before response
6060 private static final String DELAY_URL = "https://nghttp2.org/httpbin/delay/5" ;
61+ private static final String NO_CONNECT_URL = "https://google.com:81" ;
6162 private static final String GET_URL = "https://nghttp2.org/httpbin/get" ;
6263 private static final String POST_URL = "https://nghttp2.org/httpbin/post" ;
6364
@@ -92,50 +93,35 @@ public void testUnauthorizedPostRequest() throws FirebaseException {
9293 public void testConnectTimeoutAuthorizedGet () throws FirebaseException {
9394 app = FirebaseApp .initializeApp (FirebaseOptions .builder ()
9495 .setCredentials (MOCK_CREDENTIALS )
95- .setConnectTimeout (100 )
96+ // .setConnectTimeout(100)
9697 .build (), "test-app" );
9798 ErrorHandlingHttpClient <FirebaseException > httpClient = getHttpClient (true , app );
98- HttpRequestInfo request = HttpRequestInfo .buildGetRequest ("http://google.com:81" );
99+ HttpRequestInfo request = HttpRequestInfo .buildGetRequest (NO_CONNECT_URL );
99100
100101 try {
101102 httpClient .send (request );
102103 fail ("No exception thrown for HTTP error response" );
103104 } catch (FirebaseException e ) {
104105 assertEquals (ErrorCode .UNKNOWN , e .getErrorCode ());
105-
106- System .out .println (e .getCause ());
107- System .out .println (e .getCause ().getMessage ());
108- System .out .println (e .getCause ().getCause ());
109- System .out .println (e .getCause ().getCause ().getMessage ());
110- System .out .println (e .getCause ().getCause ().getCause ());
111- System .out .println (e .getCause ().getCause ().getCause ());
112- System .out .println (e .getCause ().getCause ().getCause ().getMessage ());
113106 assertEquals ("IO error: Connection Timeout" , e .getMessage ());
114107 assertNull (e .getHttpResponse ());
115108 }
116109 }
117110
118- @ Test (timeout = 10_000L )
111+ @ Test (timeout = 20_000L )
119112 public void testConnectTimeoutAuthorizedPost () throws FirebaseException {
120113 app = FirebaseApp .initializeApp (FirebaseOptions .builder ()
121114 .setCredentials (MOCK_CREDENTIALS )
122- .setConnectTimeout (100 )
115+ .setConnectTimeout (5000 )
123116 .build (), "test-app" );
124117 ErrorHandlingHttpClient <FirebaseException > httpClient = getHttpClient (true , app );
125- HttpRequestInfo request = HttpRequestInfo .buildJsonPostRequest ("https://google.com:81" , payload );
118+ HttpRequestInfo request = HttpRequestInfo .buildJsonPostRequest (NO_CONNECT_URL , payload );
126119
127120 try {
128121 httpClient .send (request );
129122 fail ("No exception thrown for HTTP error response" );
130123 } catch (FirebaseException e ) {
131124 assertEquals (ErrorCode .UNKNOWN , e .getErrorCode ());
132-
133- System .out .println (e .getCause ());
134- System .out .println (e .getCause ().getMessage ());
135- System .out .println (e .getCause ().getCause ());
136- System .out .println (e .getCause ().getCause ().getMessage ());
137- System .out .println (e .getCause ().getCause ().getCause ());
138- System .out .println (e .getCause ().getCause ().getCause ().getMessage ());
139125 assertEquals ("IO error: Connection Timeout" , e .getMessage ());
140126 assertNull (e .getHttpResponse ());
141127 }
0 commit comments