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 public class SSLServerSocketTest extends TestCase {
     32 
     33     /*
     34      * Class under test for void SSLServerSocket()
     35      */
     36     public void testSSLServerSocket() {
     37         try {
     38             new MySSLServerSocket();
     39         } catch (IOException e) {
     40             fail(e.toString());
     41         }
     42     }
     43 
     44     /*
     45      * Class under test for void SSLServerSocket(int)
     46      */
     47     public void testSSLServerSocketint() {
     48         try {
     49             new MySSLServerSocket(0);
     50         } catch (IOException e) {
     51             fail(e.toString());
     52         }
     53     }
     54 
     55     /*
     56      * Class under test for void SSLServerSocket(int, int)
     57      */
     58     public void testSSLServerSocketintint() {
     59         try {
     60             new MySSLServerSocket(0, 10);
     61         } catch (IOException e) {
     62             fail(e.toString());
     63         }
     64     }
     65 
     66     /*
     67      * Class under test for void SSLServerSocket(int, int, InetAddress)
     68      */
     69     public void testSSLServerSocketintintInetAddress() {
     70         try {
     71             new MySSLServerSocket(0, 10, InetAddress.getLocalHost());
     72         } catch (IOException e) {
     73             fail(e.toString());
     74         }
     75     }
     76 
     77 }
     78 
     79 class MySSLServerSocket extends SSLServerSocket {
     80 
     81     protected MySSLServerSocket() throws IOException {
     82         super();
     83     }
     84 
     85     protected MySSLServerSocket(int port) throws IOException {
     86         super(port);
     87     }
     88 
     89     protected MySSLServerSocket(int port, int backlog) throws IOException {
     90         super(port, backlog);
     91     }
     92 
     93     protected MySSLServerSocket(int port, int backlog, InetAddress address)
     94             throws IOException {
     95         super(port, backlog, address);
     96     }
     97 
     98     @Override
     99     public String[] getEnabledCipherSuites() {
    100         return null;
    101     }
    102 
    103     @Override
    104     public void setEnabledCipherSuites(String[] suites) {
    105     }
    106 
    107     @Override
    108     public String[] getSupportedCipherSuites() {
    109         return null;
    110     }
    111 
    112     @Override
    113     public String[] getSupportedProtocols() {
    114         return null;
    115     }
    116 
    117     @Override
    118     public String[] getEnabledProtocols() {
    119         return null;
    120     }
    121 
    122     @Override
    123     public void setEnabledProtocols(String[] protocols) {
    124     }
    125 
    126     @Override
    127     public void setNeedClientAuth(boolean need) {
    128     }
    129 
    130     @Override
    131     public boolean getNeedClientAuth() {
    132         return false;
    133     }
    134 
    135     @Override
    136     public void setWantClientAuth(boolean want) {
    137     }
    138 
    139     @Override
    140     public boolean getWantClientAuth() {
    141         return false;
    142     }
    143 
    144     @Override
    145     public void setUseClientMode(boolean mode) {
    146     }
    147 
    148     @Override
    149     public boolean getUseClientMode() {
    150         return false;
    151     }
    152 
    153     @Override
    154     public void setEnableSessionCreation(boolean flag) {
    155     }
    156 
    157     @Override
    158     public boolean getEnableSessionCreation() {
    159         return false;
    160     }
    161 }
    162 
    163