Search in sources :

Example 1 with EchoStringEndpoint

use of org.eclipse.jetty.websocket.jsr356.samples.EchoStringEndpoint in project jetty.project by eclipse.

the class EndpointEchoTest method testAbstractEchoInstance.

@Test
public void testAbstractEchoInstance() throws Exception {
    WebSocketContainer container = ContainerProvider.getWebSocketContainer();
    EchoStringEndpoint echoer = new EchoStringEndpoint();
    Assert.assertThat(echoer, instanceOf(javax.websocket.Endpoint.class));
    // Issue connect using instance of class that extends abstract that extends Endpoint
    Session session = container.connectToServer(echoer, serverUri);
    if (LOG.isDebugEnabled())
        LOG.debug("Client Connected: {}", session);
    session.getBasicRemote().sendText("Echo");
    if (LOG.isDebugEnabled())
        LOG.debug("Client Message Sent");
    echoer.messageQueue.awaitMessages(1, 1000, TimeUnit.MILLISECONDS);
}
Also used : WebSocketContainer(javax.websocket.WebSocketContainer) EchoStringEndpoint(org.eclipse.jetty.websocket.jsr356.samples.EchoStringEndpoint) EchoStringEndpoint(org.eclipse.jetty.websocket.jsr356.samples.EchoStringEndpoint) Session(javax.websocket.Session) Test(org.junit.Test)

Aggregations

Session (javax.websocket.Session)1 WebSocketContainer (javax.websocket.WebSocketContainer)1 EchoStringEndpoint (org.eclipse.jetty.websocket.jsr356.samples.EchoStringEndpoint)1 Test (org.junit.Test)1