1   
2   
3   
4   
5   
6   
7   
8   
9   
10  
11  
12  
13  
14  package ch.qos.logback.core.net.ssl;
15  
16  import javax.net.ssl.SSLParameters;
17  import javax.net.ssl.SSLSocket;
18  
19  
20  
21  
22  
23  
24  
25  public class SSLConfigurableSocket implements SSLConfigurable {
26  
27      private final SSLSocket delegate;
28  
29      public SSLConfigurableSocket(SSLSocket delegate) {
30          this.delegate = delegate;
31      }
32  
33      public String[] getDefaultProtocols() {
34          return delegate.getEnabledProtocols();
35      }
36  
37      public String[] getSupportedProtocols() {
38          return delegate.getSupportedProtocols();
39      }
40  
41      public void setEnabledProtocols(String[] protocols) {
42          delegate.setEnabledProtocols(protocols);
43      }
44  
45      public String[] getDefaultCipherSuites() {
46          return delegate.getEnabledCipherSuites();
47      }
48  
49      public String[] getSupportedCipherSuites() {
50          return delegate.getSupportedCipherSuites();
51      }
52  
53      public void setEnabledCipherSuites(String[] suites) {
54          delegate.setEnabledCipherSuites(suites);
55      }
56  
57      public void setNeedClientAuth(boolean state) {
58          delegate.setNeedClientAuth(state);
59      }
60  
61      public void setWantClientAuth(boolean state) {
62          delegate.setWantClientAuth(state);
63      }
64  
65      @Override
66      public void setHostnameVerification(boolean hostnameVerification) {
67          if (!hostnameVerification) {
68              return;
69          }
70          SSLParameters sslParameters = delegate.getSSLParameters();
71          sslParameters.setEndpointIdentificationAlgorithm("HTTPS");
72          delegate.setSSLParameters(sslParameters);
73      }
74  
75  }