@Override
	public void execute(String commandName, BufferedReader reader, BufferedWriter writer)
			throws Py4JException, IOException {
		char subCommand = safeReadLine(reader).charAt(0);
		String returnCommand = null;
		if (subCommand == ARRAY_GET_SUB_COMMAND_NAME) {
			returnCommand = getArray(reader);
		} else if (subCommand == ARRAY_SET_SUB_COMMAND_NAME) {
			returnCommand = setArray(reader);
		} else if (subCommand == ARRAY_SLICE_SUB_COMMAND_NAME) {
			returnCommand = sliceArray(reader);
		} else if (subCommand == ARRAY_LEN_SUB_COMMAND_NAME) {
			returnCommand = lenArray(reader);
		} else if (subCommand == ARRAY_CREATE_SUB_COMMAND_NAME) {
			returnCommand = createArray(reader);
		} else {
			returnCommand = Protocol.getOutputErrorCommand("Unknown Array SubCommand Name: " + subCommand);
		}

		logger.finest("Returning command: " + returnCommand);
		writer.write(returnCommand);
		writer.flush();

	}
@Test
	public void testSlice() {
		int[] array3 = new int[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
		String[][] array4 = new String[][] { { "111", "222" }, { "aaa", "bbb" }, { "88", "99" } };
		gateway.putNewObject(array3);
		gateway.putNewObject(array4);
		String inputCommand = ArrayCommand.ARRAY_SLICE_SUB_COMMAND_NAME + "\n" + "o2" + "\ni1\ni5\ne\n";
		try {
			command.execute("a", new BufferedReader(new StringReader(inputCommand)), writer);
			assertEquals("!yto4\n", sWriter.toString());
			int[] intarray = (int[]) gateway.getObject("o4");
			assertEquals(2, intarray.length);
			assertEquals(6, intarray[1]);

			inputCommand = ArrayCommand.ARRAY_SLICE_SUB_COMMAND_NAME + "\n" + "o3" + "\ni2\ne\n";
			command.execute("a", new BufferedReader(new StringReader(inputCommand)), writer);
			assertEquals("!yto4\n!yto5\n", sWriter.toString());
			String[][] stringarray = (String[][]) gateway.getObject("o5");
			assertEquals(1, stringarray.length);
			assertEquals("99", stringarray[0][1]);
		} catch (Exception e) {
			e.printStackTrace();
			fail();
		}

	}