|
@@ -80,7 +80,12 @@ public class SocketService {
|
|
|
if (cachedMap.containsKey(key) && cachedMap.get(key) != null) {
|
|
|
Socket s = cachedMap.get(key).getSocket();
|
|
|
if (s != null) {
|
|
|
- return (s.isConnected() && s.isBound() && !s.isClosed());
|
|
|
+ return (s.isConnected() &&
|
|
|
+ s.isBound() &&
|
|
|
+ !s.isClosed() &&
|
|
|
+ !s.isInputShutdown() &&
|
|
|
+ !s.isOutputShutdown()
|
|
|
+ );
|
|
|
}
|
|
|
}
|
|
|
return false;
|
|
@@ -194,7 +199,9 @@ public class SocketService {
|
|
|
if (cachedMap.containsKey(key)) {
|
|
|
Socket s = cachedMap.get(key).getSocket();
|
|
|
s.getInputStream().close();
|
|
|
+ s.shutdownInput();
|
|
|
s.getOutputStream().close();
|
|
|
+ s.shutdownOutput();
|
|
|
s.close();
|
|
|
}
|
|
|
} catch (IOException e) {
|