javax.net.ssl.SSLEngine.beginHandshake()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(5.6k)|赞(0)|评价(0)|浏览(320)

本文整理了Java中javax.net.ssl.SSLEngine.beginHandshake()方法的一些代码示例,展示了SSLEngine.beginHandshake()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。SSLEngine.beginHandshake()方法的具体详情如下:
包路径:javax.net.ssl.SSLEngine
类名称:SSLEngine
方法名:beginHandshake

SSLEngine.beginHandshake介绍

[英]Initiates a handshake on this engine.

Calling this method is not needed for the initial handshake: it will be called by wrap or unwrap if the initial handshake has not been started yet.
[中]启动此引擎上的握手。
初始握手不需要调用此方法:如果初始握手尚未开始,将通过wrap或unwrap调用此方法。

代码示例

代码示例来源:origin: apache/kafka

  1. void beginHandshake() throws SSLException {
  2. sslEngine.beginHandshake();
  3. }

代码示例来源:origin: redisson/redisson

  1. @Override
  2. public void beginHandshake() throws SSLException {
  3. engine.beginHandshake();
  4. }

代码示例来源:origin: wildfly/wildfly

  1. /**
  2. * Begins handshake.
  3. *
  4. * @throws IOException if an I/O error occurs
  5. */
  6. public void beginHandshake() throws IOException {
  7. engine.beginHandshake();
  8. }

代码示例来源:origin: wildfly/wildfly

  1. public void startHandshake() throws SSLException {
  2. state |= FLAG_READ_REQUIRES_WRITE;
  3. engine.beginHandshake();
  4. }

代码示例来源:origin: wildfly/wildfly

  1. @Override
  2. public void beginHandshake() throws SSLException {
  3. engine.beginHandshake();
  4. }

代码示例来源:origin: wildfly/wildfly

  1. @Override
  2. public void beginHandshake() throws SSLException {
  3. delegate.beginHandshake();
  4. }

代码示例来源:origin: wildfly/wildfly

  1. @Override
  2. public void beginHandshake() throws SSLException {
  3. delegate.beginHandshake();
  4. }

代码示例来源:origin: wildfly/wildfly

  1. public void beginHandshake() throws SSLException {
  2. delegate.beginHandshake();
  3. }

代码示例来源:origin: io.netty/netty

  1. @Override
  2. public void beginHandshake() throws SSLException {
  3. engine.beginHandshake();
  4. }

代码示例来源:origin: wildfly/wildfly

  1. public void beginHandshake() throws SSLException {
  2. currentRef.get().beginHandshake();
  3. }

代码示例来源:origin: wildfly/wildfly

  1. public void beginHandshake() throws SSLException {
  2. currentRef.get().beginHandshake();
  3. }

代码示例来源:origin: wildfly/wildfly

  1. public void beginHandshake() throws SSLException {
  2. currentRef.get().beginHandshake();
  3. }

代码示例来源:origin: jersey/jersey

  1. /**
  2. * Only for test.
  3. */
  4. void rehandshake() {
  5. try {
  6. sslEngine.beginHandshake();
  7. } catch (SSLException e) {
  8. handleSslError(e);
  9. }
  10. }

代码示例来源:origin: apache/kafka

  1. protected void startHandshake() throws IOException {
  2. if (state != State.NOT_INITALIZED)
  3. throw new IllegalStateException("startHandshake() can only be called once, state " + state);
  4. this.netReadBuffer = ByteBuffer.allocate(netReadBufferSize());
  5. this.netWriteBuffer = ByteBuffer.allocate(netWriteBufferSize());
  6. this.appReadBuffer = ByteBuffer.allocate(applicationBufferSize());
  7. //clear & set netRead & netWrite buffers
  8. netWriteBuffer.position(0);
  9. netWriteBuffer.limit(0);
  10. netReadBuffer.position(0);
  11. netReadBuffer.limit(0);
  12. state = State.HANDSHAKE;
  13. //initiate handshake
  14. sslEngine.beginHandshake();
  15. handshakeStatus = sslEngine.getHandshakeStatus();
  16. }

代码示例来源:origin: TooTallNate/Java-WebSocket

  1. public SSLSocketChannel( SocketChannel inputSocketChannel, SSLEngine inputEngine, ExecutorService inputExecutor, SelectionKey key ) throws IOException {
  2. if( inputSocketChannel == null || inputEngine == null || executor == inputExecutor )
  3. throw new IllegalArgumentException( "parameter must not be null" );
  4. this.socketChannel = inputSocketChannel;
  5. this.engine = inputEngine;
  6. this.executor = inputExecutor;
  7. myNetData = ByteBuffer.allocate( engine.getSession().getPacketBufferSize() );
  8. peerNetData = ByteBuffer.allocate( engine.getSession().getPacketBufferSize() );
  9. this.engine.beginHandshake();
  10. if( doHandshake() ) {
  11. if( key != null ) {
  12. key.interestOps( key.interestOps() | SelectionKey.OP_WRITE );
  13. }
  14. } else {
  15. try {
  16. socketChannel.close();
  17. } catch ( IOException e ) {
  18. log.error("Exception during the closing of the channel", e);
  19. }
  20. }
  21. }

代码示例来源:origin: wildfly/wildfly

  1. void beginHandshake() throws IOException {
  2. final int state = this.state;
  3. if (anyAreSet(state, READ_FLAG_EOF | WRITE_FLAG_SHUTDOWN)) {
  4. throw new ClosedChannelException();
  5. }
  6. if (allAreClear(state, FLAG_TLS)) {
  7. this.state = state | FLAG_TLS;
  8. }
  9. engine.beginHandshake();
  10. }

代码示例来源:origin: jersey/jersey

  1. @Override
  2. void startSsl() {
  3. try {
  4. state = State.HANDSHAKING;
  5. sslEngine.beginHandshake();
  6. doHandshakeStep(emptyBuffer);
  7. } catch (SSLException e) {
  8. handleSslError(e);
  9. }
  10. }

代码示例来源:origin: org.mongodb/mongo-java-driver

  1. private void doHandshake(final boolean force) throws IOException, EofException {
  2. if (!force && negotiated) {
  3. return;
  4. }
  5. if (invalid || shutdownSent) {
  6. throw new ClosedChannelException();
  7. }
  8. initLock.lock();
  9. try {
  10. if (force || !negotiated) {
  11. engine.beginHandshake();
  12. LOGGER.trace("Called engine.beginHandshake()");
  13. handshake(Optional.<ByteBufferSet>empty(), Optional.<HandshakeStatus>empty());
  14. // call client code
  15. try {
  16. initSessionCallback.accept(engine.getSession());
  17. } catch (Exception e) {
  18. LOGGER.trace("client code threw exception in session initialization callback", e);
  19. throw new TlsChannelCallbackException("session initialization callback failed", e);
  20. }
  21. negotiated = true;
  22. }
  23. } finally {
  24. initLock.unlock();
  25. }
  26. }

代码示例来源:origin: redisson/redisson

  1. /**
  2. * Performs TLS (re)negotiation.
  3. */
  4. private void handshake() {
  5. if (engine.getHandshakeStatus() != HandshakeStatus.NOT_HANDSHAKING) {
  6. // Not all SSLEngine implementations support calling beginHandshake multiple times while a handshake
  7. // is in progress. See https://github.com/netty/netty/issues/4718.
  8. return;
  9. } else {
  10. if (handshakePromise.isDone()) {
  11. // If the handshake is done already lets just return directly as there is no need to trigger it again.
  12. // This can happen if the handshake(...) was triggered before we called channelActive(...) by a
  13. // flush() that was triggered by a ChannelFutureListener that was added to the ChannelFuture returned
  14. // from the connect(...) method. In this case we will see the flush() happen before we had a chance to
  15. // call fireChannelActive() on the pipeline.
  16. return;
  17. }
  18. }
  19. // Begin handshake.
  20. final ChannelHandlerContext ctx = this.ctx;
  21. try {
  22. engine.beginHandshake();
  23. wrapNonAppData(ctx, false);
  24. } catch (Throwable e) {
  25. setHandshakeFailure(ctx, e);
  26. } finally {
  27. forceFlush(ctx);
  28. }
  29. }

代码示例来源:origin: wildfly/wildfly

  1. engine.beginHandshake();
  2. wrapNonAppData(ctx, false);
  3. } catch (Throwable e) {

相关文章