1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package io.netty5.handler.ssl;
17
18 import io.netty5.handler.codec.ProtocolEvent;
19
20 import javax.net.ssl.SSLSession;
21
22 import static java.util.Objects.requireNonNull;
23
24
25
26
27 public abstract class SslCompletionEvent implements ProtocolEvent {
28 private final SSLSession session;
29 private final Throwable cause;
30
31 SslCompletionEvent(SSLSession session) {
32 this.session = session;
33 cause = null;
34 }
35
36 SslCompletionEvent(SSLSession session, Throwable cause) {
37 this.session = session;
38 this.cause = requireNonNull(cause, "cause");
39 }
40
41
42
43
44
45 public final Throwable cause() {
46 return cause;
47 }
48
49
50
51
52
53
54 public SSLSession session() {
55 return session;
56 }
57
58 @Override
59 public String toString() {
60 final Throwable cause = cause();
61 return cause == null? getClass().getSimpleName() + "(SUCCESS)" :
62 getClass().getSimpleName() + '(' + cause + ')';
63 }
64 }