package network.thunder.core.communication.objects.messages.impl;

import io.netty.channel.ChannelHandlerContext;
import network.thunder.core.communication.Message;
import network.thunder.core.communication.objects.messages.MessageExecutor;

/**
 * Created by matsjerratsch on 03/12/2015.
 */
public class MessageExecutorImpl implements MessageExecutor {
    ChannelHandlerContext context;
    String layerName;

    public MessageExecutorImpl (ChannelHandlerContext context) {
        this.context = context;
    }

    public MessageExecutorImpl (ChannelHandlerContext context, String layerName) {
        this.context = context;
        this.layerName = layerName;
    }

    public void setContext (ChannelHandlerContext context) {
        this.context = context;
    }

    @Override
    public void sendNextLayerActive () {
        context.fireChannelActive();
    }

    @Override
    public void sendMessageUpwards (Message message) {
        context.writeAndFlush(message);
    }

    @Override
    public void sendMessageDownwards (Message message) {
        context.fireChannelRead(message);
    }

    @Override
    public void closeConnection () {
        context.close();
    }
}

@@ -483,34 +483,29 @@
     this
-.
+(
 context
- = context
+, %22%22)
 ;%0A    %7D%0A
@@ -667,108 +667,8 @@
  %7D%0A%0A
-    public void setContext (ChannelHandlerContext context) %7B%0A        this.context = context;%0A    %7D%0A%0A
     

Refactor MessageExecutorImpl