-
Notifications
You must be signed in to change notification settings - Fork 58
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
Bugfix/whitelist #50
Bugfix/whitelist #50
Conversation
…on is not fixed, so you need to judge whether it is in the white list when initiating the connection
…e white list of being connected
client.addWhilteIP("127.0.0.1",8882); | ||
//白名单有的节点 | ||
boolean ans = client.isAcceptable(new InetSocketAddress("127.0.0.1",8882)); | ||
assert ans; |
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 use junit Assert
assert ans; | ||
//白名单无的节点 | ||
boolean ans1 = client.isAcceptable(new InetSocketAddress("127.0.0.1",8883)); | ||
assert !ans1; |
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 use junit Assert
@@ -57,10 +55,15 @@ public void startup() throws UnknownHostException { | |||
} | |||
|
|||
@Test | |||
public void ShouldFindTheSeedNode() { | |||
if(discV5Service2.streamKnownPeers().findFirst().isPresent()){ | |||
assert discoveryPeer.equals(discV5Service2.streamKnownPeers().findFirst().get()); |
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 use junit Assert
public void exitnetwork() throws InterruptedException { | ||
discV5Service2.stop(); | ||
Thread.sleep(1000); | ||
assert discV5Service1.streamKnownPeers().count() == 0; |
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 use junit Assert
} | ||
public void ShouldFindTheSeedNode() throws InterruptedException { | ||
Thread.sleep(1000); | ||
assert discV5Service2.streamKnownPeers().findFirst().isEmpty() || discoveryPeer.equals(discV5Service2.streamKnownPeers().findFirst().get()); |
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 use junit Assert
|
||
|
||
NonHandler rpc = (NonHandler) node1.rpcHandler; | ||
assert rpc.connection.remoteAddress().toString().equals(advertisedAddr.toString().substring(0, 24)); |
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 use junit Assert
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 use junit Assert
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.
nice work
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.
good job
The whitelist function is improved and test cases are added