Skip to content

Commit eb6af6e

Browse files
committed
Merge branch 'reconnect' of https://github.com/ningning-chen/trex-java-sdk into reconnect
2 parents 7a7e594 + cb6604d commit eb6af6e

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/main/java/com/cisco/trex/stateless/TRexTransport.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,21 @@ public synchronized String sendJson(String json) {
164164
msg = zmqSocket.recv();
165165
}
166166

167+
if (msg == null) {
168+
zmqSocket.connect(this.connectionString);
169+
try {
170+
zmqSocket.send(compressed);
171+
} catch (ZMQException e) {
172+
throw new IllegalStateException(
173+
"Did not get any response from server "
174+
+ getHost()
175+
+ " within timeout "
176+
+ zmqSocket.getReceiveTimeOut(),
177+
e);
178+
}
179+
msg = zmqSocket.recv();
180+
}
181+
167182
String response = this.dataCompressor.decompressBytesToString(msg);
168183
LOGGER.debug("JSON Resp: {}", response);
169184
return response;

0 commit comments

Comments
 (0)