@Override
	public void execute(String commandName, BufferedReader reader, BufferedWriter writer)
			throws Py4JException, IOException {
		char subCommand = safeReadLine(reader).charAt(0);
		String returnCommand = null;

		if (subCommand == GET_UNKNOWN_SUB_COMMAND_NAME) {
			returnCommand = getUnknownMember(reader);
		} else if (subCommand == GET_JAVA_LANG_CLASS_SUB_COMMAND_NAME) {
			returnCommand = getJavaLangClass(reader);
		} else {
			returnCommand = getMember(reader);
		}

		logger.finest("Returning command: " + returnCommand);
		writer.write(returnCommand);
		writer.flush();
	}
@Test
	public void testMember() {
		String inputCommand1 = ReflectionCommand.GET_MEMBER_SUB_COMMAND_NAME + "\n" + "java.lang.String\n" + "valueOf"
				+ "\ne\n";
		String inputCommand2 = ReflectionCommand.GET_MEMBER_SUB_COMMAND_NAME + "\n" + "java.lang.String\n" + "length"
				+ "\ne\n";
		String inputCommand3 = ReflectionCommand.GET_MEMBER_SUB_COMMAND_NAME + "\n" + "p1.Cat\n" + "meow" + "\ne\n";
		String inputCommand4 = ReflectionCommand.GET_MEMBER_SUB_COMMAND_NAME + "\n" + "p1.Cat\n" + "meow20" + "\ne\n"; // does not exist
		String inputCommand5 = ReflectionCommand.GET_MEMBER_SUB_COMMAND_NAME + "\n" + "p1.Cat\n" + "meow15" + "\ne\n";
		String inputCommand6 = ReflectionCommand.GET_MEMBER_SUB_COMMAND_NAME + "\n" + "p1.Cat\n" + "CONSTANT" + "\ne\n";
		try {
			command.execute("r", new BufferedReader(new StringReader(inputCommand1)), writer);
			assertEquals("!ym\n", sWriter.toString());
			command.execute("r", new BufferedReader(new StringReader(inputCommand2)), writer);
			assertEquals("!ym\n!xsTrying to access a non-static member from a " + "static context.\n",
					sWriter.toString());
			command.execute("r", new BufferedReader(new StringReader(inputCommand3)), writer);
			assertEquals(
					"!ym\n!xsTrying to access a non-static member from a static context.\n!xsTrying to access a non-static member from a static context.\n",
					sWriter.toString());
			command.execute("r", new BufferedReader(new StringReader(inputCommand4)), writer);
			assertEquals(
					"!ym\n!xsTrying to access a non-static member from a static context.\n!xsTrying to access a non-static member from a static context.\n!x\n",
					sWriter.toString());
			command.execute("r", new BufferedReader(new StringReader(inputCommand5)), writer);
			assertEquals(
					"!ym\n!xsTrying to access a non-static member from a static context.\n!xsTrying to access a non-static member from a static context.\n!x\n!ym\n",
					sWriter.toString());
			command.execute("r", new BufferedReader(new StringReader(inputCommand6)), writer);
			assertEquals(
					"!ym\n!xsTrying to access a non-static member from a static context.\n!xsTrying to access a non-static member from a static context.\n!x\n!ym\n!ysSalut!\n",
					sWriter.toString());
		} catch (Exception e) {
			e.printStackTrace();
			fail();
		}

	}