Updated on 2026-08-14

This commit is contained in:
Tangem 2018-10-11 22:15:27 +03:00
parent 7a4292f489
commit 4d5cc7255b
3 changed files with 35 additions and 10 deletions

View file

@ -3,6 +3,11 @@ package com.tangem.di;
import com.jakewharton.retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory;
import com.tangem.data.network.Server;
import java.io.IOException;
import java.net.InetSocketAddress;
import java.net.Socket;
import java.net.SocketException;
import javax.inject.Named;
import javax.inject.Singleton;
@ -81,4 +86,22 @@ class NetworkModule {
return logging;
}
@Provides
@Named("socket")
Socket provideSocket() {
Socket socket = new Socket();
try {
socket.setSoTimeout(5000);
try {
socket.bind(new InetSocketAddress(0));
} catch (IOException e) {
e.printStackTrace();
}
} catch (SocketException e) {
e.printStackTrace();
}
return socket;
}
}