Examples of openWebSocketConnection()


Examples of org.xlightweb.client.HttpClient.openWebSocketConnection()

       
       
        IHttpResponse response = httpClient.call(new GetRequest("http://localhost:" + server.getLocalPort() + "/"));
        Assert.assertEquals(200, response.getStatus());
       
        IWebSocketConnection webSocketConnection = httpClient.openWebSocketConnection("ws://localhost:" +  server.getLocalPort());
       
       
        httpClient.close();
        server.close();
    }
View Full Code Here

Examples of org.xlightweb.client.HttpClient.openWebSocketConnection()

        proxy.start();
       
        httpClient.setProxyHost("localhost");
        httpClient.setProxyPort(proxy.getLocalPort());
       
        IWebSocketConnection wsCon = httpClient.openWebSocketConnection("ws://localhost:" + server.getLocalPort() + "/");
       
        wsCon.writeMessage(new TextMessage("0123456789"));
        Assert.assertEquals("0123456789", wsCon.readMessage().toString());
       
       
View Full Code Here

Examples of org.xlightweb.client.HttpClient.openWebSocketConnection()

        proxy.start();
       
        httpClient.setProxyHost("localhost");
        httpClient.setProxyPort(proxy.getLocalPort());
       
        IWebSocketConnection wsCon = httpClient.openWebSocketConnection("ws://localhost:" + server.getLocalPort() + "/");
       
        wsCon.writeMessage(new TextMessage("0123456789"));
        Assert.assertEquals("0123456789", wsCon.readMessage().toString());
       
       
View Full Code Here

Examples of org.xlightweb.client.HttpClient.openWebSocketConnection()

            wsPrefix = "ws";
        }
       
        server.start();
       
        IWebSocketConnection webSocketConnection = httpClient.openWebSocketConnection(wsPrefix + "://localhost:" + server.getLocalPort(), "com.example.mnp");
       
        Event event = new Event("REGISTER", "messagebox/2234/folder/45");
        webSocketConnection.writeMessage(new TextMessage(event.toString()));
       
        for (int i = 0; i < 100; i++) {
View Full Code Here

Examples of org.xlightweb.client.HttpClient.openWebSocketConnection()

        webContainer.start();
       
       
        HttpClient httpClient = new HttpClient();
       
        IWebSocketConnection webSocketConnection = httpClient.openWebSocketConnection("ws://localhost:" +  webContainer.getLocalPort());
       
        webSocketConnection.writeMessage(new TextMessage("Hello you"));
       
        WebSocketMessage msg = webSocketConnection.readMessage();
        Assert.assertTrue(msg.isTextMessage());
View Full Code Here

Examples of org.xlightweb.client.HttpClient.openWebSocketConnection()

        webContainer.start();
       
       
        HttpClient httpClient = new HttpClient();
       
        IWebSocketConnection webSocketConnection = httpClient.openWebSocketConnection("ws://localhost:" +  webContainer.getLocalPort());
       
        webSocketConnection.writeMessage(new TextMessage("Hello you"));
       
        int available = webSocketConnection.availableMessages();
        WebSocketMessage msg = webSocketConnection.readMessage();
View Full Code Here

Examples of org.xlightweb.client.HttpClient.openWebSocketConnection()

       
        HttpClient httpClient = new HttpClient();

        httpClient.call(new GetRequest("http://localhost:" + server.getLocalPort() + "/WebSocketsExample"));
       
        IWebSocketConnection wsCon = httpClient.openWebSocketConnection("ws://localhost:" + server.getLocalPort() + "/WebSocketsExample", "mySubprotocol");
       
        wsCon.writeMessage(new TextMessage("GetDate"));
        TextMessage msg = wsCon.readTextMessage();
       
       
View Full Code Here

Examples of org.xlightweb.client.HttpClient.openWebSocketConnection()

       
        response = httpClient.call(new GetRequest("http://localhost:" + server.getLocalPort() + "/ws/test"));
        Assert.assertEquals(404, response.getStatus());

       
        IWebSocketConnection wsCon = httpClient.openWebSocketConnection("http://localhost:" + server.getLocalPort() + "/ws/test");
       
        wsCon.writeMessage(new TextMessage("Hello"));
        Assert.assertEquals("Hello", wsCon.readMessage().toString());
       
        wsCon.close();
View Full Code Here

Examples of org.xlightweb.client.HttpClient.openWebSocketConnection()

           
            public void onDisconnect(IWebSocketConnection con) throws IOException { }
           
            public void onConnect(IWebSocketConnection con) throws IOException, UnsupportedProtocolException {  }
        };
        IWebSocketConnection webSocketConnection = httpClient.openWebSocketConnection("ws://localhost:" + port, "com.example.echo", handler);
       
        webSocketConnection.writeMessage(new TextMessage("0123456789"));

       
       
View Full Code Here

Examples of org.xlightweb.client.HttpClient.openWebSocketConnection()

       
       
        ////////////////////////////////////////////
        // without handler 
        IWebSocketConnection webSocketConnection2 = httpClient.openWebSocketConnection("ws://localhost:" + port, "com.example.echo");
   
        webSocketConnection2.writeMessage(new TextMessage("0123456789"));
        TextMessage msg = webSocketConnection2.readTextMessage();
        Assert.assertEquals("0123456789", msg.toString());
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.