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

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

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

SSLEngine.isOutboundDone介绍

[英]Returns whether no more outbound data will be produced by this engine.
[中]返回此引擎是否不再生成出站数据。

代码示例

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

  1. @Override
  2. public boolean isOutboundDone() {
  3. return engine.isOutboundDone();
  4. }

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

  1. /**
  2. * @return {@code True} if outbound data stream has closed, i.e. SSL engine encoded
  3. * <tt>close_notify</tt> message.
  4. */
  5. boolean isOutboundDone() {
  6. return sslEngine.isOutboundDone();
  7. }

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

  1. @Override
  2. public boolean isOutboundDone() {
  3. return engine.isOutboundDone();
  4. }

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

  1. @Override
  2. public boolean isOutboundDone() {
  3. return delegate.isOutboundDone();
  4. }

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

  1. @Override
  2. public boolean isOutboundDone() {
  3. return delegate.isOutboundDone();
  4. }

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

  1. public boolean isOutboundDone() {
  2. return delegate.isOutboundDone();
  3. }

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

  1. @Override
  2. public boolean isOutboundDone() {
  3. return engine.isOutboundDone();
  4. }

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

  1. public boolean isOutboundDone() {
  2. return currentRef.get().isOutboundDone();
  3. }

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

  1. public boolean isOutboundDone() {
  2. return currentRef.get().isOutboundDone();
  3. }

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

  1. public boolean isOutboundDone() {
  2. return currentRef.get().isOutboundDone();
  3. }

代码示例来源:origin: igniterealtime/Openfire

  1. /**
  2. * Returns whether unwrap(ByteBuffer, ByteBuffer) will accept any more inbound data messages and
  3. * whether wrap(ByteBuffer, ByteBuffer) will produce any more outbound data messages.
  4. *
  5. * @return true if the TLSHandler will not consume anymore network data and will not produce any
  6. * anymore network data.
  7. */
  8. public boolean isEngineClosed() {
  9. return (tlsEngine.isOutboundDone() && tlsEngine.isInboundDone());
  10. }

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

  1. public boolean isClosed() {
  2. return (engine.isOutboundDone() && engine.isInboundDone());
  3. }

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

  1. /**
  2. * Writes close_notify message to the network output buffer.
  3. *
  4. * @throws SSLException If wrap failed or SSL engine does not get closed
  5. * after wrap.
  6. * @return {@code True} if <tt>close_notify</tt> message was encoded, {@code false} if outbound
  7. * stream was already closed.
  8. */
  9. boolean closeOutbound() throws SSLException {
  10. assert isHeldByCurrentThread();
  11. if (!sslEngine.isOutboundDone()) {
  12. sslEngine.closeOutbound();
  13. outNetBuf.clear();
  14. SSLEngineResult res = sslEngine.wrap(handshakeBuf, outNetBuf);
  15. if (res.getStatus() != CLOSED)
  16. throw new SSLException("Incorrect SSL engine status after closeOutbound call [status=" +
  17. res.getStatus() + ", handshakeStatus=" + res.getHandshakeStatus() + ", ses=" + ses + ']');
  18. outNetBuf.flip();
  19. return true;
  20. }
  21. return false;
  22. }

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

  1. if (!engine.isOutboundDone()) {
  2. ByteBuffer empty = ByteBuffer.wrap(new byte[0]);
  3. engine.closeOutbound();

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

  1. @Test
  2. public void closeWhenSocketWriteError() throws Exception {
  3. SocketChannel mockChannel = mock(SocketChannel.class);
  4. Socket mockSocket = mock(Socket.class);
  5. when(mockChannel.socket()).thenReturn(mockSocket);
  6. when(mockSocket.isClosed()).thenReturn(true);
  7. when(mockEngine.isOutboundDone()).thenReturn(Boolean.FALSE);
  8. when(mockEngine.wrap(any(ByteBuffer.class), any(ByteBuffer.class))).thenAnswer((x) -> {
  9. // give the NioSslEngine something to write on its socket channel, simulating a TLS close
  10. // message
  11. nioSslEngine.myNetData.put("Goodbye cruel world".getBytes());
  12. return new SSLEngineResult(CLOSED, FINISHED, 0, 0);
  13. });
  14. when(mockChannel.write(any(ByteBuffer.class))).thenThrow(new ClosedChannelException());
  15. nioSslEngine.close(mockChannel);
  16. verify(mockChannel, times(1)).write(any(ByteBuffer.class));
  17. }

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

  1. @Test
  2. public void closeWhenUnwrapError() throws Exception {
  3. SocketChannel mockChannel = mock(SocketChannel.class);
  4. Socket mockSocket = mock(Socket.class);
  5. when(mockChannel.socket()).thenReturn(mockSocket);
  6. when(mockSocket.isClosed()).thenReturn(true);
  7. when(mockEngine.isOutboundDone()).thenReturn(Boolean.FALSE);
  8. when(mockEngine.wrap(any(ByteBuffer.class), any(ByteBuffer.class))).thenReturn(
  9. new SSLEngineResult(BUFFER_OVERFLOW, FINISHED, 0, 0));
  10. assertThatThrownBy(() -> nioSslEngine.close(mockChannel)).isInstanceOf(GemFireIOException.class)
  11. .hasMessageContaining("exception closing SSL session")
  12. .hasCauseInstanceOf(SSLException.class);
  13. }

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

  1. @Test
  2. public void close() throws Exception {
  3. SocketChannel mockChannel = mock(SocketChannel.class);
  4. Socket mockSocket = mock(Socket.class);
  5. when(mockChannel.socket()).thenReturn(mockSocket);
  6. when(mockSocket.isClosed()).thenReturn(false);
  7. when(mockEngine.isOutboundDone()).thenReturn(Boolean.FALSE);
  8. when(mockEngine.wrap(any(ByteBuffer.class), any(ByteBuffer.class))).thenReturn(
  9. new SSLEngineResult(CLOSED, FINISHED, 0, 0));
  10. nioSslEngine.close(mockChannel);
  11. assertThatThrownBy(() -> nioSslEngine.checkClosed()).isInstanceOf(IllegalStateException.class);
  12. nioSslEngine.close(mockChannel);
  13. }

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

  1. && !sslEngine.isOutboundDone()) {
  2. state = State.REHANDSHAKING;
  3. return doHandshakeStep(networkData);

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

  1. /**
  2. * Attempt to finish wrapping close handshake bytes.
  3. *
  4. * @return {@code true} only if all bytes concerning close handshake messages have been wrapped.
  5. * @throws IOException if an unexpected IO exception occurs
  6. */
  7. private boolean wrapCloseMessage() throws IOException {
  8. assert ! Thread.holdsLock(getUnwrapLock());
  9. assert Thread.holdsLock(getWrapLock());
  10. if (sinkConduit.isWriteShutdown()) {
  11. return true;
  12. }
  13. final ByteBuffer buffer = sendBuffer.getResource();
  14. if (!engine.isOutboundDone() || !engine.isInboundDone()) {
  15. SSLEngineResult result;
  16. do {
  17. if (!handleWrapResult(result = engineWrap(Buffers.EMPTY_BYTE_BUFFER, buffer), true)) {
  18. return false;
  19. }
  20. } while (handleHandshake(result, true) && (result.getHandshakeStatus() != HandshakeStatus.NEED_UNWRAP || !engine.isOutboundDone()));
  21. handleWrapResult(result = engineWrap(Buffers.EMPTY_BYTE_BUFFER, buffer), true);
  22. if (!engine.isOutboundDone() || (result.getHandshakeStatus() != HandshakeStatus.NOT_HANDSHAKING &&
  23. result.getHandshakeStatus() != HandshakeStatus.NEED_UNWRAP)) {
  24. return false;
  25. }
  26. }
  27. return true;
  28. }

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

  1. oldState = stateUpdater.get(this);
  2. if (allAreSet(oldState, WRITE_COMPLETE)) {
  3. if (engine.isOutboundDone()) {
  4. connection.writeClosed();
  5. if (engine.isOutboundDone()) {
  6. connection.writeClosed();
  7. oldState = stateUpdater.get(this);
  8. if (allAreSet(oldState, WRITE_COMPLETE)) {
  9. if (engine.isOutboundDone()) {
  10. connection.writeClosed();
  11. closeEngine();
  12. if (engine.isOutboundDone()) {
  13. connection.writeClosed();

相关文章