public static Map<String, Object> parseQuery(String uri) throws URISyntaxException {
        return parseQuery(uri, false);
    }
@Test
    public void testParseQueryLenient() throws Exception {
        assertThrows(URISyntaxException.class,
                () -> URISupport.parseQuery("password=secret&serviceName=somechat&", false, false),
                "Should have thrown a URISyntaxException");

        Map<String, Object> map = URISupport.parseQuery("password=secret&serviceName=somechat&", false, true);
        assertEquals(2, map.size());
        assertEquals("secret", map.get("password"));
        assertEquals("somechat", map.get("serviceName"));
    }