Examples of TextWebSocketFrame


Examples of org.jboss.netty.handler.codec.http.websocketx.TextWebSocketFrame

      Object msg) throws Exception
  {
    Event event = null;
    try
    {
      TextWebSocketFrame frame = (TextWebSocketFrame) msg;
      event = gson.fromJson(frame.getText(), DefaultEvent.class);
      if (event.getType() == Events.NETWORK_MESSAGE)
      {
        event.setType(Events.SESSION_MESSAGE);
      }
    }
View Full Code Here

Examples of org.jboss.netty.handler.codec.http.websocketx.TextWebSocketFrame

  @Override
  protected Object encode(ChannelHandlerContext ctx, Channel channel,
      Object msg) throws Exception
  {
    String json = gson.toJson(msg);
    return new TextWebSocketFrame(json);
  }
View Full Code Here

Examples of org.jboss.netty.handler.codec.http.websocketx.TextWebSocketFrame

      throws Exception
  {
    Channel channel = ctx.getChannel();
    if (e.getMessage() instanceof TextWebSocketFrame)
    {
      TextWebSocketFrame frame = (TextWebSocketFrame) e.getMessage();
      String data = frame.getText();
      LOG.trace("From websocket: " + data);
      Event event = gson.fromJson(data, DefaultEvent.class);
      int type = event.getType();
      if (Events.LOG_IN == type)
      {
View Full Code Here

Examples of org.jboss.netty.handler.codec.http.websocketx.TextWebSocketFrame

  }

  protected TextWebSocketFrame eventToFrame(byte opcode, Object payload)
  {
    Event event = Events.event(payload, opcode);
    return new TextWebSocketFrame(gson.toJson(event));
  }
View Full Code Here

Examples of org.jboss.netty.handler.codec.http.websocketx.TextWebSocketFrame

        builder.addEndpoint(ServerEndpointConfig.Builder.create(TestEndPoint.class, "/").configurator(new InstanceConfigurator(new TestEndPoint())).build());
        deployServlet(builder);

        WebSocketTestClient client = new WebSocketTestClient(getVersion(), new URI("ws://" + DefaultServer.getHostAddress("default") + ":" + DefaultServer.getHostPort("default") + "/"));
        client.connect();
        client.send(new TextWebSocketFrame(ChannelBuffers.wrappedBuffer(payload)), new FrameChecker(TextWebSocketFrame.class, payload, latch));
        latch.getIoFuture().get();
        Assert.assertNull(cause.get());
        client.destroy();
    }
View Full Code Here

Examples of org.jboss.netty.handler.codec.http.websocketx.TextWebSocketFrame

        deployServlet(builder);

        WebSocketTestClient client = new WebSocketTestClient(getVersion(), new URI("ws://" + DefaultServer.getHostAddress("default") + ":" + DefaultServer.getHostPort("default") + "/"));
        client.connect();
        client.send(new TextWebSocketFrame(ChannelBuffers.wrappedBuffer(payload)), new FrameChecker(TextWebSocketFrame.class, payload, latch));
        latch.getIoFuture().get();
        latch2.getIoFuture().get();

        SendResult result = sendResult.get();
        Assert.assertNotNull(result);
View Full Code Here

Examples of org.jboss.netty.handler.codec.http.websocketx.TextWebSocketFrame

        builder.addEndpoint(ServerEndpointConfig.Builder.create(TestEndPoint.class, "/").configurator(new InstanceConfigurator(new TestEndPoint())).build());
        deployServlet(builder);

        WebSocketTestClient client = new WebSocketTestClient(getVersion(), new URI("ws://" + DefaultServer.getHostAddress("default") + ":" + DefaultServer.getHostPort("default") + "/"));
        client.connect();
        client.send(new TextWebSocketFrame(ChannelBuffers.wrappedBuffer(payload)), new FrameChecker(TextWebSocketFrame.class, payload, latch));
        latch.getIoFuture().get();

        sendResult.get();

        client.destroy();
View Full Code Here

Examples of org.jboss.netty.handler.codec.http.websocketx.TextWebSocketFrame

        builder.addEndpoint(ServerEndpointConfig.Builder.create(TestEndPoint.class, "/").configurator(new InstanceConfigurator(new TestEndPoint())).build());
        deployServlet(builder);

        WebSocketTestClient client = new WebSocketTestClient(getVersion(), new URI("ws://" + DefaultServer.getHostAddress("default") + ":" + DefaultServer.getHostPort("default") + "/"));
        client.connect();
        client.send(new TextWebSocketFrame(ChannelBuffers.wrappedBuffer(payload)), new FrameChecker(TextWebSocketFrame.class, payload, latch));
        latch.getIoFuture().get();
        Assert.assertNull(cause.get());
        client.destroy();
    }
View Full Code Here

Examples of org.jboss.netty.handler.codec.http.websocketx.TextWebSocketFrame

        builder.addEndpoint(ServerEndpointConfig.Builder.create(TestEndPoint.class, "/").configurator(new InstanceConfigurator(new TestEndPoint())).build());
        deployServlet(builder);

        WebSocketTestClient client = new WebSocketTestClient(getVersion(), new URI("ws://" + DefaultServer.getHostAddress("default") + ":" + DefaultServer.getHostPort("default") + "/"));
        client.connect();
        client.send(new TextWebSocketFrame(ChannelBuffers.wrappedBuffer(payload)), new FrameChecker(TextWebSocketFrame.class, payload, latch));
        latch.getIoFuture().get();
        Assert.assertNull(cause.get());
        client.destroy();
    }
View Full Code Here

Examples of org.jboss.netty.handler.codec.http.websocketx.TextWebSocketFrame

        final byte[] payload = "hello".getBytes();
        final FutureResult latch = new FutureResult();

        WebSocketTestClient client = new WebSocketTestClient(WebSocketVersion.V13, new URI("ws://" + DefaultServer.getHostAddress("default") + ":" + DefaultServer.getHostPort("default") + "/ws/chat/Stuart"));
        client.connect();
        client.send(new TextWebSocketFrame(ChannelBuffers.wrappedBuffer(payload)), new FrameChecker(TextWebSocketFrame.class, "hello Stuart".getBytes(), latch));
        latch.getIoFuture().get();
        client.destroy();
    }
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.