@Test
public void testGetSerializedRequest()
{

  String id = "SubscriberId";
  String down_type = "SubscriberId/StreamType";
  String upstream_id = "PublisherId";
  int mask = 7;
  ArrayList<Integer> partitions = new ArrayList<>();
  partitions.add(5);
  long startingWindowId = 0xcafebabe00000078L;
  byte[] serial = getSerializedRequest(null, id, down_type, upstream_id, mask, partitions, startingWindowId, 32 * 1024);
  SubscribeRequestTuple tuple = (SubscribeRequestTuple)Tuple.getTuple(serial, 0, serial.length);
  assertEquals(tuple.getIdentifier(), id, "Identifier");
  assertEquals(tuple.getStreamType(), down_type, "UpstreamType");
  assertEquals(tuple.getUpstreamIdentifier(), upstream_id, "UpstreamId");
  assertEquals(tuple.getMask(), mask, "Mask");
  assertEquals(tuple.getBufferSize(), 32 * 1024, "BufferSize");
  int[] parts = tuple.getPartitions();
  assertNotNull(parts);
  assertEquals(parts.length, 1);
  assertEquals(parts[0], 5);
  assertEquals((long)tuple.getBaseSeconds() << 32 | tuple.getWindowId(), startingWindowId, "Window");
  serial = getSerializedRequest(null, id, down_type, upstream_id, 0, null, startingWindowId, 32 * 1024);
  tuple = (SubscribeRequestTuple)Tuple.getTuple(serial, 0, serial.length);
  assertEquals(tuple.getIdentifier(), id, "Identifier");
  assertEquals(tuple.getStreamType(), down_type, "UpstreamType");
  assertEquals(tuple.getUpstreamIdentifier(), upstream_id, "UpstreamId");
  assertEquals(tuple.getMask(), 0, "Mask");
  assertEquals(tuple.getBufferSize(), 32 * 1024, "BufferSize");
  assertNull(tuple.getPartitions());
  assertEquals((long)tuple.getBaseSeconds() << 32 | tuple.getWindowId(), startingWindowId, "Window");
}