-
Notifications
You must be signed in to change notification settings - Fork 496
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug] java.net.Socket::isConnected behaves differently from openJDK #437
Comments
luoxiner
changed the title
[Bug] A new bug
[Bug] java.net.Socket::isConnected behaves differently from openJDK
Nov 11, 2022
Thanks a lot for reporting this! It is indeed a discordance, and we are working on that. |
zhengxiaolinX
added a commit
that referenced
this issue
Nov 11, 2022
…urning result Summary: Socket.connect() in Wisp's implemention, uses nio SocketChannel's logic to prevent blocking when Socket is used. However, OpenJDK's isConnected() returns true after successfully connecting even if the socket gets closed. This will cause break accordance so we shall fix this. Test Plan: newly-added ServerSocketConnectionTest.java Reviewed-by: D-D-H Issue: #437
Done as completed. |
zhengxiaolinX
added a commit
that referenced
this issue
Nov 16, 2022
… usage Summary: JavaNetSocketAccess is used in WispServerSocketImpl.java, but the former one's initialization is in Socket.java. This underlying problem shall be fixed. Test Plan: ServerSocketConnectionTest.java Reviewed-by: D-D-H, yuleil Issue: #437
zhengxiaolinX
added a commit
that referenced
this issue
Nov 18, 2022
… usage Summary: JavaNetSocketAccess is used in WispServerSocketImpl.java, but the former one's initialization is in Socket.java. This underlying problem shall be fixed. Test Plan: ServerSocketConnectionTest.java Reviewed-by: D-D-H, yuleil Issue: #437
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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)
The text was updated successfully, but these errors were encountered: