Search in sources :

Example 1 with WebSocketConnection

use of io.crossbar.autobahn.websocket.WebSocketConnection in project autobahn-java by crossbario.

the class TestSuiteClientActivity method queryCaseCount.

private void queryCaseCount() throws WebSocketException {
    final WebSocketConnection webSocket = new WebSocketConnection();
    webSocket.connect(mWsUri.getText() + "/getCaseCount", new WebSocketConnectionHandler() {

        @Override
        public void onOpen() {
            savePrefs();
        }

        @Override
        public void onMessage(String payload) {
            lastCase = Integer.parseInt(payload);
        }

        @Override
        public void onClose(int code, String reason) {
            mStatusLine.setText("Ok, will run " + lastCase + " cases.");
            currentCase += 1;
            processNext();
        }
    });
}
Also used : WebSocketConnection(io.crossbar.autobahn.websocket.WebSocketConnection) WebSocketConnectionHandler(io.crossbar.autobahn.websocket.WebSocketConnectionHandler)

Example 2 with WebSocketConnection

use of io.crossbar.autobahn.websocket.WebSocketConnection in project autobahn-java by crossbario.

the class TestSuiteClientActivity method updateReport.

private void updateReport() throws WebSocketException {
    WebSocketConnection webSocket = new WebSocketConnection();
    webSocket.connect(mWsUri.getText() + "/updateReports?agent=" + mAgent.getText(), new WebSocketConnectionHandler() {

        @Override
        public void onOpen() {
            mStatusLine.setText("Updating test reports ..");
        }

        @Override
        public void onClose(int code, String reason) {
            mStatusLine.setText("Test reports updated. Finished.");
            mStart.setEnabled(true);
        }
    });
}
Also used : WebSocketConnection(io.crossbar.autobahn.websocket.WebSocketConnection) WebSocketConnectionHandler(io.crossbar.autobahn.websocket.WebSocketConnectionHandler)

Example 3 with WebSocketConnection

use of io.crossbar.autobahn.websocket.WebSocketConnection in project autobahn-java by crossbario.

the class TestSuiteClientActivity method runTest.

private void runTest() throws WebSocketException {
    final WebSocketConnection webSocket = new WebSocketConnection();
    webSocket.connect(mWsUri.getText() + "/runCase?case=" + currentCase + "&agent=" + mAgent.getText(), new WebSocketConnectionHandler() {

        @Override
        public void onMessage(String payload) {
            webSocket.sendMessage(payload);
        }

        @Override
        public void onMessage(byte[] payload, boolean isBinary) {
            webSocket.sendMessage(payload, isBinary);
        }

        @Override
        public void onOpen() {
            updateText(mStatusLine, "Test case " + currentCase + "/" + lastCase + " started ..");
        }

        @Override
        public void onClose(int code, String reason) {
            mStatusLine.setText("Test case " + currentCase + "/" + lastCase + " finished.");
            currentCase += 1;
            processNext();
        }
    }, mOptions);
}
Also used : WebSocketConnection(io.crossbar.autobahn.websocket.WebSocketConnection) WebSocketConnectionHandler(io.crossbar.autobahn.websocket.WebSocketConnectionHandler)

Aggregations

WebSocketConnection (io.crossbar.autobahn.websocket.WebSocketConnection)3 WebSocketConnectionHandler (io.crossbar.autobahn.websocket.WebSocketConnectionHandler)3