Skip to content

Conversation

@zhengxiaolinX
Copy link
Contributor

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 zhengxiaolinX self-assigned this Nov 17, 2022
pb.start();
ss.accept();
} catch (Exception e) {
e.printStackTrace();
Copy link
Collaborator

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

Copy link
Contributor Author

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
public class ServerSocketConnectionTest {

private static final String CLIENT = "SimpleClient";
private static final String PORT = "4039";
Copy link
Collaborator

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.

Copy link
Collaborator

@D-D-H D-D-H Nov 21, 2022

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();
Copy link
Collaborator

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?

Class.forName(WispEventPump.class.getName());
Class.forName(ShutdownEngine.class.getName());
Class.forName(AbstractShutdownTask.class.getName());
Class.forName(ShutdownControlGroup.class.getName());
Copy link
Collaborator

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.

Class.forName(ShutdownEngine.class.getName());
Class.forName(AbstractShutdownTask.class.getName());
Class.forName(ShutdownControlGroup.class.getName());
Class.forName(Socket.class.getName());
Copy link
Collaborator

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.

@CLAassistant
Copy link

CLAassistant commented Mar 31, 2023

CLA assistant check
All committers have signed the CLA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants