import com.google.common.base.Optional;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
-import io.netty.channel.Channel;
import io.netty.channel.ChannelInboundHandlerAdapter;
import io.netty.channel.ChannelOutboundHandler;
import io.netty.channel.ChannelOutboundHandlerAdapter;
import io.netty.channel.embedded.EmbeddedChannel;
import io.netty.handler.ssl.SslHandler;
import io.netty.util.HashedWheelTimer;
-import io.netty.util.Timer;
import io.netty.util.concurrent.Future;
import io.netty.util.concurrent.Promise;
import java.util.ArrayList;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;
-import org.opendaylight.netconf.api.NetconfDocumentedException;
import org.opendaylight.netconf.api.NetconfSessionListener;
import org.opendaylight.netconf.api.NetconfSessionPreferences;
import org.opendaylight.netconf.api.messages.NetconfHelloMessage;
channel.pipeline().fireExceptionCaught(cause);
verify(promise).setFailure(cause);
}
-
- private static class TestSessionNegotiator extends
- AbstractNetconfSessionNegotiator<NetconfSessionPreferences,
- TestingNetconfSession, NetconfSessionListener<TestingNetconfSession>> {
-
-
- TestSessionNegotiator(final NetconfSessionPreferences sessionPreferences,
- final Promise<TestingNetconfSession> promise, final Channel channel,
- final Timer timer,
- final NetconfSessionListener<TestingNetconfSession> sessionListener,
- final long connectionTimeoutMillis) {
- super(sessionPreferences, promise, channel, timer, sessionListener, connectionTimeoutMillis);
- }
-
- @Override
- protected TestingNetconfSession getSession(final NetconfSessionListener sessionListener, final Channel channel,
- final NetconfHelloMessage message) throws NetconfDocumentedException {
- return new TestingNetconfSession(sessionListener, channel, 0L);
- }
-
- @Override
- protected void handleMessage(final NetconfHelloMessage netconfHelloMessage) throws Exception {
-
- }
- }
-
-
}
import static org.opendaylight.netconf.nettyutil.AbstractChannelInitializer.NETCONF_MESSAGE_FRAME_ENCODER;
import com.google.common.base.Optional;
-import io.netty.channel.Channel;
import io.netty.channel.ChannelInboundHandlerAdapter;
import io.netty.channel.embedded.EmbeddedChannel;
import io.netty.util.HashedWheelTimer;
-import io.netty.util.Timer;
import io.netty.util.concurrent.Promise;
import java.util.Collections;
import org.junit.Assert;
import org.junit.Test;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
-import org.opendaylight.netconf.api.NetconfDocumentedException;
import org.opendaylight.netconf.api.NetconfSessionListener;
import org.opendaylight.netconf.api.NetconfSessionPreferences;
import org.opendaylight.netconf.api.messages.NetconfHelloMessage;
Assert.assertTrue("ChunkedFramingMechanismEncoder was not installed in the Netconf pipeline",
channel.pipeline().get(NETCONF_MESSAGE_FRAME_ENCODER) instanceof ChunkedFramingMechanismEncoder);
}
-
- private static class TestSessionNegotiator extends
- AbstractNetconfSessionNegotiator<NetconfSessionPreferences,
- TestingNetconfSession, NetconfSessionListener<TestingNetconfSession>> {
-
-
- TestSessionNegotiator(final NetconfSessionPreferences sessionPreferences,
- final Promise<TestingNetconfSession> promise, final Channel channel,
- final Timer timer,
- final NetconfSessionListener<TestingNetconfSession> sessionListener,
- final long connectionTimeoutMillis) {
- super(sessionPreferences, promise, channel, timer, sessionListener, connectionTimeoutMillis);
- }
-
- @Override
- protected TestingNetconfSession getSession(final NetconfSessionListener sessionListener, final Channel channel,
- final NetconfHelloMessage message)
- throws NetconfDocumentedException {
- return new TestingNetconfSession(sessionListener, channel, 0L);
- }
-
- @Override
- protected void handleMessage(final NetconfHelloMessage netconfHelloMessage) throws Exception {
-
- }
- }
}
\ No newline at end of file
--- /dev/null
+/*
+ * Copyright (c) 2018 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * 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.nettyutil;
+
+import io.netty.channel.Channel;
+import io.netty.util.Timer;
+import io.netty.util.concurrent.Promise;
+import org.opendaylight.netconf.api.NetconfDocumentedException;
+import org.opendaylight.netconf.api.NetconfSessionListener;
+import org.opendaylight.netconf.api.NetconfSessionPreferences;
+import org.opendaylight.netconf.api.messages.NetconfHelloMessage;
+
+final class TestSessionNegotiator extends
+ AbstractNetconfSessionNegotiator<NetconfSessionPreferences,
+ TestingNetconfSession, NetconfSessionListener<TestingNetconfSession>> {
+
+
+ TestSessionNegotiator(final NetconfSessionPreferences sessionPreferences,
+ final Promise<TestingNetconfSession> promise, final Channel channel,
+ final Timer timer,
+ final NetconfSessionListener<TestingNetconfSession> sessionListener,
+ final long connectionTimeoutMillis) {
+ super(sessionPreferences, promise, channel, timer, sessionListener, connectionTimeoutMillis);
+ }
+
+ @Override
+ protected TestingNetconfSession getSession(final NetconfSessionListener sessionListener, final Channel channel,
+ final NetconfHelloMessage message)
+ throws NetconfDocumentedException {
+ return new TestingNetconfSession(sessionListener, channel, 0L);
+ }
+
+ @Override
+ protected void handleMessage(final NetconfHelloMessage netconfHelloMessage) throws Exception {
+
+ }
+}
\ No newline at end of file