OnJava8-Examples/network/tests/MultiTest.java

28 lines
758 B
Java
Raw Normal View History

// network/tests/MultiTest.java
2016-12-30 17:23:13 -08:00
// (c)2017 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose.
2016-09-23 13:23:35 -06:00
// Visit http://OnJava8.com for more book information.
package network;
import java.net.*;
2016-12-21 11:06:49 -08:00
import java.util.concurrent.*;
import org.junit.jupiter.api.*;
public class MultiTest {
@BeforeAll
static void startMsg() {
System.out.println(">>> MultiClientTest");
}
@Test
void multiTest() throws Exception {
final int MAX_THREADS = 40;
new MultiServer();
InetAddress address = InetAddress.getByName(null);
while(true) {
if(SimpleClient2.threadCount() < MAX_THREADS)
new SimpleClient2(address);
2016-12-21 11:06:49 -08:00
TimeUnit.MILLISECONDS.sleep(100);
}
// No exceptions mean success
}
}