SSLServerSocketImpl.java revision 6812a2e8bb43d9a875633a9ba255d9882c63e327
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 java.io.IOException;
217329fa972d9c20777444e5e1b13169d700de6567Brian Carlstromimport java.net.InetAddress;
227329fa972d9c20777444e5e1b13169d700de6567Brian Carlstromimport java.net.Socket;
237329fa972d9c20777444e5e1b13169d700de6567Brian Carlstromimport javax.net.ssl.SSLServerSocket;
247329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom
257329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom/**
267329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom * SSLServerSocket implementation
277329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom * @see javax.net.ssl.SSLServerSocket class documentation for more information.
287329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom */
297329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrompublic class SSLServerSocketImpl extends SSLServerSocket {
307329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom
317329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom    // the sslParameters object encapsulates all the info
327329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom    // about supported and enabled cipher suites and protocols,
337329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom    // as well as the information about client/server mode of
347329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom    // ssl socket, whether it require/want client authentication or not,
357329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom    // and controls whether new SSL sessions may be established by this
367329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom    // socket or not.
376812a2e8bb43d9a875633a9ba255d9882c63e327Brian Carlstrom    private final SSLParametersImpl sslParameters;
387329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom
397329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom    // logger
407329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom    private Logger.Stream logger = Logger.getStream("ssocket");
417329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom
427329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom    /**
437329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom     * Ctor
447329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom     * @param   sslParameters:  SSLParameters
457329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom     * @throws  IOException
467329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom     */
476812a2e8bb43d9a875633a9ba255d9882c63e327Brian Carlstrom    protected SSLServerSocketImpl(SSLParametersImpl sslParameters)
487329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom        throws IOException {
497329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom        super();
507329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom        this.sslParameters = sslParameters;
517329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom    }
527329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom
537329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom    /**
547329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom     * Ctor
557329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom     * @param   port:   int
567329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom     * @param   sslParameters:  SSLParameters
577329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom     * @throws  IOException
587329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom     */
596812a2e8bb43d9a875633a9ba255d9882c63e327Brian Carlstrom    protected SSLServerSocketImpl(int port, SSLParametersImpl sslParameters)
607329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom        throws IOException {
617329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom        super(port);
627329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom        this.sslParameters = sslParameters;
637329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom    }
647329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom
657329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom    /**
667329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom     * Ctor
677329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom     * @param   port:   int
687329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom     * @param   backlog:    int
697329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom     * @param   sslParameters:  SSLParameters
707329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom     * @throws  IOException
717329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom     */
727329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom    protected SSLServerSocketImpl(int port, int backlog,
736812a2e8bb43d9a875633a9ba255d9882c63e327Brian Carlstrom            SSLParametersImpl sslParameters) throws IOException {
747329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom        super(port, backlog);
757329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom        this.sslParameters = sslParameters;
767329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom    }
777329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom
787329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom    /**
797329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom     * Ctor
807329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom     * @param   port:   int
817329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom     * @param   backlog:    int
827329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom     * @param   iAddress:   InetAddress
837329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom     * @param   sslParameters:  SSLParameters
847329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom     * @throws  IOException
857329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom     */
867329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom    protected SSLServerSocketImpl(int port, int backlog,
877329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom                                InetAddress iAddress,
886812a2e8bb43d9a875633a9ba255d9882c63e327Brian Carlstrom                                SSLParametersImpl sslParameters)
897329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom        throws IOException {
907329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom        super(port, backlog, iAddress);
917329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom        this.sslParameters = sslParameters;
927329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom    }
937329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom
947329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom    // --------------- SSLParameters based methods ---------------------
957329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom
967329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom    /**
977329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom     * This method works according to the specification of implemented class.
987329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom     * @see javax.net.ssl.SSLServerSocket#getSupportedCipherSuites()
997329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom     * method documentation for more information
1007329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom     */
1017329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom    @Override
1027329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom    public String[] getSupportedCipherSuites() {
1037329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom        return CipherSuite.getSupportedCipherSuiteNames();
1047329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom    }
1057329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom
1067329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom    /**
1077329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom     * This method works according to the specification of implemented class.
1087329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom     * @see javax.net.ssl.SSLServerSocket#getEnabledCipherSuites()
1097329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom     * method documentation for more information
1107329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom     */
1117329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom    @Override
1127329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom    public String[] getEnabledCipherSuites() {
1137329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom        return sslParameters.getEnabledCipherSuites();
1147329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom    }
1157329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom
1167329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom    /**
1177329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom     * This method works according to the specification of implemented class.
1187329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom     * @see javax.net.ssl.SSLServerSocket#setEnabledCipherSuites(String[])
1197329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom     * method documentation for more information
1207329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom     */
1217329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom    @Override
1227329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom    public void setEnabledCipherSuites(String[] suites) {
1237329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom        sslParameters.setEnabledCipherSuites(suites);
1247329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom    }
1257329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom
1267329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom    /**
1277329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom     * This method works according to the specification of implemented class.
1287329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom     * @see javax.net.ssl.SSLServerSocket#getSupportedProtocols()
1297329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom     * method documentation for more information
1307329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom     */
1317329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom    @Override
1327329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom    public String[] getSupportedProtocols() {
1337329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom        return ProtocolVersion.supportedProtocols.clone();
1347329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom    }
1357329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom
1367329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom    /**
1377329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom     * This method works according to the specification of implemented class.
1387329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom     * @see javax.net.ssl.SSLServerSocket#getEnabledProtocols()
1397329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom     * method documentation for more information
1407329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom     */
1417329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom    @Override
1427329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom    public String[] getEnabledProtocols() {
1437329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom        return sslParameters.getEnabledProtocols();
1447329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom    }
1457329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom
1467329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom    /**
1477329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom     * This method works according to the specification of implemented class.
1487329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom     * @see javax.net.ssl.SSLServerSocket#setEnabledProtocols(String[])
1497329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom     * method documentation for more information
1507329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom     */
1517329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom    @Override
1527329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom    public void setEnabledProtocols(String[] protocols) {
1537329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom        sslParameters.setEnabledProtocols(protocols);
1547329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom    }
1557329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom
1567329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom    /**
1577329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom     * This method works according to the specification of implemented class.
1587329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom     * @see javax.net.ssl.SSLServerSocket#setUseClientMode(boolean)
1597329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom     * method documentation for more information
1607329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom     */
1617329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom    @Override
1627329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom    public void setUseClientMode(boolean mode) {
1637329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom        sslParameters.setUseClientMode(mode);
1647329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom    }
1657329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom
1667329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom    /**
1677329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom     * This method works according to the specification of implemented class.
1687329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom     * @see javax.net.ssl.SSLServerSocket#getUseClientMode()
1697329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom     * method documentation for more information
1707329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom     */
1717329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom    @Override
1727329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom    public boolean getUseClientMode() {
1737329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom        return sslParameters.getUseClientMode();
1747329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom    }
1757329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom
1767329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom    /**
1777329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom     * This method works according to the specification of implemented class.
1787329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom     * @see javax.net.ssl.SSLServerSocket#setNeedClientAuth(boolean)
1797329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom     * method documentation for more information
1807329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom     */
1817329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom    @Override
1827329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom    public void setNeedClientAuth(boolean need) {
1837329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom        sslParameters.setNeedClientAuth(need);
1847329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom    }
1857329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom
1867329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom    /**
1877329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom     * This method works according to the specification of implemented class.
1887329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom     * @see javax.net.ssl.SSLServerSocket#getNeedClientAuth()
1897329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom     * method documentation for more information
1907329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom     */
1917329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom    @Override
1927329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom    public boolean getNeedClientAuth() {
1937329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom        return sslParameters.getNeedClientAuth();
1947329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom    }
1957329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom
1967329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom    /**
1977329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom     * This method works according to the specification of implemented class.
1987329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom     * @see javax.net.ssl.SSLServerSocket#setWantClientAuth(boolean)
1997329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom     * method documentation for more information
2007329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom     */
2017329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom    @Override
2027329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom    public void setWantClientAuth(boolean want) {
2037329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom        sslParameters.setWantClientAuth(want);
2047329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom    }
2057329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom
2067329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom    /**
2077329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom     * This method works according to the specification of implemented class.
2087329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom     * @see javax.net.ssl.SSLServerSocket#getWantClientAuth()
2097329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom     * method documentation for more information
2107329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom     */
2117329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom    @Override
2127329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom    public boolean getWantClientAuth() {
2137329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom        return sslParameters.getWantClientAuth();
2147329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom    }
2157329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom
2167329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom    /**
2177329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom     * This method works according to the specification of implemented class.
2187329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom     * @see javax.net.ssl.SSLServerSocket#setEnableSessionCreation(boolean)
2197329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom     * method documentation for more information
2207329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom     */
2217329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom    @Override
2227329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom    public void setEnableSessionCreation(boolean flag) {
2237329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom        sslParameters.setEnableSessionCreation(flag);
2247329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom    }
2257329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom
2267329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom    /**
2277329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom     * This method works according to the specification of implemented class.
2287329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom     * @see javax.net.ssl.SSLServerSocket#getEnableSessionCreation()
2297329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom     * method documentation for more information
2307329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom     */
2317329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom    @Override
2327329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom    public boolean getEnableSessionCreation() {
2337329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom        return sslParameters.getEnableSessionCreation();
2347329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom    }
2357329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom
2367329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom
2377329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom    // ------------- ServerSocket's methods overridings ----------------
2387329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom
2397329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom    /**
2407329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom     * This method works according to the specification of implemented class.
2417329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom     * @see java.net.ServerSocket#accept()
2427329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom     * method documentation for more information
2437329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom     */
2447329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom    @Override
2457329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom    public Socket accept() throws IOException {
2467329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom        if (logger != null) {
2477329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom            logger.println("SSLServerSocketImpl.accept ..");
2487329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom        }
2497329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom        SSLSocketImpl s = new SSLSocketImpl(
2506812a2e8bb43d9a875633a9ba255d9882c63e327Brian Carlstrom                (SSLParametersImpl) sslParameters.clone());
2517329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom        implAccept(s);
2527329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom        SecurityManager sm = System.getSecurityManager();
2537329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom        if (sm != null) {
2547329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom            try {
2557329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom                sm.checkAccept(s.getInetAddress().getHostAddress(),
2567329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom                        s.getPort());
2577329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom            } catch(SecurityException e) {
2587329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom                s.close();
2597329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom                throw e;
2607329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom            }
2617329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom        }
2627329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom        s.init();
2637329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom        if (logger != null) {
2647329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom            logger.println("SSLServerSocketImpl: accepted, initialized");
2657329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom        }
2667329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom        return s;
2677329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom    }
2687329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom
2697329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom    /**
2707329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom     * Returns the string representation of the object.
2717329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom     */
2727329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom    @Override
2737329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom    public String toString() {
2747329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom        return "[SSLServerSocketImpl]";
2757329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom    }
2767329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom
2777329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom    // -----------------------------------------------------------------
2787329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom}
2797329fa972d9c20777444e5e1b13169d700de6567Brian Carlstrom
280