-
Notifications
You must be signed in to change notification settings - Fork 290
Closed
Labels
Description
[READ] Step 1: Are you in the right place?
Yes
[REQUIRED] Step 2: Describe your environment
- Operating System version: Linux
- Firebase SDK version: 6.8.1
- Library version: firebase-admin
- Firebase Product: Push Notification
[REQUIRED] Step 3: Describe the problem
connectTimeout configured in FirebaseOptions object is not working if network connection is not available. Getting SocketTimeoutException once default http connect timeout occurs i.e. 60 seconds.
Steps to reproduce:
- Configure connectTimeout in FirebaseOptions object.
- Initialize FirebaseApp instance.
- Get FirebaseMessaging instance.
- Call send() method.
Relevant Code:
InetSocketAddress inetSocketAddress = new InetSocketAddress(proxy_ip, proxy_port);
HttpTransport httpTransport = new NetHttpTransport.Builder()
.setProxy(new Proxy(Proxy.Type.HTTP, inetSocketAddress))
.build();
HttpTransportFactory httpTransaportFactory = new HttpTransportFactory() {
@Override
public HttpTransport create() {
return httpTransport
}
};
GoogleCredentials googleCredentials = GoogleCredentials.fromStream(serviceAccount, httpTransaportFactory);
FirebaseOptions firebaseOptions = new FirebaseOptions.Builder()
.setCredentials(googleCredentials)
.setHttpTransport(httpTransport)
.setConnectTimeout(2*1000)
.setReadTimeout(3*1000)
.build();
FirebaseApp firebaseApp = FirebaseApp.initializeApp(firebaseOptions);
FirebaseMessaging.getInstance(firebaseApp).send(message);