1   /*
2    * Created on Nov 10, 2003
3    *
4    * Copyright neotechnologies.org
5    */
6   package org.neo.swarm.services.tcp;
7   
8   import java.net.InetAddress;
9   
10  import junit.framework.TestCase;
11  
12  import org.neo.swarm.services.tcp.TcpServer;
13  import org.neo.swarm.util.network.tcp.ListenCallback;
14  import org.neo.swarm.util.threads.OswegoThreadPool;
15  
16  import EDU.oswego.cs.dl.util.concurrent.PooledExecutor;
17  
18  import com.mockobjects.dynamic.Mock;
19  
20  /***
21   * Test TCP service functionality.
22   * 
23   * @author neil.avery
24   */
25  public class TcpServiceTest extends TestCase {
26  	
27  	public void testStartStop() throws Exception {
28  		try {
29  		Mock cb = new Mock(ListenCallback.class);
30  		TcpServer tcpService = new TcpServer(InetAddress.getLocalHost(), 8080, (ListenCallback) cb.proxy(), new OswegoThreadPool(new PooledExecutor(), 1, 10));
31  		tcpService.start();
32  		Thread.sleep(2000);
33  		tcpService.stop();
34  		} catch (InterruptedException e){
35  			e.printStackTrace();
36  		}
37  	}
38  
39  }