### Question:
HttpEventTask implements Runnable { protected static void parseParams(String queryString, CommandRequest request) { if (queryString == null || queryString.length() < 1) { return; } int offset = 0, pos = -1; queryString = removeAnchor(queryString); while (true) { offset = pos + 1; pos = queryString.indexOf('&', offset); if (offset == pos) { continue; } parseSingleParam(queryString.substring(offset, pos == -1 ? queryString.length() : pos), request); if (pos < 0) { break; } } } HttpEventTask(Socket socket); void close(); @Override void run(); static final String SERVER_ERROR_MESSAGE; static final String INVALID_COMMAND_MESSAGE; }### Answer:
@Test public void parseParams() { CommandRequest request; request = new CommandRequest(); HttpEventTask.parseParams("a=1&&b&=3&&c=4&a_+1=3_3%20&%E7%9A%84=test%E7%9A%84#mark", request); assertEquals(4, request.getParameters().size()); assertEquals("1", request.getParam("a")); assertNull(request.getParam("b")); assertEquals("4", request.getParam("c")); assertEquals("3_3 ", request.getParam("a_ 1")); assertEquals("test的", request.getParam("的")); request = new CommandRequest(); HttpEventTask.parseParams(null, request); assertEquals(0, request.getParameters().size()); request = new CommandRequest(); HttpEventTask.parseParams("", request); assertEquals(0, request.getParameters().size()); request = new CommandRequest(); HttpEventTask.parseParams("&&b&=3&", request); assertEquals(0, request.getParameters().size()); }