ThriftBinaryProtocol extends AbstractThriftBinaryProtocol { @Override public TList readListBegin() throws TException { TList list = super.readListBegin(); checkContainerSize(list.size); checkContainerElemType(list.elemType); return list; } ThriftBinaryProtocol(TTransport trans);   ThriftBinaryProtocol(TTransport trans, long stringLengthLimit, long containerLengthLimit); static void checkContainerElemType(byte type); @Override TMap readMapBegin(); @Override TList readListBegin(); @Override TSet readSetBegin();  }
@Test(expected=TProtocolException.class) public void testCheckListContainerSizeInvalid() throws TException { TTransport transport = getMockTransport(-1); replay(transport); ThriftBinaryProtocol protocol = new ThriftBinaryProtocol(transport); protocol.readListBegin(); verify(transport); }