SSLServerSocketImpl.java revision 7329fa972d9c20777444e5e1b13169d700de6567
17329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom/* 27329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom * Licensed to the Apache Software Foundation (ASF) under one or more 37329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom * contributor license agreements. See the NOTICE file distributed with 47329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom * this work for additional information regarding copyright ownership. 57329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom * The ASF licenses this file to You under the Apache License, Version 2.0 67329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom * (the "License"); you may not use this file except in compliance with 77329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom * the License. You may obtain a copy of the License at 87329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom * 97329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom * http://www.apache.org/licenses/LICENSE-2.0 107329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom * 117329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom * Unless required by applicable law or agreed to in writing, software 127329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom * distributed under the License is distributed on an "AS IS" BASIS, 137329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 147329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom * See the License for the specific language governing permissions and 157329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom * limitations under the License. 167329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom */ 177329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom 187329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrompackage org.apache.harmony.xnet.provider.jsse; 197329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom 207329fa972d9c20777444e5e1b13169d700de6567Brian Carlstromimport org.apache.harmony.xnet.provider.jsse.SSLSocketImpl; 217329fa972d9c20777444e5e1b13169d700de6567Brian Carlstromimport org.apache.harmony.xnet.provider.jsse.SSLParameters; 227329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom 237329fa972d9c20777444e5e1b13169d700de6567Brian Carlstromimport java.io.IOException; 247329fa972d9c20777444e5e1b13169d700de6567Brian Carlstromimport java.net.InetAddress; 257329fa972d9c20777444e5e1b13169d700de6567Brian Carlstromimport java.net.Socket; 267329fa972d9c20777444e5e1b13169d700de6567Brian Carlstromimport javax.net.ssl.SSLServerSocket; 277329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom 287329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom/** 297329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom * SSLServerSocket implementation 307329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom * @see javax.net.ssl.SSLServerSocket class documentation for more information. 317329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom */ 327329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrompublic class SSLServerSocketImpl extends SSLServerSocket { 337329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom 347329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom // the sslParameters object encapsulates all the info 357329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom // about supported and enabled cipher suites and protocols, 367329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom // as well as the information about client/server mode of 377329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom // ssl socket, whether it require/want client authentication or not, 387329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom // and controls whether new SSL sessions may be established by this 397329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom // socket or not. 407329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom private final SSLParameters sslParameters; 417329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom 427329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom // logger 437329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom private Logger.Stream logger = Logger.getStream("ssocket"); 447329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom 457329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom /** 467329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom * Ctor 477329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom * @param sslParameters: SSLParameters 487329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom * @throws IOException 497329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom */ 507329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom protected SSLServerSocketImpl(SSLParameters sslParameters) 517329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom throws IOException { 527329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom super(); 537329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom this.sslParameters = sslParameters; 547329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom } 557329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom 567329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom /** 577329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom * Ctor 587329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom * @param port: int 597329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom * @param sslParameters: SSLParameters 607329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom * @throws IOException 617329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom */ 627329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom protected SSLServerSocketImpl(int port, SSLParameters sslParameters) 637329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom throws IOException { 647329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom super(port); 657329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom this.sslParameters = sslParameters; 667329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom } 677329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom 687329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom /** 697329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom * Ctor 707329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom * @param port: int 717329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom * @param backlog: int 727329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom * @param sslParameters: SSLParameters 737329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom * @throws IOException 747329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom */ 757329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom protected SSLServerSocketImpl(int port, int backlog, 767329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom SSLParameters sslParameters) throws IOException { 777329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom super(port, backlog); 787329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom this.sslParameters = sslParameters; 797329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom } 807329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom 817329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom /** 827329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom * Ctor 837329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom * @param port: int 847329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom * @param backlog: int 857329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom * @param iAddress: InetAddress 867329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom * @param sslParameters: SSLParameters 877329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom * @throws IOException 887329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom */ 897329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom protected SSLServerSocketImpl(int port, int backlog, 907329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom InetAddress iAddress, 917329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom SSLParameters sslParameters) 927329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom throws IOException { 937329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom super(port, backlog, iAddress); 947329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom this.sslParameters = sslParameters; 957329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom } 967329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom 977329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom // --------------- SSLParameters based methods --------------------- 987329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom 997329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom /** 1007329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom * This method works according to the specification of implemented class. 1017329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom * @see javax.net.ssl.SSLServerSocket#getSupportedCipherSuites() 1027329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom * method documentation for more information 1037329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom */ 1047329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom @Override 1057329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom public String[] getSupportedCipherSuites() { 1067329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom return CipherSuite.getSupportedCipherSuiteNames(); 1077329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom } 1087329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom 1097329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom /** 1107329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom * This method works according to the specification of implemented class. 1117329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom * @see javax.net.ssl.SSLServerSocket#getEnabledCipherSuites() 1127329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom * method documentation for more information 1137329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom */ 1147329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom @Override 1157329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom public String[] getEnabledCipherSuites() { 1167329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom return sslParameters.getEnabledCipherSuites(); 1177329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom } 1187329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom 1197329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom /** 1207329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom * This method works according to the specification of implemented class. 1217329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom * @see javax.net.ssl.SSLServerSocket#setEnabledCipherSuites(String[]) 1227329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom * method documentation for more information 1237329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom */ 1247329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom @Override 1257329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom public void setEnabledCipherSuites(String[] suites) { 1267329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom sslParameters.setEnabledCipherSuites(suites); 1277329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom } 1287329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom 1297329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom /** 1307329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom * This method works according to the specification of implemented class. 1317329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom * @see javax.net.ssl.SSLServerSocket#getSupportedProtocols() 1327329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom * method documentation for more information 1337329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom */ 1347329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom @Override 1357329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom public String[] getSupportedProtocols() { 1367329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom return ProtocolVersion.supportedProtocols.clone(); 1377329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom } 1387329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom 1397329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom /** 1407329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom * This method works according to the specification of implemented class. 1417329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom * @see javax.net.ssl.SSLServerSocket#getEnabledProtocols() 1427329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom * method documentation for more information 1437329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom */ 1447329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom @Override 1457329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom public String[] getEnabledProtocols() { 1467329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom return sslParameters.getEnabledProtocols(); 1477329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom } 1487329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom 1497329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom /** 1507329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom * This method works according to the specification of implemented class. 1517329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom * @see javax.net.ssl.SSLServerSocket#setEnabledProtocols(String[]) 1527329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom * method documentation for more information 1537329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom */ 1547329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom @Override 1557329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom public void setEnabledProtocols(String[] protocols) { 1567329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom sslParameters.setEnabledProtocols(protocols); 1577329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom } 1587329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom 1597329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom /** 1607329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom * This method works according to the specification of implemented class. 1617329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom * @see javax.net.ssl.SSLServerSocket#setUseClientMode(boolean) 1627329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom * method documentation for more information 1637329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom */ 1647329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom @Override 1657329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom public void setUseClientMode(boolean mode) { 1667329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom sslParameters.setUseClientMode(mode); 1677329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom } 1687329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom 1697329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom /** 1707329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom * This method works according to the specification of implemented class. 1717329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom * @see javax.net.ssl.SSLServerSocket#getUseClientMode() 1727329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom * method documentation for more information 1737329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom */ 1747329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom @Override 1757329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom public boolean getUseClientMode() { 1767329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom return sslParameters.getUseClientMode(); 1777329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom } 1787329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom 1797329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom /** 1807329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom * This method works according to the specification of implemented class. 1817329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom * @see javax.net.ssl.SSLServerSocket#setNeedClientAuth(boolean) 1827329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom * method documentation for more information 1837329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom */ 1847329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom @Override 1857329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom public void setNeedClientAuth(boolean need) { 1867329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom sslParameters.setNeedClientAuth(need); 1877329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom } 1887329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom 1897329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom /** 1907329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom * This method works according to the specification of implemented class. 1917329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom * @see javax.net.ssl.SSLServerSocket#getNeedClientAuth() 1927329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom * method documentation for more information 1937329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom */ 1947329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom @Override 1957329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom public boolean getNeedClientAuth() { 1967329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom return sslParameters.getNeedClientAuth(); 1977329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom } 1987329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom 1997329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom /** 2007329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom * This method works according to the specification of implemented class. 2017329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom * @see javax.net.ssl.SSLServerSocket#setWantClientAuth(boolean) 2027329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom * method documentation for more information 2037329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom */ 2047329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom @Override 2057329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom public void setWantClientAuth(boolean want) { 2067329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom sslParameters.setWantClientAuth(want); 2077329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom } 2087329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom 2097329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom /** 2107329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom * This method works according to the specification of implemented class. 2117329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom * @see javax.net.ssl.SSLServerSocket#getWantClientAuth() 2127329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom * method documentation for more information 2137329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom */ 2147329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom @Override 2157329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom public boolean getWantClientAuth() { 2167329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom return sslParameters.getWantClientAuth(); 2177329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom } 2187329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom 2197329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom /** 2207329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom * This method works according to the specification of implemented class. 2217329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom * @see javax.net.ssl.SSLServerSocket#setEnableSessionCreation(boolean) 2227329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom * method documentation for more information 2237329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom */ 2247329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom @Override 2257329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom public void setEnableSessionCreation(boolean flag) { 2267329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom sslParameters.setEnableSessionCreation(flag); 2277329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom } 2287329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom 2297329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom /** 2307329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom * This method works according to the specification of implemented class. 2317329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom * @see javax.net.ssl.SSLServerSocket#getEnableSessionCreation() 2327329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom * method documentation for more information 2337329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom */ 2347329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom @Override 2357329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom public boolean getEnableSessionCreation() { 2367329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom return sslParameters.getEnableSessionCreation(); 2377329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom } 2387329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom 2397329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom 2407329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom // ------------- ServerSocket's methods overridings ---------------- 2417329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom 2427329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom /** 2437329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom * This method works according to the specification of implemented class. 2447329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom * @see java.net.ServerSocket#accept() 2457329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom * method documentation for more information 2467329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom */ 2477329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom @Override 2487329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom public Socket accept() throws IOException { 2497329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom if (logger != null) { 2507329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom logger.println("SSLServerSocketImpl.accept .."); 2517329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom } 2527329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom SSLSocketImpl s = new SSLSocketImpl( 2537329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom (SSLParameters) sslParameters.clone()); 2547329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom implAccept(s); 2557329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom SecurityManager sm = System.getSecurityManager(); 2567329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom if (sm != null) { 2577329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom try { 2587329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom sm.checkAccept(s.getInetAddress().getHostAddress(), 2597329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom s.getPort()); 2607329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom } catch(SecurityException e) { 2617329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom s.close(); 2627329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom throw e; 2637329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom } 2647329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom } 2657329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom s.init(); 2667329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom s.startHandshake(); 2677329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom if (logger != null) { 2687329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom logger.println("SSLServerSocketImpl: accepted, initialized"); 2697329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom } 2707329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom return s; 2717329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom } 2727329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom 2737329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom /** 2747329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom * Returns the string representation of the object. 2757329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom */ 2767329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom @Override 2777329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom public String toString() { 2787329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom return "[SSLServerSocketImpl]"; 2797329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom } 2807329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom 2817329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom // ----------------------------------------------------------------- 2827329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom} 2837329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom 284