public class BytesTest extends TestCase {
public void test() {
MailboxFactory mailboxFactory = JAMailboxFactory.newMailboxFactory(1);
try {
JAFuture future = new JAFuture();
JidFactories factory = new JidFactories();
factory.initialize(mailboxFactory.createMailbox());
Actor bytes1 = BytesJidFactory.fac.newActor(factory.getMailbox(), factory);
Actor bytes2 = (new CopyJID()).send(future, bytes1);
(new SetBytes(new byte[3])).send(future, bytes2);
Actor bytes3 = (new CopyJID()).send(future, bytes2);
int sl = GetSerializedLength.req.send(future, bytes1);
assertEquals(4, sl);
sl = GetSerializedLength.req.send(future, bytes2);
assertEquals(7, sl);
sl = GetSerializedLength.req.send(future, bytes3);
assertEquals(7, sl);
assertNull(GetBytes.req.send(future, bytes1));
assertEquals(3, GetBytes.req.send(future, bytes2).length);
assertEquals(3, GetBytes.req.send(future, bytes3).length);
Actor jidJid1 = ActorJidFactory.fac.newActor(factory.getMailbox(), factory);
SetActor sjvbs = new SetActor(JidFactories.BYTES_JID_TYPE);
sjvbs.send(future, jidJid1);
Actor rpa = (new ResolvePathname("0")).send(future, jidJid1);
assertNull(GetBytes.req.send(future, rpa));
assertTrue((new MakeBytes(new byte[0])).send(future, rpa));