Example usage for javax.net.ssl SSLEngine getPeerPort

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

Introduction

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

Prototype

public int getPeerPort() 

Source Link

Document

Returns the port number of the peer.

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 {/*from   w w w.j a va 2 s  .c om*/
            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);
        }
    }
}