Search in sources :

Example 1 with TransportConfig

use of io.scalecube.transport.TransportConfig in project scalecube by scalecube.

the class GossipProtocolTest method initTransports.

private List<Transport> initTransports(int count, int lostPercent, int meanDelay) {
    List<Transport> transports = new ArrayList<>(count);
    int startPort = TransportConfig.DEFAULT_PORT;
    for (int i = 0; i < count; i++) {
        TransportConfig transportConfig = TransportConfig.builder().useNetworkEmulator(true).port(startPort).portCount(1000).build();
        Transport transport = Transport.bindAwait(transportConfig);
        transport.networkEmulator().setDefaultLinkSettings(lostPercent, meanDelay);
        transports.add(transport);
        startPort = transport.address().port() + 1;
    }
    return transports;
}
Also used : ArrayList(java.util.ArrayList) Transport(io.scalecube.transport.Transport) TransportConfig(io.scalecube.transport.TransportConfig)

Aggregations

Transport (io.scalecube.transport.Transport)1 TransportConfig (io.scalecube.transport.TransportConfig)1 ArrayList (java.util.ArrayList)1