Examples of WebSocketClient


Examples of com.caucho.remote.websocket.WebSocketClient

  public LinkConnection open(Broker broker)
  {
    try {
      HmtpWebSocketListener webSocketHandler = new HmtpWebSocketListener(broker);
       
      WebSocketClient oldClient = _webSocketClient;

      _webSocketClient = new WebSocketClient(_url, webSocketHandler);
     
      if (oldClient != null) {
        oldClient.close();
      }
     
      if (_virtualHost != null)
        _webSocketClient.setVirtualHost(_virtualHost);
     
View Full Code Here

Examples of com.caucho.remote.websocket.WebSocketClient

  public HmtpClient(String url)
  {
    _url = url;
   
    _webSocketClient = new WebSocketClient(url);
    _webSocketHandler = new WebSocketHandler();
  }
View Full Code Here

Examples of com.ponysdk.ui.terminal.socket.WebSocketClient

        } else {
            super.create(create, uiService);

            final String wsServerURL = GWT.getHostPageBaseURL().replaceFirst("http", "ws") + "ws" + "?" + APPLICATION.VIEW_ID + "=" + UIBuilder.sessionID;

            socketClient = new WebSocketClient(new WebSocketCallback() {

                @Override
                public void message(final String message) {
                    final JSONObject data = JSONParser.parseStrict(message).isObject();
                    if (data.containsKey(Dictionnary.APPLICATION.PING)) return;
View Full Code Here

Examples of com.tinkerpop.gremlin.driver.simple.WebSocketClient

        return settings;
    }

    @Test
    public void shouldReturnInvalidRequestArgsWhenGremlinArgIsNotSupplied() throws Exception {
        try (SimpleClient client = new WebSocketClient()) {
            final RequestMessage request = RequestMessage.build(Tokens.OPS_EVAL).create();
            final CountDownLatch latch = new CountDownLatch(1);
            final AtomicBoolean pass = new AtomicBoolean(false);
            client.submit(request, result -> {
                if (result.getStatus().getCode() != ResponseStatusCode.SUCCESS_TERMINATOR) {
                    pass.set(ResponseStatusCode.REQUEST_ERROR_INVALID_REQUEST_ARGUMENTS == result.getStatus().getCode());
                    latch.countDown();
                }
            });
View Full Code Here

Examples of com.tinkerpop.gremlin.driver.simple.WebSocketClient

        }
    }

    @Test
    public void shouldReturnInvalidRequestArgsWhenInvalidBindingKeyIsUsed() throws Exception {
        try (SimpleClient client = new WebSocketClient()) {
            final Map<String,Object> bindings = new HashMap<>();
            bindings.put(T.id.getAccessor(), "123");
            final RequestMessage request = RequestMessage.build(Tokens.OPS_EVAL)
                    .addArg(Tokens.ARGS_GREMLIN, "[1,2,3,4,5,6,7,8,9,0]")
                    .addArg(Tokens.ARGS_BINDINGS, bindings).create();
            final CountDownLatch latch = new CountDownLatch(1);
            final AtomicBoolean pass = new AtomicBoolean(false);
            client.submit(request, result -> {
                if (result.getStatus().getCode() != ResponseStatusCode.SUCCESS_TERMINATOR) {
                    pass.set(ResponseStatusCode.REQUEST_ERROR_INVALID_REQUEST_ARGUMENTS == result.getStatus().getCode());
                    latch.countDown();
                }
            });
View Full Code Here

Examples of com.tinkerpop.gremlin.driver.simple.WebSocketClient

        }
    }

    @Test
    public void shouldBatchResultsByTwos() throws Exception {
        try (SimpleClient client = new WebSocketClient()) {
            final RequestMessage request = RequestMessage.build(Tokens.OPS_EVAL)
                    .addArg(Tokens.ARGS_GREMLIN, "[1,2,3,4,5,6,7,8,9,0]").create();

            // set the latch to six as there should be six responses when you include the terminator
            final CountDownLatch latch = new CountDownLatch(6);
            client.submit(request, r -> latch.countDown());

            assertTrue(latch.await(300, TimeUnit.MILLISECONDS));
        }
    }
View Full Code Here

Examples of com.tinkerpop.gremlin.driver.simple.WebSocketClient

        }
    }

    @Test
    public void shouldBatchResultsByOnesByOverridingFromClientSide() throws Exception {
        try (SimpleClient client = new WebSocketClient()) {
            final RequestMessage request = RequestMessage.build(Tokens.OPS_EVAL)
                    .addArg(Tokens.ARGS_GREMLIN, "[1,2,3,4,5,6,7,8,9,0]")
                    .addArg(Tokens.ARGS_BATCH_SIZE, 1).create();

            // should be 11 responses when you include the terminator
            final CountDownLatch latch = new CountDownLatch(11);
            client.submit(request, r -> latch.countDown());

            assertTrue(latch.await(300, TimeUnit.MILLISECONDS));
        }
    }
View Full Code Here

Examples of org.eclipse.jetty.websocket.WebSocketClient

  }

  public void start() {
    try {
      this.factory.start();
      WebSocketClient client = this.factory.newWebSocketClient();
      client.open(new URI(MTGOX_URL), new MtgoxWebSocket());
    }
    catch (Exception ex) {
      logger.error("Failed to start WebSocketClientFactory", ex);
    }
  }
View Full Code Here

Examples of org.eclipse.jetty.websocket.WebSocketClient

    {

        try
        {
            final WebSocketClientFactory webSocketClientFactory = getWebSocketClientFactory(sslContext);
            WebSocketClient client = webSocketClientFactory.newWebSocketClient();
            // Configure the client
            client.setProtocol(AMQP_WEBSOCKET_SUBPROTOCOL);


            ConnectionHandler.FrameOutput<FrameBody> out = new ConnectionHandler.FrameOutput<FrameBody>(conn);

            final ConnectionHandler.FrameSource src;

            if(conn.requiresSASL())
            {
                ConnectionHandler.FrameOutput<SaslFrameBody> saslOut = new ConnectionHandler.FrameOutput<SaslFrameBody>(conn);

                src =  new ConnectionHandler.SequentialFrameSource(new HeaderFrameSource((byte)'A',
                                                                                               (byte)'M',
                                                                                               (byte)'Q',
                                                                                               (byte)'P',
                                                                                               (byte)3,
                                                                                               (byte)1,
                                                                                               (byte)0,
                                                                                               (byte)0),
                                                                   saslOut,
                                                                   new HeaderFrameSource((byte)'A',
                                                                                               (byte)'M',
                                                                                               (byte)'Q',
                                                                                               (byte)'P',
                                                                                               (byte)0,
                                                                                               (byte)1,
                                                                                               (byte)0,
                                                                                               (byte)0),
                                                                   out);

                conn.setSaslFrameOutput(saslOut);
            }
            else
            {
                src =  new ConnectionHandler.SequentialFrameSource(new HeaderFrameSource((byte)'A',
                                                                                               (byte)'M',
                                                                                               (byte)'Q',
                                                                                               (byte)'P',
                                                                                               (byte)0,
                                                                                               (byte)1,
                                                                                               (byte)0,
                                                                                               (byte)0),
                                                               out);
            }

            final ConnectionHandler handler = new ConnectionHandler(conn);
            conn.setFrameOutputHandler(out);
            final URI uri = new URI(_transport +"://"+ address+":"+ port +"/");
            WebSocket.Connection connection = client.open(uri, new WebSocket.OnBinaryMessage()
            {
                public void onOpen(Connection connection)
                {

                    Thread outputThread = new Thread(new FrameOutputThread(connection, src, conn, exceptionHandler, webSocketClientFactory));
View Full Code Here

Examples of org.eclipse.jetty.websocket.WebSocketClient

    {

        try
        {
            final WebSocketClientFactory webSocketClientFactory = getWebSocketClientFactory(sslContext);
            WebSocketClient client = webSocketClientFactory.newWebSocketClient();
            // Configure the client
            client.setProtocol(AMQP_WEBSOCKET_SUBPROTOCOL);


            ConnectionHandler.FrameOutput<FrameBody> out = new ConnectionHandler.FrameOutput<FrameBody>(conn);

            final ConnectionHandler.FrameSource src;

            if(conn.requiresSASL())
            {
                ConnectionHandler.FrameOutput<SaslFrameBody> saslOut = new ConnectionHandler.FrameOutput<SaslFrameBody>(conn);

                src =  new ConnectionHandler.SequentialFrameSource(new HeaderFrameSource((byte)'A',
                                                                                               (byte)'M',
                                                                                               (byte)'Q',
                                                                                               (byte)'P',
                                                                                               (byte)3,
                                                                                               (byte)1,
                                                                                               (byte)0,
                                                                                               (byte)0),
                                                                   saslOut.asFrameSource(),
                                                                   new HeaderFrameSource((byte)'A',
                                                                                               (byte)'M',
                                                                                               (byte)'Q',
                                                                                               (byte)'P',
                                                                                               (byte)0,
                                                                                               (byte)1,
                                                                                               (byte)0,
                                                                                               (byte)0),
                                                                   out.asFrameSource());

                conn.setSaslFrameOutput(saslOut);
            }
            else
            {
                src =  new ConnectionHandler.SequentialFrameSource(new HeaderFrameSource((byte)'A',
                                                                                               (byte)'M',
                                                                                               (byte)'Q',
                                                                                               (byte)'P',
                                                                                               (byte)0,
                                                                                               (byte)1,
                                                                                               (byte)0,
                                                                                               (byte)0),
                                                               out.asFrameSource());
            }

            final ConnectionHandler handler = new ConnectionHandler(conn);
            conn.setFrameOutputHandler(out);
            final URI uri = new URI(_transport +"://"+ address+":"+ port +"/");
            _connection = client.open(uri, new WebSocket.OnBinaryMessage()
            {
                public void onOpen(Connection connection)
                {

                    Thread outputThread = new Thread(new FrameOutputThread(connection, src, conn, exceptionHandler, webSocketClientFactory));
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.