List<IH2HNode> nodes = new ArrayList<IH2HNode>(numberOfNodes);
// TODO the initial peer has an autostart, whereas the others dont
// create initial peer
IH2HNode initial = H2HNode.createNode(NetworkConfiguration.create("initial"), FileConfiguration.createDefault());
initial.connect();
initial.getFileManager().configureAutostart(false);
initial.getUserManager().configureAutostart(false);
nodes.add(initial);
try {
InetAddress bootstrapAddress = InetAddress.getLocalHost();
for (int i = 1; i < numberOfNodes; i++) {
IH2HNode node = H2HNode.createNode(NetworkConfiguration.create("node " + i, bootstrapAddress),
FileConfiguration.createDefault());
node.connect();
node.getFileManager().configureAutostart(false);
node.getUserManager().configureAutostart(false);
nodes.add(node);
}
} catch (UnknownHostException e) {
// should not happen
}