I have a Client Server Application wherein my client (multiple mobile devices) use HttpsURLConnection to connect to the Server IP/Port. It is a simple application wherein a customer walks-in to the store, makes a transaction on the Teller Mobile Device and leaves. What I want is not to re-establish the expensive SSL handshake every time. I read through a lot of documentation which suggests which we should use close() and then disconnect(). They also talk about sockets being re-used even after close() and disconnect() is called from a pool. My requirement is simple: 1. I want to make connection to server 2. Send Req and get Resp 3. Close()/Disconnect() only if necessary 4. Then re-send Req/Resp for another customer.
If sockets are being cached and re-used from the pool, is there a possibility that some client device may get an error saying No More Sockets available for connection?
Basically I want to re-use socket connections but at the same time do not want some device to get an error on No Socket available on Server.
Please suggest the best approach for this.