try {
log.info("send first message");
String toSend = "test_call_ttl_1";
int sendlen = toSend.length() + 1;
X_OCTET sendbuf = (X_OCTET) connection.tpalloc("X_OCTET", null,
sendlen);
sendbuf.setByteArray(toSend.getBytes());
Response rcvbuf = connection.tpcall(RunServer.getServiceNameTTL(),
sendbuf, 0);
fail("Expected TPETIME, got a buffer with rval: "
+ rcvbuf.getRval());
} catch (ConnectionException e) {
if (e.getTperrno() != Connection.TPETIME) {
fail("Expected TPETIME, got: " + e.getTperrno());
}
}
try {
log.info("send second message");
String toSend = "test_call_ttl_2";
int sendlen = toSend.length() + 1;
X_OCTET sendbuf = (X_OCTET) connection.tpalloc("X_OCTET", null,
sendlen);
sendbuf.setByteArray(toSend.getBytes());
Response rcvbuf = connection.tpcall(RunServer.getServiceNameTTL(),
sendbuf, 0);
fail("Expected TPETIME, got a buffer with rval: "
+ rcvbuf.getRval());
} catch (ConnectionException e) {
if (e.getTperrno() != Connection.TPETIME) {
fail("Expected TPETIME, got: " + e.getTperrno());
}
}
try {
log.info("wait 30 second for first message process");
Thread.sleep(30 * 1000);
log.info("wait done");
} catch (Exception e) {
log.warn("sleep exception " + e);
}
String toSend = "counter";
int sendlen = toSend.length() + 1;
X_OCTET sendbuf = (X_OCTET) connection
.tpalloc("X_OCTET", null, sendlen);
sendbuf.setByteArray(toSend.getBytes());
Response rcvbuf = connection.tpcall(RunServer.getServiceNameTTL(),
sendbuf, 0);
assertTrue(rcvbuf != null);