@Test public void testAwsLatency() { NetworkLatency nl = new NetworkLatency.AwsRegionNetworkLatency(); Geo geoInfo = new GeoAWS(); Random rd = new Random(); for (String r1 : NetworkLatency.AwsRegionNetworkLatency.cities()) { NodeBuilder b1 = new NodeBuilder.NodeBuilderWithCity(Collections.singletonList(r1), geoInfo); Node n1 = new Node(rd, b1); for (String r2 : NetworkLatency.AwsRegionNetworkLatency.cities()) { NodeBuilder b2 = new NodeBuilder.NodeBuilderWithCity(Collections.singletonList(r2), geoInfo); Node n2 = new Node(rd, b2); int l = nl.getLatency(n1, n2, 0); if (r1.equals(r2)) { Assert.assertEquals(1, l); } else { Assert.assertTrue(r1 + " -> " + r2 + ": " + l, l > 1); } } } }
protected int getLatency(Node from, Node to, int delta) { if (from == to) { return 1; } int base = from.extraLatency + to.extraLatency; base += getExtendedLatency(from, to, delta); return Math.max(1, base); }
NetworkLatency { protected int getLatency(Node from, Node to, int delta) { if (from == to) { return 1; } int base = from.extraLatency + to.extraLatency; base += getExtendedLatency(from, to, delta); return Math.max(1, base); } }
NetworkLatency { protected int getLatency(Node from, Node to, int delta) { if (from == to) { return 1; } int base = from.extraLatency + to.extraLatency; base += getExtendedLatency(from, to, delta); return Math.max(1, base); }  }
NetworkLatency { protected int getLatency(Node from, Node to, int delta) { if (from == to) { return 1; } int base = from.extraLatency + to.extraLatency; base += getExtendedLatency(from, to, delta); return Math.max(1, base); }  @Override String toString(); static MeasuredNetworkLatency estimateLatency(Network net, final int rounds); static MeasuredNetworkLatency estimateP2PLatency(P2PNetwork<?> net, final int rounds); static MeasuredNetworkLatency estimateLatency(
      Network net, PeerGetter pg, final int rounds); }
NetworkLatency { protected int getLatency(Node from, Node to, int delta) { if (from == to) { return 1; } int base = from.extraLatency + to.extraLatency; base += getExtendedLatency(from, to, delta); return Math.max(1, base); }  @Override String toString(); static MeasuredNetworkLatency estimateLatency(Network net, final int rounds); static MeasuredNetworkLatency estimateP2PLatency(P2PNetwork<?> net, final int rounds); static MeasuredNetworkLatency estimateLatency(
      Network net, PeerGetter pg, final int rounds);  }