Examples of RemoteMethodControl


Examples of net.jini.core.constraint.RemoteMethodControl

    // inherit javadoc
    public void run() throws Exception {
        try {
            BasicInvocationHandler handler;
            RemoteMethodControl proxy, newProxy;
            FakeMethodConstraints clientConstraints = new FakeMethodConstraints(
                new InvocationConstraint[] {Integrity.YES});
            FakeMethodConstraints serverConstraints = new FakeMethodConstraints(
                new InvocationConstraint[] {Confidentiality.YES});
            FakeObjectEndpoint oe = new FakeObjectEndpoint();

            logger.log(Level.FINE,"=================================");
            logger.log(Level.FINE,"test case 1: setConstraints(null)");
            logger.log(Level.FINE,"");

            handler = new BasicInvocationHandler(
                new BasicInvocationHandler(oe,serverConstraints),
                clientConstraints);
            proxy = (RemoteMethodControl) Proxy.newProxyInstance(
                this.getClass().getClassLoader(),
                new Class[] {RemoteMethodControl.class}, handler);

            newProxy =
                (RemoteMethodControl) proxy.setConstraints(null);
            handler =
                (BasicInvocationHandler) Proxy.getInvocationHandler(newProxy);
            assertion(handler.getObjectEndpoint() == oe);
            assertion(handler.getClientConstraints() == null);
            assertion(handler.getServerConstraints() == serverConstraints);
            assertion(proxy.getConstraints() == clientConstraints);
            assertion(newProxy.getConstraints() == null);

            logger.log(Level.FINE,"=================================");
            logger.log(Level.FINE,"test case 2: "
                + "setConstraints(MethodConstraints)");
            logger.log(Level.FINE,"");

            handler = new BasicInvocationHandler(
                new BasicInvocationHandler(oe,serverConstraints),
                null);
            proxy = (RemoteMethodControl) Proxy.newProxyInstance(
                this.getClass().getClassLoader(),
                new Class[] {RemoteMethodControl.class}, handler);

            newProxy =
                (RemoteMethodControl) proxy.setConstraints(clientConstraints);
            handler =
                (BasicInvocationHandler) Proxy.getInvocationHandler(newProxy);
            assertion(handler.getObjectEndpoint() == oe);
            assertion(handler.getClientConstraints() == clientConstraints);
            assertion(handler.getServerConstraints() == serverConstraints);
            assertion(proxy.getConstraints() == null);
            assertion(newProxy.getConstraints() == clientConstraints);

            logger.log(Level.FINE,"=================================");
            logger.log(Level.FINE,"test case 3: bad proxy arg");
            logger.log(Level.FINE,"");
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.