@@ -58,6 +58,7 @@ public class ApacheHttp2TransportIT {
58
58
59
59
// Sets a 5 second delay before response
60
60
private static final String DELAY_URL = "https://nghttp2.org/httpbin/delay/5" ;
61
+ private static final String NO_CONNECT_URL = "https://google.com:81" ;
61
62
private static final String GET_URL = "https://nghttp2.org/httpbin/get" ;
62
63
private static final String POST_URL = "https://nghttp2.org/httpbin/post" ;
63
64
@@ -92,50 +93,35 @@ public void testUnauthorizedPostRequest() throws FirebaseException {
92
93
public void testConnectTimeoutAuthorizedGet () throws FirebaseException {
93
94
app = FirebaseApp .initializeApp (FirebaseOptions .builder ()
94
95
.setCredentials (MOCK_CREDENTIALS )
95
- .setConnectTimeout (100 )
96
+ // .setConnectTimeout(100)
96
97
.build (), "test-app" );
97
98
ErrorHandlingHttpClient <FirebaseException > httpClient = getHttpClient (true , app );
98
- HttpRequestInfo request = HttpRequestInfo .buildGetRequest ("http://google.com:81" );
99
+ HttpRequestInfo request = HttpRequestInfo .buildGetRequest (NO_CONNECT_URL );
99
100
100
101
try {
101
102
httpClient .send (request );
102
103
fail ("No exception thrown for HTTP error response" );
103
104
} catch (FirebaseException e ) {
104
105
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 ());
113
106
assertEquals ("IO error: Connection Timeout" , e .getMessage ());
114
107
assertNull (e .getHttpResponse ());
115
108
}
116
109
}
117
110
118
- @ Test (timeout = 10_000L )
111
+ @ Test (timeout = 20_000L )
119
112
public void testConnectTimeoutAuthorizedPost () throws FirebaseException {
120
113
app = FirebaseApp .initializeApp (FirebaseOptions .builder ()
121
114
.setCredentials (MOCK_CREDENTIALS )
122
- .setConnectTimeout (100 )
115
+ .setConnectTimeout (5000 )
123
116
.build (), "test-app" );
124
117
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 );
126
119
127
120
try {
128
121
httpClient .send (request );
129
122
fail ("No exception thrown for HTTP error response" );
130
123
} catch (FirebaseException e ) {
131
124
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 ());
139
125
assertEquals ("IO error: Connection Timeout" , e .getMessage ());
140
126
assertNull (e .getHttpResponse ());
141
127
}
0 commit comments