Fix cast for java-8 in MemoryStoreConnection