@Test
public void testInvokeObjectMethod() throws Throwable {

    final List<String> called = new ArrayList<>();
    ServiceInvocationHandler sih = new ServiceInvocationHandler("hi", String.class) {
        @Override
        public boolean equals(Object obj) {
            called.add("equals");
            return super.equals(obj);
        }
        @Override
        public int hashCode() {
            called.add("hashCode");
            return super.hashCode();
        }
        @Override
        public String toString() {
            called.add("toString");
            return "somestring";
        }
    };
    Object proxy = Proxy.newProxyInstance(
            getClass().getClassLoader(), new Class[] {Runnable.class}, sih);
    assertEquals(true,
            sih.invoke(null, OBJECT_METHODS.get("equals"), new Object[] {proxy}));
    assertEquals(System.identityHashCode(sih),
            sih.invoke(null, OBJECT_METHODS.get("hashCode"), new Object[] {}));
    assertEquals("somestring",
            sih.invoke(null, OBJECT_METHODS.get("toString"), new Object[] {}));
    assertEquals(Arrays.asList("equals", "hashCode", "toString"), called);
}