public Object invoke(Object obj, Object[] arguments) {
		Object returnObject = null;

		try {
			Object[] newArguments = arguments;

			if (converters != null) {
				int size = arguments.length;
				newArguments = new Object[size];
				for (int i = 0; i < size; i++) {
					newArguments[i] = converters.get(i).convert(arguments[i]);
				}
			}
			if (method != null) {
				AccessController.doPrivileged(new PrivilegedAction<Object>() {
					public Object run() {
						ReflectionShim.trySetAccessible(method);
						return null;
					}
				});
				returnObject = method.invoke(obj, newArguments);
			} else if (constructor != null) {
				ReflectionShim.trySetAccessible(constructor);
				returnObject = constructor.newInstance(newArguments);
			}
		} catch (InvocationTargetException ie) {
			logger.log(Level.WARNING, "Exception occurred in client code.", ie);
			throw new Py4JJavaException(ie.getCause());
		} catch (Exception e) {
			logger.log(Level.WARNING, "Could not invoke method or received an exception while invoking.", e);
			throw new Py4JException(e);
		}

		return returnObject;
	}
@Test
	public void testInvoke() {
		Cat cat = new Cat();
		try {
			Method m = Cat.class.getMethod("meow10", float.class);
			MethodInvoker invoker = new MethodInvoker(m,
					new TypeConverter[] { new TypeConverter(TypeConverter.DOUBLE_TO_FLOAT) }, 0);
			invoker.invoke(cat, new Object[] { new Double(2.0) });

			m = Cat.class.getMethod("meow11", new Class[0]);
			invoker = new MethodInvoker(m, null, 0);
			invoker.invoke(cat, new Object[0]);

			m = Cat.class.getMethod("meow10", float.class);
			invoker = new MethodInvoker(m, null, 0);
			invoker.invoke(cat, new Object[] { new Float(1.1f) });
		} catch (Exception e) {
			e.printStackTrace();
			fail();
		}
	}