private void Connect() { for (int i = 0; i < Connections; i++) { ConnectorFactory connectorFactory = new ConnectorFactory(); connectorFactory.Uri = new Uri(webSockets ? "ws://localhost:5001/" : "tcp://127.0.0.1:7000"); ClientSample clientSample = new ClientSample(Iterations); ClientFactory clientFactory = new ClientFactory(); clientFactory.ConnectorFactory = connectorFactory; clientFactory.ChannelRegistry = clientSample; NetworkFactory networkFactory = new NetworkFactory(); networkFactory.Executable = clientSample; networkFactory.Add(clientFactory); Network network = networkFactory.Create(); tasks.Add(network.Execute(cancellationTokenSource.Token)); } }
private void Accept() { ListenerFactory listenerFactory = new ListenerFactory(); listenerFactory.Uri = new Uri(webSockets ? "http://localhost:5001/" : "tcp://127.0.0.1:7000"); ServerSample serverSample = new ServerSample(Iterations * Connections); serverSample.OnComplete += cancellationTokenSource.Cancel; ServerFactory serverFactory = new ServerFactory(); serverFactory.ListenerFactory = listenerFactory; serverFactory.ChannelRegistry = serverSample; NetworkFactory networkFactory = new NetworkFactory(); networkFactory.Executable = serverSample; networkFactory.Add(serverFactory); Network network = networkFactory.Create(); tasks.Add(network.Execute(cancellationTokenSource.Token)); }