it fixes the issue Always cleanup your stuff. If you connect it, then make sure you disconnect from it If you open it, then make sure you close it
if (agent != null)
How do you handle Socket Disconnecting in Java?
By : dskut
Date : March 29 2020, 07:55 AM
this one helps. Presumably, you're reading from the socket, perhaps using a wrapper over the input stream, such as a BufferedReader. In this case, you can detect the end-of-stream when the corresponding read operation returns -1 (for raw read() calls), or null (for readLine() calls). Certain operations will cause a SocketException when performed on a closed socket, which you will also need to deal with appropriately.
WebSphereMQ PCFMessageAgent / PCFAgent - Is it Thread Safe?
this will help You do not provide enough details to give an exact answer. That constructor does not allow for authentication, it connects to the host/port/channel specified but does not pass a username/password or allow for the use of a cetificate. If the channel on the queue manager does not require CONNAUTH (ex: "CHKCLNT(OPTIONAL)") or TLS (ex: SSLCIPH/SSLPEER) and you are not blocked by CHLAUTH rules, you may be able to connect.