// Path: src/test/java/com/yammer/httptunnel/FakeChannelSink.java
// public class FakeChannelSink extends AbstractChannelSink {
// 
// 	public final Queue<ChannelEvent> events;
// 
// 	public FakeChannelSink() {
// 		events = new LinkedList<ChannelEvent>();
// 	}
// 
// 	@Override
// 	public void eventSunk(ChannelPipeline pipeline, ChannelEvent e) throws Exception {
// 		events.add(e);
// 	}
// }
// 
// Path: src/test/java/com/yammer/httptunnel/FakeServerSocketChannel.java
// public class FakeServerSocketChannel extends AbstractChannel implements
// 		ServerSocketChannel {
// 
// 	public boolean bound;
// 
// 	public boolean connected;
// 
// 	public InetSocketAddress remoteAddress;
// 
// 	public InetSocketAddress localAddress;
// 
// 	public ServerSocketChannelConfig config = new FakeServerSocketChannelConfig();
// 
// 	public FakeServerSocketChannel(ChannelFactory factory,
// 			ChannelPipeline pipeline, ChannelSink sink) {
// 		super(null, factory, pipeline, sink);
// 	}
// 
// 	@Override
// 	public ServerSocketChannelConfig getConfig() {
// 		return config;
// 	}
// 
// 	@Override
// 	public InetSocketAddress getLocalAddress() {
// 		return localAddress;
// 	}
// 
// 	@Override
// 	public InetSocketAddress getRemoteAddress() {
// 		return remoteAddress;
// 	}
// 
// 	@Override
// 	public boolean isBound() {
// 		return bound;
// 	}
// 
// 	@Override
// 	public boolean isConnected() {
// 		return connected;
// 	}
// 
// 	public FakeSocketChannel acceptNewConnection(
// 			InetSocketAddress remoteAddress, ChannelSink sink) throws Exception {
// 		ChannelPipeline newPipeline = getConfig().getPipelineFactory()
// 				.getPipeline();
// 		FakeSocketChannel newChannel = new FakeSocketChannel(this,
// 				getFactory(), newPipeline, sink);
// 		newChannel.localAddress = localAddress;
// 		newChannel.remoteAddress = remoteAddress;
// 		fireChannelOpen(newChannel);
// 		fireChannelBound(newChannel, newChannel.localAddress);
// 		fireChannelConnected(this, newChannel.remoteAddress);
// 
// 		return newChannel;
// 	}
// 
// }


import org.junit.Test;
import org.junit.runner.RunWith;
import com.yammer.httptunnel.FakeChannelSink;
import com.yammer.httptunnel.FakeServerSocketChannel;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.fail;
import org.jboss.netty.channel.ChannelException;
import org.jboss.netty.channel.ChannelPipeline;
import org.jboss.netty.channel.Channels;
import org.jboss.netty.channel.SimpleChannelHandler;
import org.jboss.netty.channel.socket.ServerSocketChannel;
import org.jboss.netty.channel.socket.ServerSocketChannelFactory;
import org.jmock.Expectations;
import org.jmock.integration.junit4.JMock;
import org.jmock.integration.junit4.JUnit4Mockery;
import org.junit.Before;
/*
 * Copyright 2009 Red Hat, Inc.
 *
 * Red Hat 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.yammer.httptunnel.server;




/**
 * @author The Netty Project (netty-dev@lists.jboss.org)
 * @author Iain McGinniss (iain.mcginniss@onedrum.com)
 */
@RunWith(JMock.class)
public class HttpTunnelServerChannelFactoryTest {

	private final JUnit4Mockery mockContext = new JUnit4Mockery();

	ServerSocketChannelFactory realChannelFactory;

	private HttpTunnelServerChannelFactory factory;

	ServerSocketChannel realChannel;

	@Before
	public void setUp() throws Exception {
		realChannelFactory = mockContext.mock(ServerSocketChannelFactory.class);
		factory = new HttpTunnelServerChannelFactory(realChannelFactory);
		ChannelPipeline pipeline = Channels.pipeline(new SimpleChannelHandler());
		realChannel = new FakeServerSocketChannel(factory, pipeline,
// Path: src/test/java/com/yammer/httptunnel/FakeChannelSink.java
// public class FakeChannelSink extends AbstractChannelSink {
// 
// 	public final Queue<ChannelEvent> events;
// 
// 	public FakeChannelSink() {
// 		events = new LinkedList<ChannelEvent>();
// 	}
// 
// 	@Override
// 	public void eventSunk(ChannelPipeline pipeline, ChannelEvent e) throws Exception {
// 		events.add(e);
// 	}
// }
// 
// Path: src/test/java/com/yammer/httptunnel/FakeServerSocketChannel.java
// public class FakeServerSocketChannel extends AbstractChannel implements
// 		ServerSocketChannel {
// 
// 	public boolean bound;
// 
// 	public boolean connected;
// 
// 	public InetSocketAddress remoteAddress;
// 
// 	public InetSocketAddress localAddress;
// 
// 	public ServerSocketChannelConfig config = new FakeServerSocketChannelConfig();
// 
// 	public FakeServerSocketChannel(ChannelFactory factory,
// 			ChannelPipeline pipeline, ChannelSink sink) {
// 		super(null, factory, pipeline, sink);
// 	}
// 
// 	@Override
// 	public ServerSocketChannelConfig getConfig() {
// 		return config;
// 	}
// 
// 	@Override
// 	public InetSocketAddress getLocalAddress() {
// 		return localAddress;
// 	}
// 
// 	@Override
// 	public InetSocketAddress getRemoteAddress() {
// 		return remoteAddress;
// 	}
// 
// 	@Override
// 	public boolean isBound() {
// 		return bound;
// 	}
// 
// 	@Override
// 	public boolean isConnected() {
// 		return connected;
// 	}
// 
// 	public FakeSocketChannel acceptNewConnection(
// 			InetSocketAddress remoteAddress, ChannelSink sink) throws Exception {
// 		ChannelPipeline newPipeline = getConfig().getPipelineFactory()
// 				.getPipeline();
// 		FakeSocketChannel newChannel = new FakeSocketChannel(this,
// 				getFactory(), newPipeline, sink);
// 		newChannel.localAddress = localAddress;
// 		newChannel.remoteAddress = remoteAddress;
// 		fireChannelOpen(newChannel);
// 		fireChannelBound(newChannel, newChannel.localAddress);
// 		fireChannelConnected(this, newChannel.remoteAddress);
// 
// 		return newChannel;
// 	}
// 
// }


// Path: src/test/java/com/yammer/httptunnel/server/HttpTunnelServerChannelFactoryTest.java
import org.junit.Test;
import org.junit.runner.RunWith;
import com.yammer.httptunnel.FakeChannelSink;
import com.yammer.httptunnel.FakeServerSocketChannel;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.fail;
import org.jboss.netty.channel.ChannelException;
import org.jboss.netty.channel.ChannelPipeline;
import org.jboss.netty.channel.Channels;
import org.jboss.netty.channel.SimpleChannelHandler;
import org.jboss.netty.channel.socket.ServerSocketChannel;
import org.jboss.netty.channel.socket.ServerSocketChannelFactory;
import org.jmock.Expectations;
import org.jmock.integration.junit4.JMock;
import org.jmock.integration.junit4.JUnit4Mockery;
import org.junit.Before;

/*
 * Copyright 2009 Red Hat, Inc.
 *
 * Red Hat 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.yammer.httptunnel.server;




/**
 * @author The Netty Project (netty-dev@lists.jboss.org)
 * @author Iain McGinniss (iain.mcginniss@onedrum.com)
 */
@RunWith(JMock.class)
public class HttpTunnelServerChannelFactoryTest {

	private final JUnit4Mockery mockContext = new JUnit4Mockery();

	ServerSocketChannelFactory realChannelFactory;

	private HttpTunnelServerChannelFactory factory;

	ServerSocketChannel realChannel;

	@Before
	public void setUp() throws Exception {
		realChannelFactory = mockContext.mock(ServerSocketChannelFactory.class);
		factory = new HttpTunnelServerChannelFactory(realChannelFactory);
		ChannelPipeline pipeline = Channels.pipeline(new SimpleChannelHandler());
		realChannel = new FakeServerSocketChannel(factory, pipeline,
				new FakeChannelSink());