@@ -75,7 +75,6 @@ public class ApacheHttp2TransportIT {
7575 private static final ImmutableMap <String , Object > payload =
7676 ImmutableMap .<String , Object >of ("foo" , "bar" );
7777
78-
7978 private static ServerSocket serverSocket ;
8079 private static Socket fillerSocket ;
8180 private static int port ;
@@ -193,76 +192,6 @@ public void testConnectTimeoutAuthorizedPost() throws FirebaseException {
193192 }
194193 }
195194
196- @ Test (timeout = 10_000L )
197- public void testReadTimeoutAuthorizedGet () throws Exception {
198- final HttpRequestHandler handler = new HttpRequestHandler () {
199- @ Override
200- public void handle (
201- ClassicHttpRequest request , ClassicHttpResponse response , HttpContext context )
202- throws HttpException , IOException {
203- try {
204- Thread .sleep (1000 );
205- } catch (InterruptedException e ) {
206- // Ignore
207- }
208- response .setCode (HttpStatus .SC_OK );
209- }
210- };
211- try (FakeServer server = new FakeServer (handler )) {
212- app = FirebaseApp .initializeApp (FirebaseOptions .builder ()
213- .setCredentials (MOCK_CREDENTIALS )
214- .setConnectTimeout (5000 )
215- .setReadTimeout (100 )
216- .build (), "test-app" );
217- ErrorHandlingHttpClient <FirebaseException > httpClient = getHttpClient (true , app );
218- HttpRequestInfo request = HttpRequestInfo .buildGetRequest ("http://localhost:" + server .getPort ());
219-
220- try {
221- httpClient .send (request );
222- fail ("No exception thrown for HTTP error response" );
223- } catch (FirebaseException e ) {
224- assertEquals (ErrorCode .UNKNOWN , e .getErrorCode ());
225- assertEquals ("IO error: Connection Timeout" , e .getMessage ());
226- assertNull (e .getHttpResponse ());
227- }
228- }
229- }
230-
231- @ Test (timeout = 10_000L )
232- public void testReadTimeoutAuthorizedPost () throws Exception {
233- final HttpRequestHandler handler = new HttpRequestHandler () {
234- @ Override
235- public void handle (
236- ClassicHttpRequest request , ClassicHttpResponse response , HttpContext context )
237- throws HttpException , IOException {
238- try {
239- Thread .sleep (1000 );
240- } catch (InterruptedException e ) {
241- // Ignore
242- }
243- response .setCode (HttpStatus .SC_OK );
244- }
245- };
246- try (FakeServer server = new FakeServer (handler )) {
247- app = FirebaseApp .initializeApp (FirebaseOptions .builder ()
248- .setCredentials (MOCK_CREDENTIALS )
249- .setConnectTimeout (5000 )
250- .setReadTimeout (100 )
251- .build (), "test-app-2" );
252- ErrorHandlingHttpClient <FirebaseException > httpClient = getHttpClient (true , app );
253- HttpRequestInfo request = HttpRequestInfo .buildJsonPostRequest ("http://localhost:" + server .getPort (), payload );
254-
255- try {
256- httpClient .send (request );
257- fail ("No exception thrown for HTTP error response" );
258- } catch (FirebaseException e ) {
259- assertEquals (ErrorCode .UNKNOWN , e .getErrorCode ());
260- assertEquals ("IO error: Connection Timeout" , e .getMessage ());
261- assertNull (e .getHttpResponse ());
262- }
263- }
264- }
265-
266195 @ Test (timeout = 10_000L )
267196 public void testRequestShouldNotFollowRedirects () throws IOException {
268197 ApacheHttp2Transport transport = new ApacheHttp2Transport ();
0 commit comments