Set call-home SSH port to 4334
[netconf.git] / netconf / callhome-protocol / src / main / java / org / opendaylight / netconf / callhome / protocol / NetconfCallHomeServerBuilder.java
index de8eb106d0237fb778e4af0f8b91eda5f751e3bf..19d0c933a9841a55eb6120cc4554fa17582dbd60 100644 (file)
@@ -5,24 +5,23 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-
 package org.opendaylight.netconf.callhome.protocol;
 
-import com.google.common.base.Optional;
+import io.netty.channel.DefaultEventLoopGroup;
 import io.netty.channel.EventLoopGroup;
-import io.netty.channel.local.LocalEventLoopGroup;
 import io.netty.util.HashedWheelTimer;
 import java.net.InetSocketAddress;
+import java.util.Optional;
 import java.util.concurrent.TimeUnit;
-import org.apache.sshd.SshClient;
 import org.opendaylight.netconf.callhome.protocol.CallHomeSessionContext.Factory;
 import org.opendaylight.netconf.client.NetconfClientSessionNegotiatorFactory;
+import org.opendaylight.netconf.shaded.sshd.client.SshClient;
 import org.opendaylight.yangtools.concepts.Builder;
 
 public class NetconfCallHomeServerBuilder implements Builder<NetconfCallHomeServer> {
 
     private static final long DEFAULT_SESSION_TIMEOUT_MILLIS = TimeUnit.SECONDS.toMillis(5);
-    private static final int DEFAULT_CALL_HOME_PORT = 6666;
+    private static final int DEFAULT_CALL_HOME_PORT = 4334;
 
     private SshClient sshClient;
     private EventLoopGroup nettyGroup;
@@ -33,8 +32,8 @@ public class NetconfCallHomeServerBuilder implements Builder<NetconfCallHomeServ
     private final CallHomeNetconfSubsystemListener subsystemListener;
     private final StatusRecorder recorder;
 
-    public NetconfCallHomeServerBuilder(CallHomeAuthorizationProvider authProvider,
-                                        CallHomeNetconfSubsystemListener subsystemListener, StatusRecorder recorder) {
+    public NetconfCallHomeServerBuilder(final CallHomeAuthorizationProvider authProvider,
+            final CallHomeNetconfSubsystemListener subsystemListener, final StatusRecorder recorder) {
         this.authProvider = authProvider;
         this.subsystemListener = subsystemListener;
         this.recorder = recorder;
@@ -51,7 +50,7 @@ public class NetconfCallHomeServerBuilder implements Builder<NetconfCallHomeServ
         return sshClient;
     }
 
-    public void setSshClient(SshClient sshClient) {
+    public void setSshClient(final SshClient sshClient) {
         this.sshClient = sshClient;
     }
 
@@ -59,7 +58,7 @@ public class NetconfCallHomeServerBuilder implements Builder<NetconfCallHomeServ
         return nettyGroup;
     }
 
-    public void setNettyGroup(EventLoopGroup nettyGroup) {
+    public void setNettyGroup(final EventLoopGroup nettyGroup) {
         this.nettyGroup = nettyGroup;
     }
 
@@ -67,7 +66,7 @@ public class NetconfCallHomeServerBuilder implements Builder<NetconfCallHomeServ
         return negotiationFactory;
     }
 
-    public void setNegotiationFactory(NetconfClientSessionNegotiatorFactory negotiationFactory) {
+    public void setNegotiationFactory(final NetconfClientSessionNegotiatorFactory negotiationFactory) {
         this.negotiationFactory = negotiationFactory;
     }
 
@@ -75,7 +74,7 @@ public class NetconfCallHomeServerBuilder implements Builder<NetconfCallHomeServ
         return bindAddress;
     }
 
-    public void setBindAddress(InetSocketAddress bindAddress) {
+    public void setBindAddress(final InetSocketAddress bindAddress) {
         this.bindAddress = bindAddress;
     }
 
@@ -107,20 +106,20 @@ public class NetconfCallHomeServerBuilder implements Builder<NetconfCallHomeServ
         return sshClient != null ? sshClient : defaultSshClient();
     }
 
-    private SshClient defaultSshClient() {
+    private static SshClient defaultSshClient() {
         return SshClient.setUpDefaultClient();
     }
 
-    private NetconfClientSessionNegotiatorFactory defaultNegotiationFactory() {
+    private static NetconfClientSessionNegotiatorFactory defaultNegotiationFactory() {
         return new NetconfClientSessionNegotiatorFactory(new HashedWheelTimer(),
-                                                         Optional.absent(), DEFAULT_SESSION_TIMEOUT_MILLIS);
+                                                         Optional.empty(), DEFAULT_SESSION_TIMEOUT_MILLIS);
     }
 
-    private EventLoopGroup defaultNettyGroup() {
-        return new LocalEventLoopGroup();
+    private static EventLoopGroup defaultNettyGroup() {
+        return new DefaultEventLoopGroup();
     }
 
-    private InetSocketAddress defaultBindAddress() {
+    private static InetSocketAddress defaultBindAddress() {
         return new InetSocketAddress(DEFAULT_CALL_HOME_PORT);
     }
 }