ThriftBinaryProtocol extends AbstractThriftBinaryProtocol { @Override public TSet readSetBegin() throws TException { TSet set = super.readSetBegin(); checkContainerSize(set.size); checkContainerElemType(set.elemType); return set; } 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 testCheckSetContainerSizeInvalid() throws TException { TTransport transport = getMockTransport(-1); replay(transport); ThriftBinaryProtocol protocol = new ThriftBinaryProtocol(transport); protocol.readSetBegin(); verify(transport); }