Package net.jini.jeri

Examples of net.jini.jeri.ServerEndpoint


     public void run() throws Exception {
        //obtain a ServerEndpoint and verify that the addListenEndpoint
        //is called on the ListenContext specified and the expected number
        //of ListenEndpoints are passed in to the context.
        SETContext lc = new SETContext();
        ServerEndpoint se = getServerEndpoint();
        Endpoint e = se.enumerateListenEndpoints(lc);
        boolean exceptionThrown = false;
        log.finest("Call to enumerateListeEndpoints returns " + e);
        Integer expected = (Integer) getConfigObject(Integer.class,
            "expectedListenEndpoints");
        ArrayList endpoints = lc.getEndpoints();
View Full Code Here


*/
public class ServerAbortTest extends AbstractMuxTest {

    public void run() throws Exception {
        //Setup server side mux connection
        ServerEndpoint se = getServerEndpoint();
        Redirector rd = new Redirector(InetAddress.getLocalHost()
            .getHostAddress(), getPort(), getPort() + 1);
        Thread t = new Thread(rd);
        t.start();
        ((TestServerEndpoint) se).redirect(getPort() + 1);
View Full Code Here

        Remote exportee = new BJETestServiceImpl();
        int listenPort =
            config.getIntConfigVal("com.sun.jini.test.spec.jeri.basicjeriexporter"
            + ".ExportTest_SameIDSameSE.listenPort", 9090);
        log.finest("Test creating a ServerEnpoint on port: " + listenPort);
        ServerEndpoint ep = TcpServerEndpoint.getInstance(listenPort);
        Uuid id = UuidFactory.generate();
        //Create a BasicJeriExport instance using the ServerEndoint and Uuid
        //instances created above
        log.finest("Creating BasicJeriExporter with " + ep + ", EnableDGC=true"
            + " , keepAlive=true, " + id);
View Full Code Here

*/
public class ServerFlowControlTest extends AbstractMuxTest {

    public void run() throws Exception {
        //Setup server side mux connection
        ServerEndpoint se = getServerEndpoint();
        Redirector rd = new Redirector(InetAddress.getLocalHost()
            .getHostAddress(), getPort(), getPort() + 1);
        Thread t = new Thread(rd);
        t.start();
        ((TestServerEndpoint) se).redirect(getPort() + 1);
View Full Code Here

import java.util.Iterator;

public class CheckConstraintsTest extends AbstractEndpointTest {

    public void run() throws Exception {
        ServerEndpoint ep = null;
        //Obtain endpoint
        ep = getServerEndpoint();
        if (!(ep instanceof ServerCapabilities)){
            throw new TestException(ep + " does not implement"
                + " ServerCapabilities.");
View Full Code Here

public class NewRequestConflictingConstraintsTest extends AbstractEndpointTest{

    public void run() throws Exception {
        Endpoint endpoint = null;
        //Obtain endpoint
        ServerEndpoint serverEndpoint = getServerEndpoint();
        endpoint = serverEndpoint
            .enumerateListenEndpoints(new SETContext());
        //Obtain constraints
        InvocationConstraints conflictingConstraints =
            (InvocationConstraints) getConfigObject(
                InvocationConstraints.class, "conflictingConstraints");
View Full Code Here

import java.io.IOException;

public class ListenContextExceptionTest extends AbstractEndpointTest {
    public void run() throws Exception {
        //Obtain a server endpoint instance
        ServerEndpoint endpoint = getServerEndpoint();
        try {
            //Verify that an arbitrary exception is propagated
            endpoint.enumerateListenEndpoints(
                new ExceptionListenContext(new ArbitraryException()));
        } catch (ArbitraryException a) {
            try {
                //Verify that an IOException is propagated
                endpoint.enumerateListenEndpoints(
                    new ExceptionListenContext(new IOException()));
            } catch (IOException e) {
                return;
            }
        }
View Full Code Here

public class EqualityTest extends AbstractEndpointTest {

    public void run() throws Exception {
        //Verify that functionally equivalent ServerEndpoint instances
        //are considered equal.
        ServerEndpoint se = getServerEndpoint();
        ServerEndpoint se2 = (ServerEndpoint)
            getConfigObject(ServerEndpoint.class,"equalEndpoint");
        if (!se.equals(se2)) {
            throw new TestException("Functionally equivalent"
                + " endpoints are not considered equal");
        }
        if (!se2.equals(se)){
             throw new TestException("Functionally equivalent"
                + " endpoints are not considered equal");
        }

        //Verify hashcodes
        if (se.hashCode()!=se2.hashCode()) {
            throw new TestException("Equal endpoints do not"
               + " return equal hashcodes");
        }

        //Verify that ListenEndpoint on functionally equivalent
        //ServerEndpoint instances are considered equal.
        EqualityContext lc = new EqualityContext();
        EqualityContext lc2 = new EqualityContext();
        se.enumerateListenEndpoints(lc);
        ArrayList endpoints = lc.getEndpoints();
        //close the listen operations to avoid problems when obtaining
        //the listen endpoints for the functionally equivalent endpoint
        Iterator it = endpoints.iterator();
        while (it.hasNext()){
            ((EndpointHolder)it.next()).getListenHandle().close();
        }
        // wait to make sure resources released before attempting
        // to reuse socket
        Thread.currentThread().sleep(1000 * 30);
        se2.enumerateListenEndpoints(lc2);
        ArrayList endpoints2 = lc2.getEndpoints();
        for (int i=0; i<endpoints.size(); i++){
            EndpointHolder eph = (EndpointHolder) endpoints.get(i);
            EndpointHolder eph2 = (EndpointHolder) endpoints2.get(i);
            ServerEndpoint.ListenEndpoint le = eph.getListenEndpoint();
            ServerEndpoint.ListenEndpoint le2 = eph2.getListenEndpoint();
            if (!le.equals(le2)){
                throw new TestException("ListenEndpoint " + le
                    + " on ServerEndpoint " + se + " is not considered"
                    + " equal to ListenEndpoint " + le2 + " on functionally"
                    + " equivalent ServerEndpoint " + se2);
            }
            if (!le2.equals(le)){
                throw new TestException("ListenEndpoint " + le
                    + " on ServerEndpoint " + se + " is not considered"
                    + " equal to ListenEndpoint " + le2 + " on functionally"
                    + " equivalent ServerEndpoint " + se2);
            }
        }
        //Verify that endpoints that are not functionally equivalent
        //are not considered equal
        se2 = (ServerEndpoint) getConfigObject(
            ServerEndpoint.class,"diffEndpoint");
        if (se.equals(se2)) {
            throw new TestException("Functionally different"
                + " endpoints are considered equal");
        }
        if (se2.equals(se)){
             throw new TestException("Functionally different"
                + " endpoints are considered equal");
        }
        //Verify that ListenEndpoint on functionally equivalent
        //ServerEndpoint instances are considered equal.
        lc2 = new EqualityContext();
        se2.enumerateListenEndpoints(lc2);
        endpoints2 = lc2.getEndpoints();
        for (int i=0; i<endpoints.size(); i++){
            EndpointHolder eph = (EndpointHolder) endpoints.get(i);
            EndpointHolder eph2 = (EndpointHolder) endpoints2.get(i);
            ServerEndpoint.ListenEndpoint le = eph.getListenEndpoint();
View Full Code Here

TOP

Related Classes of net.jini.jeri.ServerEndpoint

Copyright © 2018 www.massapicom. 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.