Examples of openWebSocketConnection()


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

        HttpServer server = new HttpServer(new DualHandler());
        server.start();
       
        HttpClient httpClient = new HttpClient();
       
        IWebSocketConnection webSocketConnection = httpClient.openWebSocketConnection("ws://localhost:" +  server.getLocalPort());
       
        webSocketConnection.writeMessage(new TextMessage("GetData"));
        WebSocketMessage msg = webSocketConnection.readMessage();
        Assert.assertEquals("id: 556\r\ndata: 566;555\r\n\r\n", msg.toString());
        System.out.println(msg);
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"));
        WebSocketMessage msg = webSocketConnection2.readMessage();
        Assert.assertEquals("0123456789", msg.toString());
View Full Code Here

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

        HttpServer server = new HttpServer(new MixedRequestHandler());
        server.start();
        HttpClient httpClient = new HttpClient();
       
        IWebSocketConnection webSocketConnection = httpClient.openWebSocketConnection("ws://localhost:" + server.getLocalPort());
       
        WebSocketMessage msg = webSocketConnection.readMessage();
        Assert.assertTrue(msg.isTextMessage());
        Assert.assertEquals("Hello you", msg.toString());
       
View Full Code Here

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

        IHttpResponse response = httpClient.call(new GetRequest("http://localhost:" + server.getLocalPort() + "/"));
        Assert.assertEquals(200, response.getStatus());
        Assert.assertEquals("OK", response.getBody().toString());
       
       
        IWebSocketConnection webSocketConnection = httpClient.openWebSocketConnection("ws://localhost:" + server.getLocalPort());
       
        WebSocketMessage msg = webSocketConnection.readMessage();
        Assert.assertTrue(msg.isTextMessage());
        Assert.assertEquals("Hello you", msg.toString());
       
View Full Code Here

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

        server.start();
       
        HttpClient httpClient = new HttpClient();
       
        try {
            httpClient.openWebSocketConnection("ws://localhost:" + server.getLocalPort());
            Assert.fail("UnsupportedProtocolException expected");
        } catch (UnsupportedProtocolException expected) { }
               
        httpClient.close();
        server.close();
View Full Code Here

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

        HttpServer server = new HttpServer(0, new MixedRequestHandler(), SSLTestContextFactory.getSSLContext(), true);
        server.start();
       
        HttpClient httpClient = new HttpClient(SSLTestContextFactory.getSSLContext());
       
        IWebSocketConnection webSocketConnection = httpClient.openWebSocketConnection("wss://localhost:" + server.getLocalPort());
       
        WebSocketMessage msg = webSocketConnection.readMessage();
        Assert.assertTrue(msg.isTextMessage());
        Assert.assertEquals("Hello you", msg.toString());
       
View Full Code Here

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

            public void onDisconnect(IWebSocketConnection con) throws IOException {
               
            }
        }
       
        IWebSocketConnection webSocketConnection = httpClient.openWebSocketConnection("ws://localhost:" +  webContainer.getLocalPort(), new MyWebSocketHandler());

        webSocketConnection.writeMessage(new TextMessage("Hello jetty"));

       
        httpClient.close();
View Full Code Here

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

        server.start();
       
        HttpClient httpClient = new HttpClient();
       
        try {
            httpClient.openWebSocketConnection("ws://localhost:" + server.getLocalPort());
            Assert.fail("UnsupportedProtocolException expected");
        } catch (UnsupportedProtocolException expected) { }
               
        httpClient.close();
        server.close();
View Full Code Here

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

        server.start();
       
        HttpClient httpClient = new HttpClient();
       
        try {
            IWebSocketConnection ws = httpClient.openWebSocketConnection("ws://localhost:" + server.getLocalPort());

            ws.readMessage();
            Assert.fail("IOException expected");
        }catch (IOException expected) {  }
       
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.