// Path: src/test/java/org/jboss/netty/channel/FakeChannelHandlerContext.java
// public class FakeChannelHandlerContext implements ChannelHandlerContext {
// 
//     private Channel channel;
//     private final ExecutionHandler handler;
//     
//     public FakeChannelHandlerContext(Channel channel, ExecutionHandler handler) {
//         this.channel = channel;
//         this.handler = handler;
//     }
//     
//     @Override
//     public boolean canHandleDownstream() {
//         return true;
//     }
// 
//     @Override
//     public boolean canHandleUpstream() {
//         return true;
//     }
// 
//     @Override
//     public Object getAttachment() {
//         // TODO Auto-generated method stub
//         return null;
//     }
// 
//     @Override
//     public Channel getChannel() {
//         return channel;
//     }
// 
//     @Override
//     public ChannelHandler getHandler() {
//         return handler;
//     }
// 
//     @Override
//     public String getName() {
//         return handler.getClass().getName();
//     }
// 
//     @Override
//     public ChannelPipeline getPipeline() {
//         return null;
//     }
// 
//     @Override
//     public void sendDownstream(ChannelEvent e) {
//         // NOOP
//     }
// 
//     @Override
//     public void sendUpstream(ChannelEvent e) {
//         // NOOP
//     }
// 
//     @Override
//     public void setAttachment(Object o) {
//         // NOOP
//     }
// 
// }


import static org.easymock.EasyMock.createMock;
import static org.easymock.EasyMock.expect;
import static org.easymock.EasyMock.replay;
import static org.jboss.netty.handler.codec.http.HttpMethod.POST;
import static org.jboss.netty.handler.codec.http.HttpVersion.HTTP_1_1;
import static org.junit.Assert.assertTrue;
import java.net.InetSocketAddress;
import org.jboss.netty.buffer.ChannelBuffers;
import org.jboss.netty.channel.Channel;
import org.jboss.netty.channel.ChannelHandlerContext;
import org.jboss.netty.channel.DefaultChannelFuture;
import org.jboss.netty.channel.FakeChannelHandlerContext;
import org.jboss.netty.channel.MessageEvent;
import org.jboss.netty.channel.UpstreamMessageEvent;
import org.jboss.netty.handler.codec.frame.TooLongFrameException;
import org.jboss.netty.handler.codec.http.DefaultHttpRequest;
import org.jboss.netty.handler.codec.http.HttpMethod;
import org.jboss.netty.handler.codec.http.HttpRequest;
import org.jboss.netty.handler.codec.http.HttpVersion;
import org.jboss.netty.handler.execution.ExecutionHandler;
import org.jboss.netty.handler.execution.OrderedMemoryAwareThreadPoolExecutor;
import org.junit.Before;
import org.junit.Test;
/*
 * Copyright 2012 Mozilla Foundation
 *
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.mozilla.bagheera.http;




public class ContentLengthFilterTest {

    private ChannelHandlerContext ctx;
    private InetSocketAddress remoteAddr;
    
    @Before
    public void setup() {
        Channel channel = createMock(Channel.class);
        expect(channel.getCloseFuture()).andReturn(new DefaultChannelFuture(channel, false));
        expect(channel.getRemoteAddress()).andReturn(InetSocketAddress.createUnresolved("192.168.1.1", 51723));
        
        OrderedMemoryAwareThreadPoolExecutor executor = new OrderedMemoryAwareThreadPoolExecutor(10, 0L, 0L);
        final ExecutionHandler handler = new ExecutionHandler(executor, true, true);
        
// Path: src/test/java/org/jboss/netty/channel/FakeChannelHandlerContext.java
// public class FakeChannelHandlerContext implements ChannelHandlerContext {
// 
//     private Channel channel;
//     private final ExecutionHandler handler;
//     
//     public FakeChannelHandlerContext(Channel channel, ExecutionHandler handler) {
//         this.channel = channel;
//         this.handler = handler;
//     }
//     
//     @Override
//     public boolean canHandleDownstream() {
//         return true;
//     }
// 
//     @Override
//     public boolean canHandleUpstream() {
//         return true;
//     }
// 
//     @Override
//     public Object getAttachment() {
//         // TODO Auto-generated method stub
//         return null;
//     }
// 
//     @Override
//     public Channel getChannel() {
//         return channel;
//     }
// 
//     @Override
//     public ChannelHandler getHandler() {
//         return handler;
//     }
// 
//     @Override
//     public String getName() {
//         return handler.getClass().getName();
//     }
// 
//     @Override
//     public ChannelPipeline getPipeline() {
//         return null;
//     }
// 
//     @Override
//     public void sendDownstream(ChannelEvent e) {
//         // NOOP
//     }
// 
//     @Override
//     public void sendUpstream(ChannelEvent e) {
//         // NOOP
//     }
// 
//     @Override
//     public void setAttachment(Object o) {
//         // NOOP
//     }
// 
// }


// Path: src/test/java/com/mozilla/bagheera/http/ContentLengthFilterTest.java
import static org.easymock.EasyMock.createMock;
import static org.easymock.EasyMock.expect;
import static org.easymock.EasyMock.replay;
import static org.jboss.netty.handler.codec.http.HttpMethod.POST;
import static org.jboss.netty.handler.codec.http.HttpVersion.HTTP_1_1;
import static org.junit.Assert.assertTrue;
import java.net.InetSocketAddress;
import org.jboss.netty.buffer.ChannelBuffers;
import org.jboss.netty.channel.Channel;
import org.jboss.netty.channel.ChannelHandlerContext;
import org.jboss.netty.channel.DefaultChannelFuture;
import org.jboss.netty.channel.FakeChannelHandlerContext;
import org.jboss.netty.channel.MessageEvent;
import org.jboss.netty.channel.UpstreamMessageEvent;
import org.jboss.netty.handler.codec.frame.TooLongFrameException;
import org.jboss.netty.handler.codec.http.DefaultHttpRequest;
import org.jboss.netty.handler.codec.http.HttpMethod;
import org.jboss.netty.handler.codec.http.HttpRequest;
import org.jboss.netty.handler.codec.http.HttpVersion;
import org.jboss.netty.handler.execution.ExecutionHandler;
import org.jboss.netty.handler.execution.OrderedMemoryAwareThreadPoolExecutor;
import org.junit.Before;
import org.junit.Test;

/*
 * Copyright 2012 Mozilla Foundation
 *
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.mozilla.bagheera.http;




public class ContentLengthFilterTest {

    private ChannelHandlerContext ctx;
    private InetSocketAddress remoteAddr;
    
    @Before
    public void setup() {
        Channel channel = createMock(Channel.class);
        expect(channel.getCloseFuture()).andReturn(new DefaultChannelFuture(channel, false));
        expect(channel.getRemoteAddress()).andReturn(InetSocketAddress.createUnresolved("192.168.1.1", 51723));
        
        OrderedMemoryAwareThreadPoolExecutor executor = new OrderedMemoryAwareThreadPoolExecutor(10, 0L, 0L);
        final ExecutionHandler handler = new ExecutionHandler(executor, true, true);
        
        ctx = new FakeChannelHandlerContext(channel, handler);