Eliminate BootstrapNodes#DIGITAL_OCEAN_1_DEV

Instead of including testing-related bootstrap nodes in the
BootstrapNodes class, this change introduces a Node#withPort method that
allows for obtaining a copy of an existing bootstrap node (e.g.
DIGITAL_OCEAN_1) with a modified port value.

This approach to `with*` methods allows for convenient customization of
value types without sacrificing immutability. See [1] for details.

[1]: http://blog.joda.org/2014/03/valjos-value-java-objects.html
This commit is contained in:
Chris Beams 2014-11-10 13:52:12 +01:00
parent 5ab837658b
commit adfd8b2ac4
No known key found for this signature in database
GPG key ID: 3D214F8F5BC5ED73
3 changed files with 8 additions and 2 deletions

View file

@ -89,7 +89,7 @@ public class TomP2PTests {
// Typically you run the bootstrap node on localhost to test direct connection.
// If you have a setup where you are not behind a router you can also use a WAN bootstrap node.
private static final Node BOOTSTRAP_NODE = (FORCED_CONNECTION_TYPE == ConnectionType.DIRECT) ?
BootstrapNodes.LOCALHOST : BootstrapNodes.DIGITAL_OCEAN_1_DEV;
BootstrapNodes.LOCALHOST : BootstrapNodes.DIGITAL_OCEAN_1.withPort(7367);
private static final PeerAddress BOOTSTRAP_NODE_ADDRESS;