@Override public NextAction handleEvent(final FilterChainContext ctx, final FilterChainEvent event) throws IOException { if (event.type() == SSLSwitchingEvent.class) { final SSLSwitchingEvent se = (SSLSwitchingEvent) event; final boolean isSecure = se.isSecure(); CONNECTION_IS_SECURE.set(se.getConnection(), isSecure); // if enabling security - create SSLEngine here, because default // Grizzly SSLFilter will use host/port info from the Connection, rather // than request URL. Specifically this doesn't work with CONNECT tunnels. if (isSecure && SSLUtils.getSSLEngine(ctx.getConnection()) == null) { // if SSLEngine is not yet set for the connection - initialize it final SSLEngine sslEngine = getClientSSLEngineConfigurator() .createSSLEngine(se.getHost(), se.getPort() == -1 ? 443 : se.getPort() ); sslEngine.beginHandshake(); SSLUtils.setSSLEngine(ctx.getConnection(), sslEngine); } return ctx.getStopAction(); } return ctx.getInvokeAction(); }
public Future<SSLEngine> handshake(final SSLStreamReader sslStreamReader, final SSLEngineConfigurator configurator, final CompletionHandler<SSLEngine> completionHandler) throws IOException { final Connection connection = getConnection(); SSLEngine sslEngine = SSLUtils.getSSLEngine(getConnection()); if (sslEngine == null) { sslEngine = configurator.createSSLEngine(); SSLUtils.setSSLEngine(connection, sslEngine); checkBuffers(connection, sslEngine); } final boolean isLoggingFinest = logger.isLoggable(Level.FINEST); if (isLoggingFinest) { logger.log(Level.FINEST, "connection={0} engine={1} handshakeStatus={2}", new Object[]{connection, sslEngine, sslEngine.getHandshakeStatus()}); } HandshakeStatus handshakeStatus = sslEngine.getHandshakeStatus(); if (handshakeStatus == HandshakeStatus.NOT_HANDSHAKING) { sslEngine.beginHandshake(); } final FutureImpl<SSLEngine> future = SafeFutureImpl.create(); final HandshakeCompletionHandler hsCompletionHandler = new HandshakeCompletionHandler(future, completionHandler, sslEngine); sslStreamReader.notifyCondition(new SSLHandshakeCondition(sslStreamReader, this, configurator, sslEngine, hsCompletionHandler), hsCompletionHandler); return future; }
public Future<SSLEngine> handshake(final SSLStreamReader sslStreamReader, final SSLEngineConfigurator configurator, final CompletionHandler<SSLEngine> completionHandler) throws IOException { final Connection connection = getConnection(); SSLEngine sslEngine = SSLUtils.getSSLEngine(getConnection()); if (sslEngine == null) { sslEngine = configurator.createSSLEngine(); SSLUtils.setSSLEngine(connection, sslEngine); checkBuffers(connection, sslEngine); } final boolean isLoggingFinest = logger.isLoggable(Level.FINEST); if (isLoggingFinest) { logger.log(Level.FINEST, "connection={0} engine={1} handshakeStatus={2}", new Object[]{connection, sslEngine, sslEngine.getHandshakeStatus()}); } HandshakeStatus handshakeStatus = sslEngine.getHandshakeStatus(); if (handshakeStatus == HandshakeStatus.NOT_HANDSHAKING) { sslEngine.beginHandshake(); } final FutureImpl<SSLEngine> future = SafeFutureImpl.create(); final HandshakeCompletionHandler hsCompletionHandler = new HandshakeCompletionHandler(future, completionHandler, sslEngine); sslStreamReader.notifyCondition(new SSLHandshakeCondition(sslStreamReader, this, configurator, sslEngine, hsCompletionHandler), hsCompletionHandler); return future; }
public Future<SSLEngine> handshake(final SSLStreamReader sslStreamReader, final SSLEngineConfigurator configurator, final CompletionHandler<SSLEngine> completionHandler) throws IOException { final Connection connection = getConnection(); SSLEngine sslEngine = SSLUtils.getSSLEngine(getConnection()); if (sslEngine == null) { sslEngine = configurator.createSSLEngine(); SSLUtils.setSSLEngine(connection, sslEngine); checkBuffers(connection, sslEngine); } final boolean isLoggingFinest = logger.isLoggable(Level.FINEST); if (isLoggingFinest) { logger.log(Level.FINEST, "connection={0} engine={1} handshakeStatus={2}", new Object[]{connection, sslEngine, sslEngine.getHandshakeStatus()}); } HandshakeStatus handshakeStatus = sslEngine.getHandshakeStatus(); if (handshakeStatus == HandshakeStatus.NOT_HANDSHAKING) { sslEngine.beginHandshake(); } final FutureImpl<SSLEngine> future = SafeFutureImpl.create(); final HandshakeCompletionHandler hsCompletionHandler = new HandshakeCompletionHandler(future, completionHandler, sslEngine); sslStreamReader.notifyCondition(new SSLHandshakeCondition(sslStreamReader, this, configurator, sslEngine, hsCompletionHandler), hsCompletionHandler); return future; }
public Future<SSLEngine> handshake(final SSLStreamReader sslStreamReader, final SSLEngineConfigurator configurator, final CompletionHandler<SSLEngine> completionHandler) throws IOException { final Connection connection = getConnection(); SSLEngine sslEngine = SSLUtils.getSSLEngine(getConnection()); if (sslEngine == null) { sslEngine = configurator.createSSLEngine(); SSLUtils.setSSLEngine(connection, sslEngine); checkBuffers(connection, sslEngine); } final boolean isLoggingFinest = logger.isLoggable(Level.FINEST); if (isLoggingFinest) { logger.log(Level.FINEST, "connection={0} engine={1} handshakeStatus={2}", new Object[]{connection, sslEngine, sslEngine.getHandshakeStatus()}); } HandshakeStatus handshakeStatus = sslEngine.getHandshakeStatus(); if (handshakeStatus == HandshakeStatus.NOT_HANDSHAKING) { sslEngine.beginHandshake(); } final FutureImpl<SSLEngine> future = SafeFutureImpl.create(); final HandshakeCompletionHandler hsCompletionHandler = new HandshakeCompletionHandler(future, completionHandler, sslEngine); sslStreamReader.notifyCondition(new SSLHandshakeCondition(sslStreamReader, this, configurator, sslEngine, hsCompletionHandler), hsCompletionHandler); return future; }
public Future<SSLEngine> handshake(final SSLStreamReader sslStreamReader, final SSLEngineConfigurator configurator, final CompletionHandler<SSLEngine> completionHandler) throws IOException { final Connection connection = getConnection(); SSLEngine sslEngine = SSLUtils.getSSLEngine(getConnection()); if (sslEngine == null) { sslEngine = configurator.createSSLEngine(); SSLUtils.setSSLEngine(connection, sslEngine); checkBuffers(connection, sslEngine); } final boolean isLoggingFinest = logger.isLoggable(Level.FINEST); if (isLoggingFinest) { logger.log(Level.FINEST, "connection={0} engine={1} handshakeStatus={2}", new Object[]{connection, sslEngine, sslEngine.getHandshakeStatus()}); } HandshakeStatus handshakeStatus = sslEngine.getHandshakeStatus(); if (handshakeStatus == HandshakeStatus.NOT_HANDSHAKING) { sslEngine.beginHandshake(); } final FutureImpl<SSLEngine> future = SafeFutureImpl.create(); final HandshakeCompletionHandler hsCompletionHandler = new HandshakeCompletionHandler(future, completionHandler, sslEngine); sslStreamReader.notifyCondition(new SSLHandshakeCondition(sslStreamReader, this, configurator, sslEngine, hsCompletionHandler), hsCompletionHandler); return future; }
public Future<SSLEngine> handshake(final SSLStreamReader sslStreamReader, final SSLEngineConfigurator configurator, final CompletionHandler<SSLEngine> completionHandler) throws IOException { final Connection connection = getConnection(); SSLEngine sslEngine = SSLUtils.getSSLEngine(getConnection()); if (sslEngine == null) { sslEngine = configurator.createSSLEngine(); SSLUtils.setSSLEngine(connection, sslEngine); checkBuffers(connection, sslEngine); } final boolean isLoggingFinest = logger.isLoggable(Level.FINEST); if (isLoggingFinest) { logger.log(Level.FINEST, "connection={0} engine={1} handshakeStatus={2}", new Object[]{connection, sslEngine, sslEngine.getHandshakeStatus()}); } HandshakeStatus handshakeStatus = sslEngine.getHandshakeStatus(); if (handshakeStatus == HandshakeStatus.NOT_HANDSHAKING) { sslEngine.beginHandshake(); } final FutureImpl<SSLEngine> future = SafeFutureImpl.create(); final HandshakeCompletionHandler hsCompletionHandler = new HandshakeCompletionHandler(future, completionHandler, sslEngine); sslStreamReader.notifyCondition(new SSLHandshakeCondition(sslStreamReader, this, configurator, sslEngine, hsCompletionHandler), hsCompletionHandler); return future; }
public Future<SSLEngine> handshake(final SSLStreamReader sslStreamReader, final SSLEngineConfigurator configurator, final CompletionHandler<SSLEngine> completionHandler) throws IOException { final Connection connection = getConnection(); SSLEngine sslEngine = SSLUtils.getSSLEngine(getConnection()); if (sslEngine == null) { sslEngine = configurator.createSSLEngine(); SSLUtils.setSSLEngine(connection, sslEngine); checkBuffers(connection, sslEngine); } final boolean isLoggingFinest = logger.isLoggable(Level.FINEST); if (isLoggingFinest) { logger.log(Level.FINEST, "connection={0} engine={1} handshakeStatus={2}", new Object[]{connection, sslEngine, sslEngine.getHandshakeStatus()}); } HandshakeStatus handshakeStatus = sslEngine.getHandshakeStatus(); if (handshakeStatus == HandshakeStatus.NOT_HANDSHAKING) { sslEngine.beginHandshake(); } final FutureImpl<SSLEngine> future = SafeFutureImpl.create(); final HandshakeCompletionHandler hsCompletionHandler = new HandshakeCompletionHandler(future, completionHandler, sslEngine); sslStreamReader.notifyCondition(new SSLHandshakeCondition(sslStreamReader, this, configurator, sslEngine, hsCompletionHandler), hsCompletionHandler); return future; }
public Future<SSLEngine> handshake(final SSLStreamReader sslStreamReader, final SSLEngineConfigurator configurator, final CompletionHandler<SSLEngine> completionHandler) throws IOException { final Connection connection = getConnection(); SSLEngine sslEngine = SSLUtils.getSSLEngine(getConnection()); if (sslEngine == null) { sslEngine = configurator.createSSLEngine(); SSLUtils.setSSLEngine(connection, sslEngine); checkBuffers(connection, sslEngine); } final boolean isLoggingFinest = logger.isLoggable(Level.FINEST); if (isLoggingFinest) { logger.log(Level.FINEST, "connection={0} engine={1} handshakeStatus={2}", new Object[]{connection, sslEngine, sslEngine.getHandshakeStatus()}); } HandshakeStatus handshakeStatus = sslEngine.getHandshakeStatus(); if (handshakeStatus == HandshakeStatus.NOT_HANDSHAKING) { sslEngine.beginHandshake(); } final FutureImpl<SSLEngine> future = SafeFutureImpl.create(); final HandshakeCompletionHandler hsCompletionHandler = new HandshakeCompletionHandler(future, completionHandler, sslEngine); sslStreamReader.notifyCondition(new SSLHandshakeCondition(sslStreamReader, this, configurator, sslEngine, hsCompletionHandler), hsCompletionHandler); return future; }
public Future<SSLEngine> handshake(final SSLStreamReader sslStreamReader, final SSLEngineConfigurator configurator, final CompletionHandler<SSLEngine> completionHandler) throws IOException { final Connection connection = getConnection(); SSLEngine sslEngine = SSLUtils.getSSLEngine(getConnection()); if (sslEngine == null) { sslEngine = configurator.createSSLEngine(); SSLUtils.setSSLEngine(connection, sslEngine); checkBuffers(connection, sslEngine); } final boolean isLoggingFinest = logger.isLoggable(Level.FINEST); if (isLoggingFinest) { logger.log(Level.FINEST, "connection={0} engine={1} handshakeStatus={2}", new Object[]{connection, sslEngine, sslEngine.getHandshakeStatus()}); } HandshakeStatus handshakeStatus = sslEngine.getHandshakeStatus(); if (handshakeStatus == HandshakeStatus.NOT_HANDSHAKING) { sslEngine.beginHandshake(); } final FutureImpl<SSLEngine> future = SafeFutureImpl.create(); final HandshakeCompletionHandler hsCompletionHandler = new HandshakeCompletionHandler(future, completionHandler, sslEngine); sslStreamReader.notifyCondition(new SSLHandshakeCondition(sslStreamReader, this, configurator, sslEngine, hsCompletionHandler), hsCompletionHandler); return future; }
public Future<SSLEngine> handshake(final SSLStreamReader sslStreamReader, final SSLEngineConfigurator configurator, final CompletionHandler<SSLEngine> completionHandler) throws IOException { final Connection connection = getConnection(); SSLEngine sslEngine = SSLUtils.getSSLEngine(getConnection()); if (sslEngine == null) { sslEngine = configurator.createSSLEngine(); SSLUtils.setSSLEngine(connection, sslEngine); checkBuffers(connection, sslEngine); } final boolean isLoggingFinest = logger.isLoggable(Level.FINEST); if (isLoggingFinest) { logger.log(Level.FINEST, "connection={0} engine={1} handshakeStatus={2}", new Object[]{connection, sslEngine, sslEngine.getHandshakeStatus()}); } HandshakeStatus handshakeStatus = sslEngine.getHandshakeStatus(); if (handshakeStatus == HandshakeStatus.NOT_HANDSHAKING) { sslEngine.beginHandshake(); } final FutureImpl<SSLEngine> future = SafeFutureImpl.create(); final HandshakeCompletionHandler hsCompletionHandler = new HandshakeCompletionHandler(future, completionHandler, sslEngine); sslStreamReader.notifyCondition(new SSLHandshakeCondition(sslStreamReader, this, configurator, sslEngine, hsCompletionHandler), hsCompletionHandler); return future; }
public Future<SSLEngine> handshake(final SSLStreamReader sslStreamReader, final SSLEngineConfigurator configurator, final CompletionHandler<SSLEngine> completionHandler) throws IOException { final Connection connection = getConnection(); SSLEngine sslEngine = SSLUtils.getSSLEngine(getConnection()); if (sslEngine == null) { sslEngine = configurator.createSSLEngine(); SSLUtils.setSSLEngine(connection, sslEngine); checkBuffers(connection, sslEngine); } final boolean isLoggingFinest = logger.isLoggable(Level.FINEST); if (isLoggingFinest) { logger.log(Level.FINEST, "connection={0} engine={1} handshakeStatus={2}", new Object[]{connection, sslEngine, sslEngine.getHandshakeStatus()}); } HandshakeStatus handshakeStatus = sslEngine.getHandshakeStatus(); if (handshakeStatus == HandshakeStatus.NOT_HANDSHAKING) { sslEngine.beginHandshake(); } final FutureImpl<SSLEngine> future = SafeFutureImpl.create(); final HandshakeCompletionHandler hsCompletionHandler = new HandshakeCompletionHandler(future, completionHandler, sslEngine); sslStreamReader.notifyCondition(new SSLHandshakeCondition(sslStreamReader, this, configurator, sslEngine, hsCompletionHandler), hsCompletionHandler); return future; }
public Future<SSLEngine> handshake(final SSLStreamReader sslStreamReader, final SSLEngineConfigurator configurator, final CompletionHandler<SSLEngine> completionHandler) throws IOException { final Connection connection = getConnection(); SSLEngine sslEngine = SSLUtils.getSSLEngine(getConnection()); if (sslEngine == null) { sslEngine = configurator.createSSLEngine(); SSLUtils.setSSLEngine(connection, sslEngine); checkBuffers(connection, sslEngine); } final boolean isLoggingFinest = logger.isLoggable(Level.FINEST); if (isLoggingFinest) { logger.log(Level.FINEST, "connection={0} engine={1} handshakeStatus={2}", new Object[]{connection, sslEngine, sslEngine.getHandshakeStatus()}); } HandshakeStatus handshakeStatus = sslEngine.getHandshakeStatus(); if (handshakeStatus == HandshakeStatus.NOT_HANDSHAKING) { sslEngine.beginHandshake(); } final FutureImpl<SSLEngine> future = SafeFutureImpl.create(); final HandshakeCompletionHandler hsCompletionHandler = new HandshakeCompletionHandler(future, completionHandler, sslEngine); sslStreamReader.notifyCondition(new SSLHandshakeCondition(sslStreamReader, this, configurator, sslEngine, hsCompletionHandler), hsCompletionHandler); return future; }
@Override public NextAction handleEvent(final FilterChainContext ctx, final FilterChainEvent event) throws IOException { if (event.type() == SSLSwitchingEvent.class) { final SSLSwitchingEvent se = (SSLSwitchingEvent) event; final boolean isSecure = se.isSecure(); CONNECTION_IS_SECURE.set(se.getConnection(), isSecure); // if enabling security - create SSLEngine here, because default // Grizzly SSLFilter will use host/port info from the Connection, rather // than request URL. Specifically this doesn't work with CONNECT tunnels. if (isSecure && SSLUtils.getSSLEngine(ctx.getConnection()) == null) { // if SSLEngine is not yet set for the connection - initialize it final SSLEngine sslEngine = getClientSSLEngineConfigurator() .createSSLEngine(se.getHost(), se.getPort() == -1 ? 443 : se.getPort() ); sslEngine.beginHandshake(); SSLUtils.setSSLEngine(ctx.getConnection(), sslEngine); } return ctx.getStopAction(); } return ctx.getInvokeAction(); }
@Override public NextAction handleEvent(final FilterChainContext ctx, final FilterChainEvent event) throws IOException { if (event.type() == SSLSwitchingEvent.class) { final SSLSwitchingEvent se = (SSLSwitchingEvent) event; final boolean isSecure = se.isSecure(); CONNECTION_IS_SECURE.set(se.getConnection(), isSecure); // if enabling security - create SSLEngine here, because default // Grizzly SSLFilter will use host/port info from the Connection, rather // than request URL. Specifically this doesn't work with CONNECT tunnels. if (isSecure && SSLUtils.getSSLEngine(ctx.getConnection()) == null) { // if SSLEngine is not yet set for the connection - initialize it final SSLEngine sslEngine = getClientSSLEngineConfigurator() .createSSLEngine(se.getHost(), se.getPort() == -1 ? 443 : se.getPort() ); sslEngine.beginHandshake(); SSLUtils.setSSLEngine(ctx.getConnection(), sslEngine); } return ctx.getStopAction(); } return ctx.getInvokeAction(); }
@Override public NextAction handleEvent(final FilterChainContext ctx, final FilterChainEvent event) throws IOException { if (event.type() == SSLSwitchingEvent.class) { final SSLSwitchingEvent se = (SSLSwitchingEvent) event; final boolean isSecure = se.isSecure(); CONNECTION_IS_SECURE.set(se.getConnection(), isSecure); // if enabling security - create SSLEngine here, because default // Grizzly SSLFilter will use host/port info from the Connection, rather // than request URL. Specifically this doesn't work with CONNECT tunnels. if (isSecure && SSLUtils.getSSLEngine(ctx.getConnection()) == null) { // if SSLEngine is not yet set for the connection - initialize it final SSLEngine sslEngine = getClientSSLEngineConfigurator() .createSSLEngine(se.getHost(), se.getPort() == -1 ? 443 : se.getPort() ); sslEngine.beginHandshake(); SSLUtils.setSSLEngine(ctx.getConnection(), sslEngine); } return ctx.getStopAction(); } return ctx.getInvokeAction(); }