1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28 package org.apache.http.impl.nio.reactor;
29
30 import javax.net.ssl.SSLContext;
31 import javax.net.ssl.SSLException;
32
33 import org.apache.http.nio.reactor.IOSession;
34 import org.apache.http.params.HttpParams;
35
36
37
38
39
40
41
42
43
44 @Deprecated
45 public class SSLIOSession extends org.apache.http.nio.reactor.ssl.SSLIOSession {
46
47
48
49
50 public SSLIOSession(
51 final IOSession session,
52 final SSLContext sslContext,
53 final SSLSetupHandler handler) {
54 super(session, org.apache.http.nio.reactor.ssl.SSLMode.CLIENT,
55 sslContext, handler != null ? new SSLSetupHandlerAdaptor(handler) : null);
56 }
57
58 public SSLIOSession(
59 final IOSession session,
60 final SSLContext sslContext,
61 final SSLIOSessionHandler handler) {
62 super(session, org.apache.http.nio.reactor.ssl.SSLMode.CLIENT,
63 sslContext, handler != null ? new SSLIOSessionHandlerAdaptor(handler) : null);
64 }
65
66 public synchronized void bind(
67 final SSLMode mode,
68 final HttpParams params) throws SSLException {
69 final org.apache.http.nio.reactor.ssl.SSLSetupHandler handler = getSSLSetupHandler();
70 if (handler instanceof SSLIOSessionHandlerAdaptor) {
71 ((SSLIOSessionHandlerAdaptor) handler).setParams(params);
72 } else if (handler instanceof SSLSetupHandlerAdaptor) {
73 ((SSLSetupHandlerAdaptor) handler).setParams(params);
74 }
75 initialize(convert(mode));
76 }
77
78 private org.apache.http.nio.reactor.ssl.SSLMode convert(final SSLMode mode) {
79 switch(mode) {
80 case CLIENT:
81 return org.apache.http.nio.reactor.ssl.SSLMode.CLIENT;
82 case SERVER:
83 return org.apache.http.nio.reactor.ssl.SSLMode.SERVER;
84 }
85 return null;
86 }
87
88 }