return container;
}
@Override
public void onSession(WebSocketSession s, WebSocketHttpExchange exchange) {
WebSocketChannelSession channelSession = (WebSocketChannelSession) s;
ConfiguredServerEndpoint config = HandshakeUtil.getConfig(channelSession.getChannel());
try {
InstanceFactory<Endpoint> endpointFactory = config.getEndpointFactory();
final InstanceHandle<Endpoint> instance;
if(endpointFactory != null) {
instance = endpointFactory.createInstance();
} else {
instance = new ImmediateInstanceHandle<Endpoint>((Endpoint) config.getEndpointConfiguration().getConfigurator().getEndpointInstance(config.getEndpointConfiguration().getEndpointClass()));
}
UndertowSession session = new UndertowSession(channelSession, URI.create(exchange.getRequestURI()), exchange.getAttachment(HandshakeUtil.PATH_PARAMS), Collections.<String, List<String>>emptyMap(), this, null, instance, config.getEndpointConfiguration(), exchange.getQueryString(), config.getEncodingFactory().createEncoding(config.getEndpointConfiguration()), config.getOpenSessions());
config.getOpenSessions().add(session);
session.setMaxBinaryMessageBufferSize(getContainer().getDefaultMaxBinaryMessageBufferSize());
session.setMaxTextMessageBufferSize(getContainer().getDefaultMaxTextMessageBufferSize());
//session.setTimeout(getContainer().getMaxSessionIdleTimeout());
session.getAsyncRemote().setSendTimeout(getContainer().getDefaultAsyncSendTimeout());
instance.getInstance().onOpen(session, config.getEndpointConfiguration());
} catch (InstantiationException e) {
JsrWebSocketLogger.REQUEST_LOGGER.endpointCreationFailed(e);
IoUtils.safeClose(channelSession.getChannel());
}
}