public ClientNetwork(String nodeUrl, BasicHttpClientSession session, boolean delayedStart) throws IOException { client = new Client(nodeUrl, CLIMain.getPrivateKey(), session, delayedStart); if (client == null) throw new IOException("failed to connect to to the universa network"); reporter.verbose("Read Universa network configuration: " + client.size() + " nodes"); reporter.message("Network version: " + client.getVersion()); }
public ClientNetwork(BasicHttpClientSession session, boolean delayedStart) throws IOException { for (int i = 1; i < 10; i++) { try { client = new Client("http://node-" + Do.randomIntInRange(1, 10) + "-com.universa.io:8080", CLIMain.getPrivateKey(), session, delayedStart); break; } catch (IOException e) { reporter.warning("failed to read network from node " + i); } } if (client == null) throw new IOException("failed to connect to to the universa network"); reporter.verbose("Read Universa network configuration: " + client.size() + " nodes"); reporter.message("Network version: " + client.getVersion()); }
static Main createMain(String name,boolean nolog) throws InterruptedException { String path = new File("src/test_node_config_v2/"+name).getAbsolutePath(); System.out.println(path); String[] args = new String[]{"--test", "--config", path, nolog ? "--nolog" : ""}; Main main = new Main(args); try { main.config.addTransactionUnitsIssuerKeyData(new KeyAddress("Zau3tT8YtDkj3UDBSznrWHAjbhhU4SXsfQLWDFsv5vw24TLn6s")); } catch (KeyAddress.IllegalAddressException e) { e.printStackTrace(); } try { //main.config.getKeysWhiteList().add(CLIMain.getPrivateKey().getPublicKey()); main.config.getAddressesWhiteList().add(new KeyAddress(CLIMain.getPrivateKey().getPublicKey(), 0, true)); } catch (IOException e) { e.printStackTrace(); } //main.config.getKeysWhiteList().add(main.config.getUIssuerKey()); main.waitReady(); return main; }
@Test public void registerManyContractsFromVariousNodes() throws Exception { ClientNetwork clientNetwork1 = new ClientNetwork("http://localhost:8080", CLIMain.getPrivateKey(),null); ClientNetwork clientNetwork2 = new ClientNetwork("http://localhost:6002", CLIMain.getPrivateKey(), null); ClientNetwork clientNetwork3 = new ClientNetwork("http://localhost:6004", CLIMain.getPrivateKey(), null);