duplicate of #1721 

You should move the setSuccess() call before the fireWriteComplete as we always notify the future first before fire this event in other transports

intermittent: local channel sometimes sends messages after close (3.6)
A local channel can receive messages after it has been closed.  This is the result of a race condition in DefaultLocalChannel.flushWriteBuffer:

```
e.getFuture().setSuccess();
fireMessageReceived(pairedChannel, e.getMessage());
fireWriteComplete(this, 1);
```

The future listener in this case is HttpConnectionHandler.ClosingChannelFutureListener.

The problem is that the future.setSuccess() races with the fireMessageReceived.  Moving the setSuccess to happen after the message is sent helps but doesn't completely remove the race:

```
fireMessageReceived(pairedChannel, e.getMessage());
fireWriteComplete(this, 1);
e.getFuture().setSuccess();
```

src/main/java/org/jboss/netty/channel/local/DefaultLocalChannel.java
src/main/java/org/jboss/netty/channel/local/DefaultLocalChannel.java
diff --git a/src/main/java/org/jboss/netty/channel/local/DefaultLocalChannel.java b/src/main/java/org/jboss/netty/channel/local/DefaultLocalChannel.java
index da02be3ece8..d127cd4d0a1 100644
--- a/src/main/java/org/jboss/netty/channel/local/DefaultLocalChannel.java
+++ b/src/main/java/org/jboss/netty/channel/local/DefaultLocalChannel.java
@@ -171,8 +171,8 @@ void flushWriteBuffer() {
                                 break;
                             }
 
-                            e.getFuture().setSuccess();
                             fireMessageReceived(pairedChannel, e.getMessage());
+                            e.getFuture().setSuccess();
                             fireWriteComplete(this, 1);
                         }
                     } finally {
@@ -198,8 +198,8 @@ void flushWriteBuffer() {
                     break;
                 }
 
-                e.getFuture().setFailure(cause);
                 fireExceptionCaught(this, cause);
+                e.getFuture().setFailure(cause);
             }
         }
     }
