private static final long CONNECTION_TIMEOUT = 2000;\r
\r
private InetAddress startupAddress;\r
- private MockPlugin dummyPlugin;\r
+ private MockPlugin mockPlugin;\r
\r
/**\r
* @throws UnknownHostException\r
*/\r
@Test\r
public void testCommunication() throws Exception {\r
- dummyPlugin = new MockPlugin();\r
+ mockPlugin = new MockPlugin();\r
SwitchConnectionProviderImpl scpimpl = new SwitchConnectionProviderImpl();\r
+ scpimpl.setSwitchConnectionHandler(mockPlugin);\r
List<ConnectionConfiguration> configs = new ArrayList<>();\r
configs.add(new TestingConnConfigImpl(startupAddress, DEFAULT_PORT, DEFAULT_TLS_SUPPORT));\r
scpimpl.configure(configs);\r
- scpimpl.setSwitchConnectionHandler(dummyPlugin);\r
scpimpl.startup().get(CONNECTION_TIMEOUT, TimeUnit.MILLISECONDS);\r
+ \r
int amountOfCLients = 1;\r
- List<SimpleClient> clients = createAndStartClient(amountOfCLients);\r
- Thread.sleep(2000);\r
+ List<SimpleClient> clients = createAndStartClient(amountOfCLients, 24);\r
+ SimpleClient firstClient = clients.get(0);\r
+ firstClient.getAutomatedPartDone().get();\r
+ firstClient.getDataReceived().get();\r
+ disconnectClients(clients);\r
}\r
\r
/**\r
* @param amountOfCLients \r
+ * @param dataLimit TODO\r
* @return new clients up and running\r
* @throws InterruptedException\r
* @throws ExecutionException\r
*/\r
- private List<SimpleClient> createAndStartClient(int amountOfCLients)\r
+ private List<SimpleClient> createAndStartClient(int amountOfCLients, int dataLimit)\r
throws InterruptedException, ExecutionException {\r
List<SimpleClient> clientsHorde = new ArrayList<>();\r
for (int i = 0; i < amountOfCLients; i++) {\r
getClass().getResourceAsStream(OF_BINARY_MESSAGE_INPUT_TXT));\r
sc.setSecuredClient(false);\r
clientsHorde.add(sc);\r
+ sc.setDataLimit(dataLimit);\r
sc.start();\r
}\r
for (SimpleClient sc : clientsHorde) {\r