Home | History | Annotate | Download | only in ssl
      1 /*
      2  *  Licensed to the Apache Software Foundation (ASF) under one or more
      3  *  contributor license agreements.  See the NOTICE file distributed with
      4  *  this work for additional information regarding copyright ownership.
      5  *  The ASF licenses this file to You under the Apache License, Version 2.0
      6  *  (the "License"); you may not use this file except in compliance with
      7  *  the License.  You may obtain a copy of the License at
      8  *
      9  *     http://www.apache.org/licenses/LICENSE-2.0
     10  *
     11  *  Unless required by applicable law or agreed to in writing, software
     12  *  distributed under the License is distributed on an "AS IS" BASIS,
     13  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     14  *  See the License for the specific language governing permissions and
     15  *  limitations under the License.
     16  */
     17 
     18 package org.apache.harmony.xnet.tests.javax.net.ssl;
     19 
     20 import java.io.IOException;
     21 import java.net.InetAddress;
     22 
     23 import javax.net.ssl.SSLServerSocket;
     24 
     25 import junit.framework.TestCase;
     26 
     27 
     28 /**
     29  * Tests for <code>SSLServerSocket</code> class constructors.
     30  *
     31  */
     32 public class SSLServerSocketTest extends TestCase {
     33 
     34     /*
     35      * Class under test for void SSLServerSocket()
     36      */
     37     public void testSSLServerSocket() {
     38         try {
     39             new MySSLServerSocket();
     40         } catch (IOException e) {
     41             fail(e.toString());
     42         }
     43     }
     44 
     45     /*
     46      * Class under test for void SSLServerSocket(int)
     47      */
     48     public void testSSLServerSocketint() {
     49         try {
     50             new MySSLServerSocket(0);
     51         } catch (IOException e) {
     52             fail(e.toString());
     53         }
     54     }
     55 
     56     /*
     57      * Class under test for void SSLServerSocket(int, int)
     58      */
     59     public void testSSLServerSocketintint() {
     60         try {
     61             new MySSLServerSocket(0, 10);
     62         } catch (IOException e) {
     63             fail(e.toString());
     64         }
     65     }
     66 
     67     /*
     68      * Class under test for void SSLServerSocket(int, int, InetAddress)
     69      */
     70     public void testSSLServerSocketintintInetAddress() {
     71         try {
     72             new MySSLServerSocket(0, 10, InetAddress.getLocalHost());
     73         } catch (IOException e) {
     74             fail(e.toString());
     75         }
     76     }
     77 
     78 }
     79 
     80 class MySSLServerSocket extends SSLServerSocket {
     81 
     82     protected MySSLServerSocket() throws IOException {
     83         super();
     84     }
     85 
     86     protected MySSLServerSocket(int port) throws IOException {
     87         super(port);
     88     }
     89 
     90     protected MySSLServerSocket(int port, int backlog) throws IOException {
     91         super(port, backlog);
     92     }
     93 
     94     protected MySSLServerSocket(int port, int backlog, InetAddress address)
     95             throws IOException {
     96         super(port, backlog, address);
     97     }
     98 
     99     @Override
    100     public String[] getEnabledCipherSuites() {
    101         return null;
    102     }
    103 
    104     @Override
    105     public void setEnabledCipherSuites(String[] suites) {
    106     }
    107 
    108     @Override
    109     public String[] getSupportedCipherSuites() {
    110         return null;
    111     }
    112 
    113     @Override
    114     public String[] getSupportedProtocols() {
    115         return null;
    116     }
    117 
    118     @Override
    119     public String[] getEnabledProtocols() {
    120         return null;
    121     }
    122 
    123     @Override
    124     public void setEnabledProtocols(String[] protocols) {
    125     }
    126 
    127     @Override
    128     public void setNeedClientAuth(boolean need) {
    129     }
    130 
    131     @Override
    132     public boolean getNeedClientAuth() {
    133         return false;
    134     }
    135 
    136     @Override
    137     public void setWantClientAuth(boolean want) {
    138     }
    139 
    140     @Override
    141     public boolean getWantClientAuth() {
    142         return false;
    143     }
    144 
    145     @Override
    146     public void setUseClientMode(boolean mode) {
    147     }
    148 
    149     @Override
    150     public boolean getUseClientMode() {
    151         return false;
    152     }
    153 
    154     @Override
    155     public void setEnableSessionCreation(boolean flag) {
    156     }
    157 
    158     @Override
    159     public boolean getEnableSessionCreation() {
    160         return false;
    161     }
    162 }
    163 
    164