sendbuf, Connection.TPRECVONLY);
long revent = 0;
log.info("Started conversation");
for (int i = 0; i < interationCount; i++) {
try {
Buffer result = cd.tprecv(0);
fail("Did not get sendonly event");
} catch (ResponseException e) {
assertTrue(e.getTperrno() == Connection.TPEEVENT);
assertTrue(e.getEvent() == Connection.TPEV_SENDONLY);
Buffer rcvbuf = e.getReceived();
String expectedResult = ("hi" + i);
assertTrue(strcmp(expectedResult, rcvbuf) == 0);
sendbuf.setByteArray(("yo" + i).getBytes());
// btlogger((char*) "test_conversation:%s:", sendbuf);
int result = cd.tpsend(sendbuf, Connection.TPRECVONLY);
assertTrue(result != -1);
}
}
log.info("Conversed");
try {
cd.tprecv(0);
fail("Expected event");
} catch (ResponseException e) {
assertTrue(e.getTperrno() == Connection.TPEEVENT);
Buffer rcvbuf = e.getReceived();
String expectedResult = ("hi" + interationCount);
log.info("Expected: " + expectedResult + " Received: "
+ new String(((X_OCTET) rcvbuf).getByteArray()));
assertTrue(strcmp(expectedResult, rcvbuf) == 0);
}