* 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.netty;
import io.netty.bootstrap.ServerBootstrap;
public class ProxyServer implements Runnable {
private final ProxyHandlerFactory proxyHandlerFactory;
- public ProxyServer(ProxyHandlerFactory proxyHandlerFactory) {
+ public ProxyServer(final ProxyHandlerFactory proxyHandlerFactory) {
this.proxyHandlerFactory = proxyHandlerFactory;
}
- @SuppressWarnings("checkstyle:IllegalCatch")
+ @Override
public void run() {
// Configure the server.
final EventLoopGroup bossGroup = new NioEventLoopGroup();
.handler(new LoggingHandler(LogLevel.INFO))
.childHandler(new ChannelInitializer<SocketChannel>() {
@Override
- public void initChannel(SocketChannel ch) throws Exception {
+ public void initChannel(final SocketChannel ch) throws Exception {
ch.pipeline().addLast(proxyHandlerFactory.create(bossGroup, localAddress));
}
});
// Wait until the server socket is closed.
future.channel().closeFuture().sync();
- } catch (Exception e) {
+ } catch (InterruptedException e) {
throw new RuntimeException(e);
} finally {
// Shut down all event loops to terminate all threads.
ChannelHandler create(EventLoopGroup bossGroup, LocalAddress localAddress);
}
- public static void main(String[] args) {
+ public static void main(final String[] args) {
ProxyHandlerFactory proxyHandlerFactory = ProxyServerHandler::new;
start(proxyHandlerFactory);
}
- public static void start(ProxyHandlerFactory proxyHandlerFactory) {
+ public static void start(final ProxyHandlerFactory proxyHandlerFactory) {
new Thread(new EchoServer()).start();
new Thread(new ProxyServer(proxyHandlerFactory)).start();
}