01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * 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: /**
19: * @author Boris V. Kuznetsov
20: * @version $Revision$
21: */package javax.net.ssl;
22:
23: import java.io.IOException;
24: import java.net.InetAddress;
25: import java.net.SocketException;
26:
27: import junit.framework.TestCase;
28:
29: /**
30: * Tests for <code>DefaultSSLServerSocketFactory</code> class constructors and methods.
31: *
32: */
33: public class DefaultSSLServerSocketFactoryTest extends TestCase {
34:
35: /*
36: * Class under test for ServerSocket createServerSocket(int)
37: */
38: public void testCreateServerSocketint() {
39: DefaultSSLServerSocketFactory f = new DefaultSSLServerSocketFactory(
40: "ERROR");
41: try {
42: f.createServerSocket(0);
43: fail("No expected SocketException");
44: } catch (SocketException e) {
45: } catch (IOException e) {
46: fail(e.toString());
47: }
48: }
49:
50: /*
51: * Class under test for ServerSocket createServerSocket(int, int)
52: */
53: public void testCreateServerSocketintint() {
54: DefaultSSLServerSocketFactory f = new DefaultSSLServerSocketFactory(
55: "ERROR");
56: try {
57: f.createServerSocket(0, 10);
58: fail("No expected SocketException");
59: } catch (SocketException e) {
60: } catch (IOException e) {
61: fail(e.toString());
62: }
63: }
64:
65: /*
66: * Class under test for ServerSocket createServerSocket(int, int, InetAddress)
67: */
68: public void testCreateServerSocketintintInetAddress() {
69: DefaultSSLServerSocketFactory f = new DefaultSSLServerSocketFactory(
70: "ERROR");
71: try {
72: f.createServerSocket(0, 10, InetAddress.getLocalHost());
73: fail("No expected SocketException");
74: } catch (SocketException e) {
75: } catch (IOException e) {
76: fail(e.toString());
77: }
78: }
79:
80: public void testGetDefaultCipherSuites() {
81: DefaultSSLServerSocketFactory f = new DefaultSSLServerSocketFactory(
82: "ERROR");
83: String[] res = f.getDefaultCipherSuites();
84: if (res == null || res.length != 0) {
85: fail("incorrect result");
86: }
87: }
88:
89: public void testGetSupportedCipherSuites() {
90: DefaultSSLServerSocketFactory f = new DefaultSSLServerSocketFactory(
91: "ERROR");
92: String[] res = f.getSupportedCipherSuites();
93: if (res == null || res.length != 0) {
94: fail("incorrect result");
95: }
96: }
97:
98: }
|