package org.opendaylight.openflowjava.protocol.impl.core.connection;
+import com.google.common.collect.Lists;
+import com.google.common.util.concurrent.ListenableFuture;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
-
import org.junit.Assert;
import org.junit.Test;
import org.mockito.Mock;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.config.rev140630.PathType;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.config.rev140630.TransportProtocol;
-import com.google.common.util.concurrent.ListenableFuture;
-
/**
* @author michal.polkorab
*
* Creates new {@link SwitchConnectionProvider} instance for each test
* @param protocol communication protocol
*/
- public void startUp(TransportProtocol protocol) {
+ public void startUp(final TransportProtocol protocol) {
MockitoAnnotations.initMocks(this);
config = null;
if (protocol != null) {
provider = new SwitchConnectionProviderImpl();
}
- private void createConfig(TransportProtocol protocol) {
+ private void createConfig(final TransportProtocol protocol) {
try {
startupAddress = InetAddress.getLocalHost();
- } catch (UnknownHostException e) {
+ } catch (final UnknownHostException e) {
e.printStackTrace();
}
tlsConfiguration = null;
if (protocol.equals(TransportProtocol.TLS)) {
tlsConfiguration = new TlsConfigurationImpl(KeystoreType.JKS,
"/selfSignedSwitch", PathType.CLASSPATH, KeystoreType.JKS,
- "/selfSignedController", PathType.CLASSPATH) ;
+ "/selfSignedController", PathType.CLASSPATH,
+ Lists.newArrayList("TLS_RSA_WITH_AES_128_CBC_SHA", "TLS_RSA_WITH_AES_128_CBC_SHA256")) ;
}
- config = new ConnectionConfigurationImpl(startupAddress, 0, tlsConfiguration, SWITCH_IDLE_TIMEOUT);
+ config = new ConnectionConfigurationImpl(startupAddress, 0, tlsConfiguration, SWITCH_IDLE_TIMEOUT, true);
config.setTransferProtocol(protocol);
}
@Test
public void testStartup1() {
provider = new SwitchConnectionProviderImpl();
- ListenableFuture<Boolean> future = provider.startup();
+ final ListenableFuture<Boolean> future = provider.startup();
try {
future.get(WAIT_TIMEOUT, TimeUnit.MILLISECONDS);
} catch (InterruptedException | ExecutionException | TimeoutException e) {
public void testStartup2() {
startUp(null);
provider.setSwitchConnectionHandler(handler);
- ListenableFuture<Boolean> future = provider.startup();
+ final ListenableFuture<Boolean> future = provider.startup();
try {
future.get(WAIT_TIMEOUT, TimeUnit.MILLISECONDS);
} catch (InterruptedException | ExecutionException | TimeoutException e) {
public void testStartup3() {
startUp(TransportProtocol.TCP);
provider.setConfiguration(config);
- ListenableFuture<Boolean> future = provider.startup();
+ final ListenableFuture<Boolean> future = provider.startup();
try {
future.get(WAIT_TIMEOUT, TimeUnit.MILLISECONDS);
} catch (InterruptedException | ExecutionException | TimeoutException e) {