@Override
    public String generateURIForCopy() {
        checkState();
        if (this.addr == null || this.addr.equals(new Endpoint(Utils.IP_ANY, 0))) {
            LOG.error("Address is not specified");
            return null;
        }
        if (this.readerId == 0) {
            final SnapshotFileReader reader = new SnapshotFileReader(this.path, this.snapshotThrottle);
            reader.setMetaTable(this.metaTable);
            if (!reader.open()) {
                LOG.error("Open snapshot {} failed.", this.path);
                return null;
            }
            this.readerId = FileService.getInstance().addReader(reader);
            if (this.readerId < 0) {
                LOG.error("Fail to add reader to file_service.");
                return null;
            }
        }

        return String.format(REMOTE_SNAPSHOT_URI_SCHEME + "%s/%d", this.addr, this.readerId);
    }
@Test
    public void testGenerateUriForCopy() throws Exception {
        final String uri = this.reader.generateURIForCopy();
        assertNotNull(uri);
        assertTrue(uri.startsWith("remote://localhost:8081/"));
        final long readerId = Long.valueOf(uri.substring("remote://localhost:8081/".length()));
        assertTrue(FileService.getInstance().removeReader(readerId));
    }