@Test public void wrapOnce() { ConnectionRequest wrapped = ClientConnectionRequestFactory .wrap(noop); assertTrue(wrapped instanceof Wrapped); }
static ConnectionRequest wrap(ConnectionRequest orig) { if (orig instanceof Wrapped) throw new IllegalArgumentException(); return (ConnectionRequest) Proxy.newProxyInstance( ClientConnectionRequestFactory.class.getClassLoader(), interfaces, new Handler(orig)); }
ClientConnectionRequestFactory { static ConnectionRequest wrap(ConnectionRequest orig) { if (orig instanceof Wrapped) throw new IllegalArgumentException(); return (ConnectionRequest) Proxy.newProxyInstance( ClientConnectionRequestFactory.class.getClassLoader(), interfaces, new Handler(orig)); } }
ClientConnectionRequestFactory { static ConnectionRequest wrap(ConnectionRequest orig) { if (orig instanceof Wrapped) throw new IllegalArgumentException(); return (ConnectionRequest) Proxy.newProxyInstance( ClientConnectionRequestFactory.class.getClassLoader(), interfaces, new Handler(orig)); }  }
ClientConnectionRequestFactory { static ConnectionRequest wrap(ConnectionRequest orig) { if (orig instanceof Wrapped) throw new IllegalArgumentException(); return (ConnectionRequest) Proxy.newProxyInstance( ClientConnectionRequestFactory.class.getClassLoader(), interfaces, new Handler(orig)); }   }
ClientConnectionRequestFactory { static ConnectionRequest wrap(ConnectionRequest orig) { if (orig instanceof Wrapped) throw new IllegalArgumentException(); return (ConnectionRequest) Proxy.newProxyInstance( ClientConnectionRequestFactory.class.getClassLoader(), interfaces, new Handler(orig)); }    }