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.getServiceNametpcallXOctet(), sendbuf, 0);
assertTrue(rcvbuf != null);
assertTrue(rcvbuf.getBuffer() != null);
assertTrue(((X_OCTET) rcvbuf.getBuffer()).getByteArray() != null);
byte[] received = ((X_OCTET) rcvbuf.getBuffer()).getByteArray();
byte[] expected = new byte[received.length];
System.arraycopy("tpcall_x_octet".getBytes(), 0, expected, 0,
"tpcall_x_octet".getBytes().length);
assertTrue(Arrays.equals(received, expected));
}