use of org.eclipse.jetty.websocket.common.scopes.WebSocketContainerScope in project jetty.project by eclipse.
the class ServerAnnotatedEndpointScanner_InvalidSignaturesTest method testScan_InvalidSignature.
@Test
public void testScan_InvalidSignature() throws DeploymentException {
WebSocketContainerScope container = new SimpleContainerScope(WebSocketPolicy.newClientPolicy());
AnnotatedServerEndpointMetadata metadata = new AnnotatedServerEndpointMetadata(container, pojo, null);
AnnotatedEndpointScanner<ServerEndpoint, ServerEndpointConfig> scanner = new AnnotatedEndpointScanner<>(metadata);
try {
scanner.scan();
Assert.fail("Expected " + InvalidSignatureException.class + " with message that references " + expectedAnnoClass + " annotation");
} catch (InvalidSignatureException e) {
if (LOG.isDebugEnabled())
LOG.debug("{}:{}", e.getClass(), e.getMessage());
Assert.assertThat("Message", e.getMessage(), containsString(expectedAnnoClass.getSimpleName()));
}
}
use of org.eclipse.jetty.websocket.common.scopes.WebSocketContainerScope in project jetty.project by eclipse.
the class DecoderFactoryTest method initDecoderFactory.
@Before
public void initDecoderFactory() {
WebSocketContainerScope containerScope = new SimpleContainerScope(WebSocketPolicy.newClientPolicy());
DecoderFactory primitivesFactory = new DecoderFactory(containerScope, PrimitiveDecoderMetadataSet.INSTANCE);
metadatas = new DecoderMetadataSet();
factory = new DecoderFactory(containerScope, metadatas, primitivesFactory);
}
use of org.eclipse.jetty.websocket.common.scopes.WebSocketContainerScope in project jetty.project by eclipse.
the class MessageHandlerFactoryTest method init.
@Before
public void init() throws DeploymentException {
WebSocketContainerScope containerScope = new SimpleContainerScope(WebSocketPolicy.newClientPolicy());
DecoderFactory primitivesFactory = new DecoderFactory(containerScope, PrimitiveDecoderMetadataSet.INSTANCE);
metadatas = new DecoderMetadataSet();
decoders = new DecoderFactory(containerScope, metadatas, primitivesFactory);
factory = new MessageHandlerFactory();
}
use of org.eclipse.jetty.websocket.common.scopes.WebSocketContainerScope in project jetty.project by eclipse.
the class MessageWriterTest method setupSession.
@Before
public void setupSession() throws Exception {
policy = WebSocketPolicy.newServerPolicy();
policy.setInputBufferSize(1024);
policy.setMaxTextMessageBufferSize(1024);
// Container
WebSocketContainerScope containerScope = new SimpleContainerScope(policy, bufferPool);
// Event Driver factory
EventDriverFactory factory = new EventDriverFactory(containerScope);
// local socket
EventDriver driver = factory.wrap(new TrackingSocket("local"));
// remote socket
socket = new TrackingSocket("remote");
OutgoingFrames socketPipe = FramePipes.to(factory.wrap(socket));
session = new LocalWebSocketSession(containerScope, testname, driver);
session.setPolicy(policy);
// talk to our remote socket
session.setOutgoingHandler(socketPipe);
// start session
session.start();
// open connection
session.open();
}
use of org.eclipse.jetty.websocket.common.scopes.WebSocketContainerScope in project jetty.project by eclipse.
the class WebSocketCdiListener method lifeCycleStarting.
@Override
public void lifeCycleStarting(LifeCycle event) {
if (event instanceof WebSocketContainerScope) {
if (LOG.isDebugEnabled()) {
LOG.debug("started websocket container [{}]", event);
}
ContainerListener listener = new ContainerListener((WebSocketContainerScope) event);
if (event instanceof ContainerLifeCycle) {
ContainerLifeCycle container = (ContainerLifeCycle) event;
container.addLifeCycleListener(listener);
container.addEventListener(listener);
} else {
throw new RuntimeException("Unable to setup CDI against non-container: " + event.getClass().getName());
}
}
}
Aggregations