Description
the method java.net.Socket::isConnected behaves differently from openJDK
this different behavior cause the java.net.Socket::getRemoteSocketAddress returns
an unexpected null value.
the openJDK specification of java.net.Socket::isConnected is
Returns the connection state of the socket.
Note: Closing a socket doesn't clear its connection state, which means this method will return true for a closed socket (see isClosed()) if it was successfuly connected prior to being closed.
Returns:
true if the socket was successfuly connected to a server
Since:
1.4
public boolean isConnected() {
if (WispEngine.transparentWispSwitch())
return asyncImpl.isConnected(); // return the SocketChannelImpl.isConnected
// Before 1.3 Sockets were always connected during creation
return connected || oldImpl;
}
Expected behavior
return the same value as openJDk
JDK version
openjdk version "1.8.0_322"
OpenJDK Runtime Environment (Alibaba Dragonwell 8.10.11) (build 1.8.0_322-b01)
OpenJDK 64-Bit Server VM (Alibaba Dragonwell 8.10.11) (build 25.322-b01, mixed mode)
Description the method java.net.Socket::isConnected behaves differently from openJDK this different behavior cause the java.net.Socket::getRemoteSocketAddress returns an unexpected null value.
the openJDK specification of java.net.Socket::isConnected is Returns the connection state of the socket. Note: Closing a socket doesn't clear its connection state, which means this method will return true for a closed socket (see isClosed()) if it was successfuly connected prior to being closed. Returns: true if the socket was successfuly connected to a server Since: 1.4
Expected behavior return the same value as openJDk
JDK version openjdk version "1.8.0_322" OpenJDK Runtime Environment (Alibaba Dragonwell 8.10.11) (build 1.8.0_322-b01) OpenJDK 64-Bit Server VM (Alibaba Dragonwell 8.10.11) (build 25.322-b01, mixed mode)