ThriftBinaryProtocol extends AbstractThriftBinaryProtocol { @Override public TMap readMapBegin() throws TException { TMap map = super.readMapBegin(); checkContainerSize(map.size); checkContainerElemType(map.keyType); checkContainerElemType(map.valueType); return map; } 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 testCheckMapContainerSizeInvalid() throws TException { TTransport transport = getMockMapTransport(-1); replay(transport); ThriftBinaryProtocol protocol = new ThriftBinaryProtocol(transport); protocol.readMapBegin(); verify(transport); }