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); }
public SslConnection(SSLEngine engine,EndPoint endp, long timeStamp) { super(endp,timeStamp); _engine=engine; _session=_engine.getSession(); _aEndp=(AsyncEndPoint)endp; _sslEndPoint = newSslEndPoint(); }
allocateBuffers(); boolean progress=process(null,toFlush); if (toFill.space()>0 && _inbound.hasContent() && unwrap(toFill)) progress=true; if (toFlush.hasContent() && _outbound.space()>0 && wrap(toFlush)) progress=true; else if (wrap(toFlush)) progress=true; else if (unwrap(toFill)) progress=true; closeInbound(); releaseBuffers(); if (some_progress) _progressed.set(true);
@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); } }
allocateBuffers(); progress=process(null,null); releaseBuffers();
protected SslConnection newSslConnection(AsyncEndPoint endpoint, SSLEngine engine) { return new SslConnection(engine, endpoint); }
private synchronized boolean wrap(final Buffer buffer) throws IOException ByteBuffer bbuf=extractByteBuffer(buffer); final SSLEngineResult result; int encrypted_produced = 0;
allocateBuffers(); boolean progress=process(null,toFlush); if (toFill.space()>0 && _inbound.hasContent() && unwrap(toFill)) progress=true; if (toFlush.hasContent() && _outbound.space()>0 && wrap(toFlush)) progress=true; else if (wrap(toFlush)) progress=true; else if (unwrap(toFill)) progress=true; closeInbound(); releaseBuffers(); if (some_progress) _progressed.set(true);
@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); } }
allocateBuffers(); progress=process(null,null); releaseBuffers();
protected SslConnection newSslConnection(AsyncEndPoint endpoint, SSLEngine engine) { return new SslConnection(engine, endpoint); }
private synchronized boolean wrap(final Buffer buffer) throws IOException ByteBuffer bbuf=extractByteBuffer(buffer); final SSLEngineResult result; int encrypted_produced = 0;
allocateBuffers(); boolean progress=process(null,toFlush); if (toFill.space()>0 && _inbound.hasContent() && unwrap(toFill)) progress=true; if (toFlush.hasContent() && _outbound.space()>0 && wrap(toFlush)) progress=true; else if (wrap(toFlush)) progress=true; else if (unwrap(toFill)) progress=true; closeInbound(); releaseBuffers(); if (some_progress) _progressed.set(true);
@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, 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; }
allocateBuffers(); progress=process(null,null); releaseBuffers();
protected SslConnection newSslConnection(AsyncEndPoint endpoint, SSLEngine engine) { return new SslConnection(engine, endpoint); }
private synchronized boolean wrap(final Buffer buffer) throws IOException ByteBuffer bbuf=extractByteBuffer(buffer); final SSLEngineResult result; int encrypted_produced = 0;
public SslConnection(SSLEngine engine,EndPoint endp, long timeStamp) { super(endp,timeStamp); _engine=engine; _session=_engine.getSession(); _aEndp=(AsyncEndPoint)endp; _sslEndPoint = newSslEndPoint(); }
allocateBuffers(); boolean progress=process(null,toFlush); if (toFill.space()>0 && _inbound.hasContent() && unwrap(toFill)) progress=true; if (toFlush.hasContent() && _outbound.space()>0 && wrap(toFlush)) progress=true; else if (wrap(toFlush)) progress=true; else if (unwrap(toFill)) progress=true; closeInbound(); releaseBuffers(); if (some_progress) _progressed.set(true);