@Override public ReconnectStrategy createReconnectStrategy() { return new NeverReconnectStrategy(this.executor, this.timeout); }
@Override public java.lang.AutoCloseable createInstance() { ReconnectStrategy reconnectStrategy = new NeverReconnectStrategy(getExecutorDependency(), getTimeout()); return new ReconnectStrategyCloseable(reconnectStrategy); } }
private static NetconfClientConfiguration getNetconfClientConfiguration(final Parameters params, final NetconfDeviceCommunicator sessionListener) { final NetconfClientConfigurationBuilder netconfClientConfigurationBuilder = NetconfClientConfigurationBuilder.create(); netconfClientConfigurationBuilder.withSessionListener(sessionListener); netconfClientConfigurationBuilder.withAddress(params.getInetAddress()); if(params.tcpHeader != null) { final String header = params.tcpHeader.replaceAll("\"", "").trim() + "\n"; netconfClientConfigurationBuilder.withAdditionalHeader(new NetconfHelloMessageAdditionalHeader(null, null, null, null, null) { @Override public String toFormattedString() { LOG.debug("Sending TCP header {}", header); return header; } }); } netconfClientConfigurationBuilder.withProtocol(params.ssh ? NetconfClientConfiguration.NetconfClientProtocol.SSH : NetconfClientConfiguration.NetconfClientProtocol.TCP); netconfClientConfigurationBuilder.withAuthHandler(new LoginPassword(params.username, params.password)); netconfClientConfigurationBuilder.withConnectionTimeoutMillis(20000L); netconfClientConfigurationBuilder.withReconnectStrategy(new NeverReconnectStrategy(GlobalEventExecutor.INSTANCE, 5000)); return netconfClientConfigurationBuilder.build(); } }