use of co.rsk.scoring.PeerScoringManager in project rskj by rsksmart.
the class Web3ImplScoringTest method addBannedAddressUsingIPV6AndMask.
@Test
public void addBannedAddressUsingIPV6AndMask() throws UnknownHostException {
PeerScoringManager peerScoringManager = createPeerScoringManager();
Web3Impl web3 = createWeb3(peerScoringManager);
InetAddress address = generateIPAddressV6();
Assert.assertTrue(peerScoringManager.hasGoodReputation(address));
web3.sco_banAddress(address.getHostAddress() + "/64");
Assert.assertFalse(peerScoringManager.hasGoodReputation(address));
}
use of co.rsk.scoring.PeerScoringManager in project rskj by rsksmart.
the class Web3ImplScoringTest method addAndRemoveBannedAddressUsingIPV6AndMask.
@Test
public void addAndRemoveBannedAddressUsingIPV6AndMask() throws UnknownHostException {
PeerScoringManager peerScoringManager = createPeerScoringManager();
Web3Impl web3 = createWeb3(peerScoringManager);
InetAddress address = generateIPAddressV6();
Assert.assertTrue(peerScoringManager.hasGoodReputation(address));
web3.sco_banAddress(address.getHostAddress() + "/64");
Assert.assertFalse(peerScoringManager.hasGoodReputation(address));
web3.sco_unbanAddress(address.getHostAddress() + "/64");
Assert.assertTrue(peerScoringManager.hasGoodReputation(address));
}
use of co.rsk.scoring.PeerScoringManager in project rskj by rsksmart.
the class Web3ImplScoringTest method addBannedAddressUsingIPV4AndMask.
@Test
public void addBannedAddressUsingIPV4AndMask() throws UnknownHostException {
PeerScoringManager peerScoringManager = createPeerScoringManager();
Web3Impl web3 = createWeb3(peerScoringManager);
InetAddress address = generateNonLocalIPAddressV4();
Assert.assertTrue(peerScoringManager.hasGoodReputation(address));
web3.sco_banAddress(address.getHostAddress() + "/8");
Assert.assertFalse(peerScoringManager.hasGoodReputation(address));
}
use of co.rsk.scoring.PeerScoringManager in project rskj by rsksmart.
the class Web3ImplScoringTest method addBannedAddressUsingIPV4.
@Test
public void addBannedAddressUsingIPV4() throws UnknownHostException {
PeerScoringManager peerScoringManager = createPeerScoringManager();
Web3Impl web3 = createWeb3(peerScoringManager);
InetAddress address = generateNonLocalIPAddressV4();
Assert.assertTrue(peerScoringManager.hasGoodReputation(address));
web3.sco_banAddress(address.getHostAddress());
Assert.assertFalse(peerScoringManager.hasGoodReputation(address));
}
use of co.rsk.scoring.PeerScoringManager in project rskj by rsksmart.
the class Web3ImplScoringTest method getEmptyBannedAddressList.
@Test
public void getEmptyBannedAddressList() {
PeerScoringManager peerScoringManager = createPeerScoringManager();
Web3Impl web3 = createWeb3(peerScoringManager);
String[] result = web3.sco_bannedAddresses();
Assert.assertNotNull(result);
Assert.assertEquals(0, result.length);
}
Aggregations