ResetWindowTuple extends Tuple { public static byte[] getSerializedTuple(int baseSeconds, int windowWidth) { int size = 1; int bits = 32 - Integer.numberOfLeadingZeros(baseSeconds); size += bits / 7 + 1; bits = 32 - Integer.numberOfLeadingZeros(windowWidth); size += bits / 7 + 1; byte[] buffer = new byte[size]; size = 0; buffer[size++] = MessageType.RESET_WINDOW_VALUE; size = VarInt.write(baseSeconds, buffer, size); VarInt.write(windowWidth, buffer, size); return buffer; } ResetWindowTuple(byte[] buffer, int offset, int length); @Override MessageType getType(); @Override int getBaseSeconds(); @Override int getWindowWidth(); static byte[] getSerializedTuple(int baseSeconds, int windowWidth);  }
@Test public void testGetSerializedTuple() { byte[] serial = ResetWindowTuple.getSerializedTuple(0x7afebabe, 500); ResetWindowTuple tuple = (ResetWindowTuple)Tuple.getTuple(serial, 0, serial.length); assertEquals(tuple.getBaseSeconds(), 0x7afebabe, "base seconds"); assertEquals(tuple.getWindowWidth(), 500, "window width"); }