Bingo, that was it!
We were both getting impatient :)
messageLatch.countDown should be in onMessage instead.
Arun
On 2/25/13 7:58 AM, Andy Moncsek wrote:
> Hi Arun,
> I think we did the same mistake... we don't wait ;-)...If your
> connectToServer is in a simple main method or an UnitTest simply add a
>
> final CountDownLatch messageLatch = new CountDownLatch(1); and
> inside onOpen() { messageLatch.countDown();} and after your
> connectToServer call a simple messageLatch.await(100, TimeUnit.SECONDS);
>
> ... Thats it...
>
> Andy
>
>
>
> 2013/2/19 Arun Gupta <arun.p.gupta_at_oracle.com
> <mailto:arun.p.gupta_at_oracle.com>>
>
> I connected to the endpoint as:
>
> WebSocketContainer container =
> ContainerProvider.getWebSocketContainer();
> String uri = "ws://localhost:8080/scalability/websocket";
> System.out.println("Connecting to " + uri);
> container.connectToServer(MyClientEndpoint.class,
> URI.create(uri));
>
> Client endpoint is:
>
> @WebSocketClient
> public class MyClientEndpoint {
> @WebSocketOpen
> public void onOpen(Session session) {
> System.out.println("Connected to endpoint: " +
> session.getRemote());
> try {
> String name = "Duke";
> System.out.println("Sending message to endpoint: " +
> name);
> session.getRemote().sendString(name);
> } catch (IOException ex) {
> Logger.getLogger(MyClientEndpoint.class.getName()).log(Level.SEVERE,
> null, ex);
> }
> }
>
> @WebSocketMessage
> public void processMessage(String message) {
> System.out.println("Received message in client: " + message);
> }
> }
>
> None of the System.outs from ClientEndpoint are printed. Where do
> I expect them ?
>
> Arun
>
>
> On 2/19/13 7:35 AM, Pavel Bucek wrote:
>
> Hi Arun,
>
> you will need:
>
> <dependency>
> <groupId>org.glassfish.tyrus</groupId>
> <artifactId>tyrus-client</artifactId>
> <version>1.0-SNAPSHOT</version>
> </dependency>
> <dependency>
> <groupId>org.glassfish.tyrus</groupId>
> <artifactId>tyrus-container-grizzly</artifactId>
> <version>1.0-SNAPSHOT</version>
> </dependency>
>
> Regards,
> Pavel
>
> On 2/19/13 3:37 PM, Arun Gupta wrote:
>
> I'd like to use JSR 356 Client APIs with JDK 7. Is there a
> stand-alone client.jar that can be used ?
>
> Arun
>
>
>
> --
> http://twitter.com/arungupta
> http://blogs.oracle.com/arungupta
>
>
--
http://twitter.com/arungupta
http://blogs.oracle.com/arungupta