diff --git a/handler/src/main/java/io/netty/handler/ssl/ExtendedOpenSslSession.java b/handler/src/main/java/io/netty/handler/ssl/ExtendedOpenSslSession.java index 13fa009bb264..7e74670a06a1 100644 --- a/handler/src/main/java/io/netty/handler/ssl/ExtendedOpenSslSession.java +++ b/handler/src/main/java/io/netty/handler/ssl/ExtendedOpenSslSession.java @@ -28,7 +28,6 @@ import java.security.cert.Certificate; import java.util.Collections; import java.util.List; -import java.util.Map; /** * Delegates all operations to a wrapped {@link OpenSslSession} except the methods defined by {@link ExtendedSSLSession} @@ -249,6 +248,16 @@ public void handshakeFinished(byte[] id, String cipher, String protocol, byte[] wrapped.handshakeFinished(id, cipher, protocol, peerCertificate, peerCertificateChain, creationTime, timeout); } + @Override + public boolean equals(Object o) { + return wrapped.equals(o); + } + + @Override + public int hashCode() { + return wrapped.hashCode(); + } + @Override public String toString() { return "ExtendedOpenSslSession{" + diff --git a/handler/src/main/java/io/netty/handler/ssl/ReferenceCountedOpenSslEngine.java b/handler/src/main/java/io/netty/handler/ssl/ReferenceCountedOpenSslEngine.java index cd777173630b..ef6d9bd57847 100644 --- a/handler/src/main/java/io/netty/handler/ssl/ReferenceCountedOpenSslEngine.java +++ b/handler/src/main/java/io/netty/handler/ssl/ReferenceCountedOpenSslEngine.java @@ -2714,6 +2714,23 @@ public String toString() { ", id=" + id + '}'; } + + @Override + public int hashCode() { + return sessionId().hashCode(); + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + // We trust all sub-types as we use different types but the interface is package-private + if (!(o instanceof OpenSslSession)) { + return false; + } + return sessionId().equals(((OpenSslSession) o).sessionId()); + } } private interface NativeSslException {