2 * Copyright 2016 Huawei Technologies Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 package org.onap.vfc.nfvo.vnfm.svnfm.vnfmadapter.service.csm.connect;
19 import java.io.IOException;
20 import java.net.InetAddress;
21 import java.net.Socket;
23 import org.apache.commons.httpclient.ConnectTimeoutException;
24 import org.apache.commons.httpclient.params.HttpConnectionParams;
25 import org.junit.Test;
26 import org.onap.vfc.nfvo.vnfm.svnfm.vnfmadapter.service.csm.connect.SslAnonymousSocket;
28 public class SslAnonymousSocketTest {
30 @Test(expected = IOException.class)
31 public void createSocketTestException() throws IOException, ConnectTimeoutException {
32 String host= "localhost";
34 InetAddress localAddress = null;
36 HttpConnectionParams params = null;
37 SslAnonymousSocket sslsocket = new SslAnonymousSocket();
38 Socket socket = sslsocket.createSocket(host, port, localAddress, localPort, params);
41 @Test(expected = Exception.class)
42 public void createSocketTestException2() throws IOException, ConnectTimeoutException {
43 String host= "localhost";
45 InetAddress localAddress = null;
47 HttpConnectionParams params = new HttpConnectionParams();
48 SslAnonymousSocket sslsocket = new SslAnonymousSocket();
49 Socket socket = sslsocket.createSocket(host, port, localAddress, localPort, params);