/*
 * Decompiled with CFR 0.152.
 */
package com.l7tech.server.transport.tls;

import com.l7tech.server.transport.tls.SsgConnectorSslHelper;
import java.nio.ByteBuffer;
import javax.net.ssl.SSLEngine;
import javax.net.ssl.SSLEngineResult;
import javax.net.ssl.SSLException;
import javax.net.ssl.SSLSession;

class c
extends SSLEngine {
    boolean a;
    final SSLEngine val$delegate;
    final SsgConnectorSslHelper this$0;

    c(SsgConnectorSslHelper ssgConnectorSslHelper, SSLEngine sSLEngine) {
        this.this$0 = ssgConnectorSslHelper;
        this.val$delegate = sSLEngine;
        this.a = false;
    }

    @Override
    public SSLEngineResult wrap(ByteBuffer[] byteBufferArray, int n2, int n3, ByteBuffer byteBuffer) throws SSLException {
        SSLEngineResult sSLEngineResult = this.val$delegate.wrap(byteBufferArray, n2, n3, byteBuffer);
        this.a(sSLEngineResult);
        return sSLEngineResult;
    }

    @Override
    public SSLEngineResult unwrap(ByteBuffer byteBuffer, ByteBuffer[] byteBufferArray, int n2, int n3) throws SSLException {
        SSLEngineResult sSLEngineResult = this.val$delegate.unwrap(byteBuffer, byteBufferArray, n2, n3);
        this.a(sSLEngineResult);
        return sSLEngineResult;
    }

    private void a(SSLEngineResult sSLEngineResult) {
        if ((SSLEngineResult.HandshakeStatus.FINISHED.equals((Object)sSLEngineResult.getHandshakeStatus()) || SSLEngineResult.HandshakeStatus.NOT_HANDSHAKING.equals((Object)sSLEngineResult.getHandshakeStatus())) && !this.a) {
            this.getSession().invalidate();
            this.setEnableSessionCreation(false);
            this.setEnabledCipherSuites(new String[0]);
            this.a = true;
        }
    }

    @Override
    public Runnable getDelegatedTask() {
        return this.val$delegate.getDelegatedTask();
    }

    @Override
    public void closeInbound() throws SSLException {
        this.val$delegate.closeInbound();
    }

    @Override
    public boolean isInboundDone() {
        return this.val$delegate.isInboundDone();
    }

    @Override
    public void closeOutbound() {
        this.val$delegate.closeOutbound();
    }

    @Override
    public boolean isOutboundDone() {
        return this.val$delegate.isOutboundDone();
    }

    @Override
    public String[] getSupportedCipherSuites() {
        return this.this$0.h;
    }

    @Override
    public String[] getEnabledCipherSuites() {
        return this.this$0.h;
    }

    @Override
    public void setEnabledCipherSuites(String[] stringArray) {
    }

    @Override
    public String[] getSupportedProtocols() {
        return this.this$0.g;
    }

    @Override
    public String[] getEnabledProtocols() {
        return this.this$0.g;
    }

    @Override
    public void setEnabledProtocols(String[] stringArray) {
    }

    @Override
    public SSLSession getSession() {
        return this.val$delegate.getSession();
    }

    @Override
    public void beginHandshake() throws SSLException {
        this.val$delegate.beginHandshake();
    }

    @Override
    public SSLEngineResult.HandshakeStatus getHandshakeStatus() {
        return this.val$delegate.getHandshakeStatus();
    }

    @Override
    public void setUseClientMode(boolean bl2) {
        this.val$delegate.setUseClientMode(bl2);
    }

    @Override
    public boolean getUseClientMode() {
        return this.val$delegate.getUseClientMode();
    }

    @Override
    public void setNeedClientAuth(boolean bl2) {
        this.val$delegate.setNeedClientAuth(bl2);
    }

    @Override
    public boolean getNeedClientAuth() {
        return this.val$delegate.getNeedClientAuth();
    }

    @Override
    public void setWantClientAuth(boolean bl2) {
    }

    @Override
    public boolean getWantClientAuth() {
        return this.val$delegate.getWantClientAuth();
    }

    @Override
    public void setEnableSessionCreation(boolean bl2) {
    }

    @Override
    public boolean getEnableSessionCreation() {
        return this.val$delegate.getEnableSessionCreation();
    }
}

