-
Notifications
You must be signed in to change notification settings - Fork 497
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
[Wisp] Fix initialization problem between JavaNetSocketAccess and its usage #443
base: master
Are you sure you want to change the base?
Conversation
pb.start(); | ||
ss.accept(); | ||
} catch (Exception e) { | ||
e.printStackTrace(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use Asserts.fail()
for better readability
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.
… 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
cdbee46
to
558b5b2
Compare
|
||
|
||
public class ServerSocketConnectionTest { | ||
|
||
private static final String CLIENT = "SimpleClient"; | ||
private static final String PORT = "4039"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMHO, using a random port makes the test more stable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use 0
port – the port number, or 0 to use a port number that is automatically allocated.
PORT // port | ||
); | ||
pb.start(); | ||
ss.accept(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
accept after started? is this intentional?
@@ -148,6 +149,7 @@ private static void initializeClasses() { | |||
Class.forName(ShutdownEngine.class.getName()); | |||
Class.forName(AbstractShutdownTask.class.getName()); | |||
Class.forName(ShutdownControlGroup.class.getName()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add some comments to explain why we need this.
@@ -148,6 +149,7 @@ private static void initializeClasses() { | |||
Class.forName(ShutdownEngine.class.getName()); | |||
Class.forName(AbstractShutdownTask.class.getName()); | |||
Class.forName(ShutdownControlGroup.class.getName()); | |||
Class.forName(Socket.class.getName()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
JavaNetSocketAccess
is only used by ServerSocket
, I suggest moving setJavaNetSocketAccess
from Socket.<clinit>
to ServerSocket.<clinit>
. Thus, we don't need to preload Socket.class.
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