use of org.eclipse.jetty.websocket.common.scopes.SimpleContainerScope 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.SimpleContainerScope 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.SimpleContainerScope 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.SimpleContainerScope 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.SimpleContainerScope in project jetty.project by eclipse.
the class EventDriverFactoryTest method testListenerBasicSocket.
/**
* Test Case for no exceptions and 5 methods (implement WebSocketListener)
*/
@Test
public void testListenerBasicSocket() {
EventDriverFactory factory = new EventDriverFactory(new SimpleContainerScope(WebSocketPolicy.newClientPolicy()));
ListenerBasicSocket socket = new ListenerBasicSocket();
EventDriver driver = factory.wrap(socket);
String classId = ListenerBasicSocket.class.getSimpleName();
Assert.assertThat("EventDriver for " + classId, driver, instanceOf(JettyListenerEventDriver.class));
}
Aggregations