Package org.xlightweb.client

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"));
        IWebMessage msg = wsCon.readMessage();
       
       
View Full Code Here


       
        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

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.