Code cleanup
This commit is contained in:
@ -114,7 +114,7 @@ class Connection {
|
||||
|
||||
public static Connection sync(InternalContext ctx, InetAddress address, int port, MessageListener listener,
|
||||
long timeoutInSeconds) throws IOException {
|
||||
return new Connection(ctx, Mode.SYNC, listener, new Socket(address, port),
|
||||
return new Connection(ctx, SYNC, listener, new Socket(address, port),
|
||||
new HashSet<InventoryVector>(),
|
||||
new HashSet<InventoryVector>(),
|
||||
new NetworkAddress.Builder().ip(address).port(port).stream(1).build(),
|
||||
|
@ -171,6 +171,8 @@ public class DefaultNetworkHandler implements NetworkHandler, ContextHolder {
|
||||
case ACTIVE:
|
||||
active++;
|
||||
break;
|
||||
default:
|
||||
// nothing to do
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -52,30 +52,30 @@ public class NetworkHandlerTest {
|
||||
public static void setUp() {
|
||||
peerInventory = new TestInventory();
|
||||
peer = new BitmessageContext.Builder()
|
||||
.addressRepo(Mockito.mock(AddressRepository.class))
|
||||
.addressRepo(mock(AddressRepository.class))
|
||||
.inventory(peerInventory)
|
||||
.messageRepo(Mockito.mock(MessageRepository.class))
|
||||
.powRepo(Mockito.mock(ProofOfWorkRepository.class))
|
||||
.messageRepo(mock(MessageRepository.class))
|
||||
.powRepo(mock(ProofOfWorkRepository.class))
|
||||
.port(6001)
|
||||
.nodeRegistry(new TestNodeRegistry())
|
||||
.networkHandler(new DefaultNetworkHandler())
|
||||
.cryptography(new BouncyCryptography())
|
||||
.listener(Mockito.mock(BitmessageContext.Listener.class))
|
||||
.listener(mock(BitmessageContext.Listener.class))
|
||||
.build();
|
||||
peer.startup();
|
||||
|
||||
nodeInventory = new TestInventory();
|
||||
networkHandler = new DefaultNetworkHandler();
|
||||
node = new BitmessageContext.Builder()
|
||||
.addressRepo(Mockito.mock(AddressRepository.class))
|
||||
.addressRepo(mock(AddressRepository.class))
|
||||
.inventory(nodeInventory)
|
||||
.messageRepo(Mockito.mock(MessageRepository.class))
|
||||
.powRepo(Mockito.mock(ProofOfWorkRepository.class))
|
||||
.messageRepo(mock(MessageRepository.class))
|
||||
.powRepo(mock(ProofOfWorkRepository.class))
|
||||
.port(6002)
|
||||
.nodeRegistry(new TestNodeRegistry(localhost))
|
||||
.networkHandler(networkHandler)
|
||||
.cryptography(new BouncyCryptography())
|
||||
.listener(Mockito.mock(BitmessageContext.Listener.class))
|
||||
.listener(mock(BitmessageContext.Listener.class))
|
||||
.build();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user