/** * Factory method for new WebSocketClientSelectorManager (used by other projects like cometd) * * @param client * the client used to create the WebSocketClientSelectorManager * @return the new WebSocketClientSelectorManager */ protected WebSocketClientSelectorManager newWebSocketClientSelectorManager(WebSocketClient client) { return new WebSocketClientSelectorManager(client); }
SslContextFactory sslContextFactory = getSslContextFactory(); if (sslContextFactory != null) SSLEngine engine = newSSLEngine(sslContextFactory,channel); SslConnection sslConnection = new SslConnection(bufferPool,getExecutor(),endPoint,engine); EndPoint sslEndPoint = sslConnection.getDecryptedEndPoint(); Connection connection = newUpgradeConnection(channel,sslEndPoint,connectPromise); sslEndPoint.setIdleTimeout(connectPromise.getClient().getMaxIdleTimeout()); sslEndPoint.setConnection(connection); connectionOpened(connection); return sslConnection; return newUpgradeConnection(channel,endPoint,connectPromise);
@Override protected void doStart() throws Exception { selector = newWebSocketClientSelectorManager(client); selector.setSslContextFactory(client.getSslContextFactory()); selector.setConnectTimeout(client.getConnectTimeout()); addBean(selector); super.doStart(); }
@Override protected EndPoint newEndPoint(SocketChannel channel, ManagedSelector selectSet, SelectionKey selectionKey) throws IOException { LOG.debug("newEndPoint({}, {}, {})",channel,selectSet,selectionKey); return new SelectChannelEndPoint(channel,selectSet,selectionKey,getScheduler(),policy.getIdleTimeout()); }
@Override public void run() { try { SocketChannel channel = SocketChannel.open(); if (bindAddress != null) { channel.bind(bindAddress); } URI wsUri = getRequest().getRequestURI(); channel.socket().setTcpNoDelay(true); // disable nagle channel.configureBlocking(false); // async always InetSocketAddress address = toSocketAddress(wsUri); channel.connect(address); getSelector().connect(channel,this); } catch (Throwable t) { failed(t); } } }
SslContextFactory sslContextFactory = getSslContextFactory(); if (sslContextFactory != null) SSLEngine engine = newSSLEngine(sslContextFactory,channel); SslConnection sslConnection = new SslConnection(bufferPool,getExecutor(),endPoint,engine); EndPoint sslEndPoint = sslConnection.getDecryptedEndPoint(); Connection connection = newUpgradeConnection(channel,sslEndPoint,connectPromise); sslEndPoint.setIdleTimeout(connectPromise.getClient().getMaxIdleTimeout()); sslEndPoint.setConnection(connection); connectionOpened(connection); return sslConnection; return newUpgradeConnection(channel,endPoint,connectPromise);
@Override protected void doStart() throws Exception { selector = newWebSocketClientSelectorManager(client); selector.setSslContextFactory(client.getSslContextFactory()); selector.setConnectTimeout(client.getConnectTimeout()); addBean(selector); super.doStart(); }
@Override protected EndPoint newEndPoint(SocketChannel channel, ManagedSelector selectSet, SelectionKey selectionKey) throws IOException { LOG.debug("newEndPoint({}, {}, {})",channel,selectSet,selectionKey); return new SelectChannelEndPoint(channel,selectSet,selectionKey,getScheduler(),policy.getIdleTimeout()); }
@Override public void run() { try { SocketChannel channel = SocketChannel.open(); if (bindAddress != null) { channel.bind(bindAddress); } URI wsUri = getRequest().getRequestURI(); channel.socket().setTcpNoDelay(true); // disable nagle channel.configureBlocking(false); // async always InetSocketAddress address = toSocketAddress(wsUri); channel.connect(address); getSelector().connect(channel,this); } catch (Throwable t) { failed(t); } } }
/** * Factory method for new WebSocketClientSelectorManager (used by other projects like cometd) * * @param client * the client used to create the WebSocketClientSelectorManager * @return the new WebSocketClientSelectorManager */ protected WebSocketClientSelectorManager newWebSocketClientSelectorManager(WebSocketClient client) { return new WebSocketClientSelectorManager(client); }