All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.bouncycastle.jsse.provider.ImpersonateTlsClientProtocol Maven / Gradle / Ivy

There is a newer version: 1.0.6
Show newest version
package org.bouncycastle.jsse.provider;

import com.github.zhkl0228.impersonator.Impersonator;
import org.bouncycastle.tls.TlsSession;

import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;

class ImpersonateTlsClientProtocol extends ProvTlsClientProtocol {

    private final Impersonator impersonator;

    ImpersonateTlsClientProtocol(InputStream input, OutputStream output, Closeable closeable, Impersonator impersonator) {
        super(input, output, closeable);
        this.impersonator = impersonator;
    }

    @Override
    protected boolean establishSession(TlsSession sessionToResume) {
        try {
            impersonator.onEstablishSession(clientExtensions);
        } catch (IOException e) {
            throw new IllegalStateException("establishSession", e);
        }
        return super.establishSession(sessionToResume);
    }

    @Override
    protected void sendClientHelloMessage() throws IOException {
        try {
            impersonator.onSendClientHelloMessage(clientExtensions);
        } catch (IOException e) {
            throw new IllegalStateException("sendClientHelloMessage", e);
        }
        super.sendClientHelloMessage();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy