1e382a4e8014a7276513ca236e2582360cf4aaa4
[vfc/nfvo/driver/vnfm/svnfm.git] /
1 /*
2  * Copyright 2016 Huawei Technologies Co., Ltd.
3  *
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
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16
17 package org.onap.vfc.nfvo.vnfm.svnfm.vnfmadapter.service.csm.connect;
18
19 import java.io.IOException;
20 import java.net.InetAddress;
21 import java.net.Socket;
22
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;
27
28 public class SslAnonymousSocketTest {
29
30     @Test(expected = IOException.class)
31     public void createSocketTestException() throws IOException, ConnectTimeoutException {
32         String host= "localhost";
33         int port = 29912;
34         InetAddress localAddress = null;
35         int localPort = 4859;
36         HttpConnectionParams params = null;
37         SslAnonymousSocket sslsocket = new SslAnonymousSocket();
38         Socket socket  = sslsocket.createSocket(host, port, localAddress, localPort, params);
39     }
40
41     @Test(expected = Exception.class)
42     public void createSocketTestException2() throws IOException, ConnectTimeoutException {
43         String host= "localhost";
44         int port = 29912;
45         InetAddress localAddress = null;
46         int localPort = 4859;
47         HttpConnectionParams params = new HttpConnectionParams();
48         SslAnonymousSocket sslsocket = new SslAnonymousSocket();
49         Socket socket  = sslsocket.createSocket(host, port, localAddress, localPort, params);
50     }
51
52 }