本文整理了Java中javax.net.ssl.SSLEngine.beginHandshake()
方法的一些代码示例,展示了SSLEngine.beginHandshake()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。SSLEngine.beginHandshake()
方法的具体详情如下:
包路径:javax.net.ssl.SSLEngine
类名称: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
void beginHandshake() throws SSLException {
sslEngine.beginHandshake();
}
代码示例来源:origin: redisson/redisson
@Override
public void beginHandshake() throws SSLException {
engine.beginHandshake();
}
代码示例来源:origin: wildfly/wildfly
/**
* Begins handshake.
*
* @throws IOException if an I/O error occurs
*/
public void beginHandshake() throws IOException {
engine.beginHandshake();
}
代码示例来源:origin: wildfly/wildfly
public void startHandshake() throws SSLException {
state |= FLAG_READ_REQUIRES_WRITE;
engine.beginHandshake();
}
代码示例来源:origin: wildfly/wildfly
@Override
public void beginHandshake() throws SSLException {
engine.beginHandshake();
}
代码示例来源:origin: wildfly/wildfly
@Override
public void beginHandshake() throws SSLException {
delegate.beginHandshake();
}
代码示例来源:origin: wildfly/wildfly
@Override
public void beginHandshake() throws SSLException {
delegate.beginHandshake();
}
代码示例来源:origin: wildfly/wildfly
public void beginHandshake() throws SSLException {
delegate.beginHandshake();
}
代码示例来源:origin: io.netty/netty
@Override
public void beginHandshake() throws SSLException {
engine.beginHandshake();
}
代码示例来源:origin: wildfly/wildfly
public void beginHandshake() throws SSLException {
currentRef.get().beginHandshake();
}
代码示例来源:origin: wildfly/wildfly
public void beginHandshake() throws SSLException {
currentRef.get().beginHandshake();
}
代码示例来源:origin: wildfly/wildfly
public void beginHandshake() throws SSLException {
currentRef.get().beginHandshake();
}
代码示例来源:origin: jersey/jersey
/**
* Only for test.
*/
void rehandshake() {
try {
sslEngine.beginHandshake();
} catch (SSLException e) {
handleSslError(e);
}
}
代码示例来源:origin: apache/kafka
protected void startHandshake() throws IOException {
if (state != State.NOT_INITALIZED)
throw new IllegalStateException("startHandshake() can only be called once, state " + state);
this.netReadBuffer = ByteBuffer.allocate(netReadBufferSize());
this.netWriteBuffer = ByteBuffer.allocate(netWriteBufferSize());
this.appReadBuffer = ByteBuffer.allocate(applicationBufferSize());
//clear & set netRead & netWrite buffers
netWriteBuffer.position(0);
netWriteBuffer.limit(0);
netReadBuffer.position(0);
netReadBuffer.limit(0);
state = State.HANDSHAKE;
//initiate handshake
sslEngine.beginHandshake();
handshakeStatus = sslEngine.getHandshakeStatus();
}
代码示例来源:origin: TooTallNate/Java-WebSocket
public SSLSocketChannel( SocketChannel inputSocketChannel, SSLEngine inputEngine, ExecutorService inputExecutor, SelectionKey key ) throws IOException {
if( inputSocketChannel == null || inputEngine == null || executor == inputExecutor )
throw new IllegalArgumentException( "parameter must not be null" );
this.socketChannel = inputSocketChannel;
this.engine = inputEngine;
this.executor = inputExecutor;
myNetData = ByteBuffer.allocate( engine.getSession().getPacketBufferSize() );
peerNetData = ByteBuffer.allocate( engine.getSession().getPacketBufferSize() );
this.engine.beginHandshake();
if( doHandshake() ) {
if( key != null ) {
key.interestOps( key.interestOps() | SelectionKey.OP_WRITE );
}
} else {
try {
socketChannel.close();
} catch ( IOException e ) {
log.error("Exception during the closing of the channel", e);
}
}
}
代码示例来源:origin: wildfly/wildfly
void beginHandshake() throws IOException {
final int state = this.state;
if (anyAreSet(state, READ_FLAG_EOF | WRITE_FLAG_SHUTDOWN)) {
throw new ClosedChannelException();
}
if (allAreClear(state, FLAG_TLS)) {
this.state = state | FLAG_TLS;
}
engine.beginHandshake();
}
代码示例来源:origin: jersey/jersey
@Override
void startSsl() {
try {
state = State.HANDSHAKING;
sslEngine.beginHandshake();
doHandshakeStep(emptyBuffer);
} catch (SSLException e) {
handleSslError(e);
}
}
代码示例来源:origin: org.mongodb/mongo-java-driver
private void doHandshake(final boolean force) throws IOException, EofException {
if (!force && negotiated) {
return;
}
if (invalid || shutdownSent) {
throw new ClosedChannelException();
}
initLock.lock();
try {
if (force || !negotiated) {
engine.beginHandshake();
LOGGER.trace("Called engine.beginHandshake()");
handshake(Optional.<ByteBufferSet>empty(), Optional.<HandshakeStatus>empty());
// call client code
try {
initSessionCallback.accept(engine.getSession());
} catch (Exception e) {
LOGGER.trace("client code threw exception in session initialization callback", e);
throw new TlsChannelCallbackException("session initialization callback failed", e);
}
negotiated = true;
}
} finally {
initLock.unlock();
}
}
代码示例来源:origin: redisson/redisson
/**
* Performs TLS (re)negotiation.
*/
private void handshake() {
if (engine.getHandshakeStatus() != HandshakeStatus.NOT_HANDSHAKING) {
// Not all SSLEngine implementations support calling beginHandshake multiple times while a handshake
// is in progress. See https://github.com/netty/netty/issues/4718.
return;
} else {
if (handshakePromise.isDone()) {
// If the handshake is done already lets just return directly as there is no need to trigger it again.
// This can happen if the handshake(...) was triggered before we called channelActive(...) by a
// flush() that was triggered by a ChannelFutureListener that was added to the ChannelFuture returned
// from the connect(...) method. In this case we will see the flush() happen before we had a chance to
// call fireChannelActive() on the pipeline.
return;
}
}
// Begin handshake.
final ChannelHandlerContext ctx = this.ctx;
try {
engine.beginHandshake();
wrapNonAppData(ctx, false);
} catch (Throwable e) {
setHandshakeFailure(ctx, e);
} finally {
forceFlush(ctx);
}
}
代码示例来源:origin: wildfly/wildfly
engine.beginHandshake();
wrapNonAppData(ctx, false);
} catch (Throwable e) {
内容来源于网络,如有侵权,请联系作者删除!