Unfortunately, there’s no function in the Java SDK allowing retrieving HttpClient object because all HttpClient object are built by buildHttpClient() function in RestClient class, and it’s a private function.
There’s already an Enhancement Request for adding this feature to the SDK and it’s currently a candidate, whereas there’s no detailed ETA for this update. I would definitely help you fill in another ER ticket for this feature as more people request the feature, the feature would get higher priority.
Or potentially, even if it’s very unrecommended to modify the SDK yourself, you can create a RestClient class in com.silanis.esl.sdk.internal package in your own project path. Copy paste all the existing code and modify the buildHttpClient() function, add connect timeout and socket timeout like something below:
SocketConfig socketConfig = SocketConfig.custom()
.build(); //added config
final HttpClientBuilder httpClientBuilder = HttpClients.custom()
.setDefaultSocketConfig(socketConfig) //added line
But still, it’s not suggested to overwrite classes from SDK as in that case, we can’t confirm that the SDK would still work properly.
Hope this could help!
Duo Liang OneSpan Junior Technical Evangelist
This reply was modified 2 months, 3 weeks ago by Duo_Liang.