X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fcommons%2Fprotocol-framework%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fprotocol%2Fframework%2FSimpleDispatcher.java;fp=opendaylight%2Fcommons%2Fprotocol-framework%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fprotocol%2Fframework%2FSimpleDispatcher.java;h=0000000000000000000000000000000000000000;hp=314fd42c7d37c2865fdb5842afdcfa6c3d62ce87;hb=13f8c99a25932f1b33505dadcbd3fea6608389cb;hpb=6ca44d2095f0887508dd32f0174058a627eff4f9 diff --git a/opendaylight/commons/protocol-framework/src/test/java/org/opendaylight/protocol/framework/SimpleDispatcher.java b/opendaylight/commons/protocol-framework/src/test/java/org/opendaylight/protocol/framework/SimpleDispatcher.java deleted file mode 100644 index 314fd42c7d..0000000000 --- a/opendaylight/commons/protocol-framework/src/test/java/org/opendaylight/protocol/framework/SimpleDispatcher.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (c) 2013 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.protocol.framework; - -import io.netty.channel.ChannelFuture; -import io.netty.channel.ChannelOutboundHandler; -import io.netty.channel.EventLoopGroup; -import io.netty.channel.socket.SocketChannel; -import io.netty.util.concurrent.Future; -import io.netty.util.concurrent.Promise; - -import java.net.InetSocketAddress; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import com.google.common.base.Preconditions; - -public class SimpleDispatcher extends AbstractDispatcher { - private static final Logger LOG = LoggerFactory.getLogger(SimpleDispatcher.class); - - private final SessionNegotiatorFactory negotiatorFactory; - private final ChannelOutboundHandler encoder = new SimpleMessageToByteEncoder(); - - private final class SimplePipelineInitializer implements PipelineInitializer { - final SessionListenerFactory listenerFactory; - - SimplePipelineInitializer(final SessionListenerFactory listenerFactory) { - this.listenerFactory = Preconditions.checkNotNull(listenerFactory); - } - - @Override - public void initializeChannel(final SocketChannel channel, final Promise promise) { - channel.pipeline().addLast(new SimpleByteToMessageDecoder()); - channel.pipeline().addLast("negotiator", negotiatorFactory.getSessionNegotiator(listenerFactory, channel, promise)); - channel.pipeline().addLast(encoder); - LOG.debug("initialization completed for channel {}", channel); - } - - } - - public SimpleDispatcher(final SessionNegotiatorFactory negotiatorFactory, - final Promise promise, final EventLoopGroup eventLoopGroup) { - super(eventLoopGroup, eventLoopGroup); - this.negotiatorFactory = Preconditions.checkNotNull(negotiatorFactory); - } - - public Future createClient(final InetSocketAddress address, final ReconnectStrategy strategy, final SessionListenerFactory listenerFactory) { - return super.createClient(address, strategy, new SimplePipelineInitializer(listenerFactory)); - } - - public Future createReconnectingClient(final InetSocketAddress address, final ReconnectStrategyFactory strategy, final SessionListenerFactory listenerFactory) { - return super.createReconnectingClient(address, strategy, new SimplePipelineInitializer(listenerFactory)); - } - - public ChannelFuture createServer(final InetSocketAddress address, final SessionListenerFactory listenerFactory) { - return super.createServer(address, new SimplePipelineInitializer(listenerFactory)); - } - - @Override - public void close() { - } -}