import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
+import java.util.Arrays;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.stream.IntStream;
.toArray(size -> new TestClient[size]);
Thread.sleep(10000);
+ Arrays
+ .stream(testClients)
+ .forEach(testClient -> testClient.running = false);
Flux
.fromArray(chatRooms)
@Override
public void run()
{
- for (int i = 0; i < 100; i++)
+ for (int i = 0; running; i++)
{
String message = "Message #" + i;
for (ChatRoomInfoTo chatRoom : chatRooms)
private final ChatRoomInfoTo[] chatRooms;
private final User user;
+ volatile boolean running = true;
+
TestClient(Integer port, ChatRoomInfoTo[] chatRooms, String username)
{