Example usage for javax.net.ssl SSLEngine getUseClientMode

List of usage examples for javax.net.ssl SSLEngine getUseClientMode

Introduction

In this page you can find the example usage for javax.net.ssl SSLEngine getUseClientMode.

Prototype

public abstract boolean getUseClientMode();

Source Link

Document

Returns true if the engine is set to use client mode when handshaking.

Usage

From source file:mitm.BouncyCastleSslEngineSource.java

private void filterWeakCipherSuites(SSLEngine sslEngine) {
    List<String> ciphers = new LinkedList<String>();
    for (String each : sslEngine.getEnabledCipherSuites()) {
        if (each.equals(each.equals("TLS_DHE_RSA_WITH_AES_128_CBC_SHA")
                || each.equals("TLS_DHE_RSA_WITH_AES_256_CBC_SHA"))) {
            LOG.debug("Removed cipher {}", each);
        } else {/*w  ww.ja  va 2  s.c o m*/
            ciphers.add(each);
        }
    }
    sslEngine.setEnabledCipherSuites(ciphers.toArray(new String[ciphers.size()]));
    if (LOG.isDebugEnabled()) {
        if (sslEngine.getUseClientMode()) {
            LOG.debug("Enabled server cipher suites:");
        } else {
            String host = sslEngine.getPeerHost();
            int port = sslEngine.getPeerPort();
            LOG.debug("Enabled client {}:{} cipher suites:", host, port);
        }
        for (String each : ciphers) {
            LOG.debug(each);
        }
    }
}