public void setConnection(Connection connection) { _endp.setConnection(connection); }
public void upgrade() { AsyncHttpConnection connection = (AsyncHttpConnection)_endp.getConnection(); SslConnection sslConnection = new SslConnection(_engine,_endp); _endp.setConnection(sslConnection); _endp=sslConnection.getSslEndPoint(); sslConnection.getSslEndPoint().setConnection(connection); LOG.debug("upgrade {} to {} for {}",this,sslConnection,connection); }
@Override protected SelectChannelEndPoint newEndPoint(SocketChannel channel, SelectSet selectSet, final SelectionKey key) throws IOException { WebSocketClient.WebSocketFuture holder = (WebSocketClient.WebSocketFuture)key.attachment(); int maxIdleTime = holder.getMaxIdleTime(); if (maxIdleTime < 0) maxIdleTime = (int)getMaxIdleTime(); SelectChannelEndPoint result = new SelectChannelEndPoint(channel, selectSet, key, maxIdleTime); AsyncEndPoint endPoint = result; // Detect if it is SSL, and wrap the connection if so if ("wss".equals(holder.getURI().getScheme())) { SSLEngine sslEngine = newSslEngine(channel); SslConnection sslConnection = new SslConnection(sslEngine, endPoint); endPoint.setConnection(sslConnection); endPoint = sslConnection.getSslEndPoint(); } AsyncConnection connection = selectSet.getManager().newConnection(channel, endPoint, holder); endPoint.setConnection(connection); return result; }
@Override protected SelectChannelEndPoint newEndPoint(SocketChannel channel, SelectSet selectSet, final SelectionKey key) throws IOException { WebSocketClient.WebSocketFuture holder = (WebSocketClient.WebSocketFuture)key.attachment(); int maxIdleTime = holder.getMaxIdleTime(); if (maxIdleTime < 0) maxIdleTime = (int)getMaxIdleTime(); SelectChannelEndPoint result = new SelectChannelEndPoint(channel, selectSet, key, maxIdleTime); AsyncEndPoint endPoint = result; // Detect if it is SSL, and wrap the connection if so if ("wss".equals(holder.getURI().getScheme())) { SSLEngine sslEngine = newSslEngine(channel); SslConnection sslConnection = new SslConnection(sslEngine, endPoint); endPoint.setConnection(sslConnection); endPoint = sslConnection.getSslEndPoint(); } AsyncConnection connection = selectSet.getManager().newConnection(channel, endPoint, holder); endPoint.setConnection(connection); return result; }
@Override protected SelectChannelEndPoint newEndPoint(SocketChannel channel, SelectSet selectSet, final SelectionKey key) throws IOException { WebSocketClient.WebSocketFuture holder = (WebSocketClient.WebSocketFuture)key.attachment(); int maxIdleTime = holder.getMaxIdleTime(); if (maxIdleTime < 0) maxIdleTime = (int)getMaxIdleTime(); SelectChannelEndPoint result = new SelectChannelEndPoint(channel, selectSet, key, maxIdleTime); AsyncEndPoint endPoint = result; // Detect if it is SSL, and wrap the connection if so if ("wss".equals(holder.getURI().getScheme())) { SSLEngine sslEngine = newSslEngine(channel); SslConnection sslConnection = new SslConnection(sslEngine, endPoint); endPoint.setConnection(sslConnection); endPoint = sslConnection.getSslEndPoint(); } AsyncConnection connection = selectSet.getManager().newConnection(channel, endPoint, holder); endPoint.setConnection(connection); return result; }
@Override protected AsyncConnection newConnection(SocketChannel channel, AsyncEndPoint endpoint) { try { SSLEngine engine = createSSLEngine(channel); SslConnection connection = newSslConnection(endpoint, engine); AsyncConnection delegate = newPlainConnection(channel, connection.getSslEndPoint()); connection.getSslEndPoint().setConnection(delegate); connection.setAllowRenegotiate(_sslContextFactory.isAllowRenegotiate()); return connection; } catch (IOException e) { throw new RuntimeIOException(e); } }
@Override protected AsyncConnection newConnection(SocketChannel channel, AsyncEndPoint endpoint) { try { SSLEngine engine = createSSLEngine(channel); SslConnection connection = newSslConnection(endpoint, engine); AsyncConnection delegate = newPlainConnection(channel, connection.getSslEndPoint()); connection.getSslEndPoint().setConnection(delegate); connection.setAllowRenegotiate(_sslContextFactory.isAllowRenegotiate()); return connection; } catch (IOException e) { throw new RuntimeIOException(e); } }
@Override protected AsyncConnection newConnection(SocketChannel channel, AsyncEndPoint endpoint) { try { SSLEngine engine = createSSLEngine(channel); SslConnection connection = newSslConnection(endpoint, engine); AsyncConnection delegate = newPlainConnection(channel, connection.getSslEndPoint()); connection.getSslEndPoint().setConnection(delegate); connection.setAllowRenegotiate(_sslContextFactory.isAllowRenegotiate()); return connection; } catch (IOException e) { throw new RuntimeIOException(e); } }
@Override protected SelectChannelEndPoint newEndPoint(SocketChannel channel, SelectSet selectSet, SelectionKey key) throws IOException { // We're connected, cancel the connect timeout Timeout.Task connectTimeout = _connectingChannels.remove(channel); if (connectTimeout != null) connectTimeout.cancel(); if (LOG.isDebugEnabled()) LOG.debug("Channels with connection pending: {}", _connectingChannels.size()); // key should have destination at this point (will be replaced by endpoint after this call) HttpDestination dest=(HttpDestination)key.attachment(); SelectChannelEndPoint scep = new SelectChannelEndPoint(channel, selectSet, key, (int)_httpClient.getIdleTimeout()); AsyncEndPoint ep = scep; if (dest.isSecure()) { LOG.debug("secure to {}, proxied={}",channel,dest.isProxied()); ep = new UpgradableEndPoint(ep,newSslEngine(dest.getSslContextFactory(), channel)); } AsyncConnection connection = selectSet.getManager().newConnection(channel,ep, key.attachment()); ep.setConnection(connection); AbstractHttpConnection httpConnection=(AbstractHttpConnection)connection; httpConnection.setDestination(dest); if (dest.isSecure() && !dest.isProxied()) ((UpgradableEndPoint)ep).upgrade(); dest.onNewConnection(httpConnection); return scep; }
@Override protected AsyncConnection newConnection(SocketChannel channel, AsyncEndPoint endpoint) { try { SSLEngine engine = createSSLEngine(channel); SslConnection connection = newSslConnection(endpoint, engine); AsyncConnection delegate = newPlainConnection(channel, connection.getSslEndPoint()); connection.getSslEndPoint().setConnection(delegate); connection.setAllowRenegotiate(_sslContextFactory.isAllowRenegotiate()); return connection; } catch (IOException e) { throw new RuntimeIOException(e); } }
@Override protected AsyncConnection newConnection(SocketChannel channel, AsyncEndPoint endpoint) { try { SSLEngine engine = createSSLEngine(channel); SslConnection connection = newSslConnection(endpoint, engine); AsyncConnection delegate = newPlainConnection(channel, connection.getSslEndPoint()); connection.getSslEndPoint().setConnection(delegate); connection.setAllowRenegotiate(_sslContextFactory.isAllowRenegotiate()); return connection; } catch (IOException e) { throw new RuntimeIOException(e); } }