aboutsummaryrefslogtreecommitdiffstats
path: root/core/core-infrastructure
diff options
context:
space:
mode:
Diffstat (limited to 'core/core-infrastructure')
-rw-r--r--core/core-infrastructure/src/test/java/org/onap/policy/apex/core/infrastructure/messaging/EndToEndStringMessagingTest.java25
1 files changed, 16 insertions, 9 deletions
diff --git a/core/core-infrastructure/src/test/java/org/onap/policy/apex/core/infrastructure/messaging/EndToEndStringMessagingTest.java b/core/core-infrastructure/src/test/java/org/onap/policy/apex/core/infrastructure/messaging/EndToEndStringMessagingTest.java
index e18c327c0..21c5ee984 100644
--- a/core/core-infrastructure/src/test/java/org/onap/policy/apex/core/infrastructure/messaging/EndToEndStringMessagingTest.java
+++ b/core/core-infrastructure/src/test/java/org/onap/policy/apex/core/infrastructure/messaging/EndToEndStringMessagingTest.java
@@ -52,18 +52,25 @@ public class EndToEndStringMessagingTest {
assertNotNull(server);
server.start(new WSStringServerMessageListener());
- client = new WSStringMessageClient("localhost", 44441);
- assertNotNull(client);
- client.start(new WSStringClientMessageListener());
+ try {
+ client = new WSStringMessageClient("localhost", 44441);
+ assertNotNull(client);
+ client.start(new WSStringClientMessageListener());
- client.sendString("Hello, client here");
+ client.sendString("Hello, client here");
- while (!finished) {
- ThreadUtilities.sleep(50);
- }
- client.stop();
+ while (!finished) {
+ ThreadUtilities.sleep(50);
+ }
+ } finally {
+ if (client != null) {
+ client.stop();
+ }
+ if (server != null) {
+ server.stop();
+ }
- server.stop();
+ }
logger.debug("end to end messaging test finished");
}