Package com.sun.jini.test.spec.jeri.mux.util

Examples of com.sun.jini.test.spec.jeri.mux.util.TestService


public class MuxServerTest extends AbstractMuxTest {

    public void run() throws Exception {
        //Setup server side mux connection
        ServerEndpoint se = getServerEndpoint();
        TestService service = new TestServiceImpl();
        int redirectPort = getPort() + 1;
        Redirector rd = new Redirector(getHost(),getPort(),redirectPort);
        ((TestServerEndpoint) se).redirect(redirectPort);
        Thread t = new Thread(rd);
        t.start();
        BasicJeriExporter exporter = new BasicJeriExporter(se,
            new BasicILFactory());
        TestService stub = (TestService) exporter.export(service);
        //Connect to the mux server
        Socket s = new Socket(getHost(),getPort());
        InputStream is = s.getInputStream();
        OutputStream os = s.getOutputStream();
        //Send client connection header
        ClientConnectionHeader cHeader = new ClientConnectionHeader();
        cHeader.send(os);
        //Receive ServerConnection header and verify format
        ServerConnectionHeader sHeader = new ServerConnectionHeader();
        try {
            sHeader.receive(is,getTimeout());
        } catch (ProtocolException e) {
            e.printStackTrace();
            throw new TestException(e.getMessage(),e);
        }
        //Make a remote call that returns something
        stub.doSomething();
        exporter.unexport(true);
        rd.stop();
        //Extract and analyze the messages sent by the mux server
        try {
            analyzeServerDataBytes(rd.getServerConversation());
View Full Code Here


        Redirector rd = new Redirector(InetAddress.getLocalHost()
            .getHostAddress(), getPort(), getPort() + 1);
        Thread t = new Thread(rd);
        t.start();
        ((TestServerEndpoint) se).redirect(getPort() + 1);
        TestService service = new TestServiceImpl();
        BasicJeriExporter exporter = new BasicJeriExporter(se,
            new BasicILFactory());
        TestService stub = (TestService) exporter.export(service);
        //Obtain a message to send for the test
        byte[] ball = new byte[800];
        Arrays.fill(ball, (byte)0x88);
        stub.bounce(ball);
        rd.stop();
        byte[] data = extractDataMessage(rd.getClientConversation());
        byte[] serverData = extractDataMessage(rd.getServerConversation());
        int size = (serverData[2]<<8) + serverData[3];
        //Establish a connection to the mux server
View Full Code Here

        Redirector rd = new Redirector(InetAddress.getLocalHost()
            .getHostAddress(), getPort(), getPort() + 1);
        Thread t = new Thread(rd);
        t.start();
        ((TestServerEndpoint) se).redirect(getPort() + 1);
        TestService service = new TestServiceImpl();
        BasicJeriExporter exporter = new BasicJeriExporter(se,
            new BasicILFactory());
        TestService stub = (TestService) exporter.export(service);
        //Obtain a message to send for the test
        byte[] ball = new byte[800];
        Arrays.fill(ball, (byte)0x88);
        stub.bounce(ball);
        rd.stop();
        Thread.currentThread().sleep(1000 * 30);
        byte[] data = extractDataMessage(rd.getClientConversation());
        byte[] serverData = extractDataMessage(rd.getServerConversation());
        int size = (serverData[2]<<8) + serverData[3];
View Full Code Here

TOP

Related Classes of com.sun.jini.test.spec.jeri.mux.util.TestService

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.