EMMA Coverage Report (generated Fri Oct 21 16:16:13 KST 2005)
[all classes][org.apache.mina.examples.tennis]

COVERAGE SUMMARY FOR SOURCE FILE [Main.java]

nameclass, %method, %block, %line, %
Main.java0%   (0/1)0%   (0/2)0%   (0/52)0%   (0/13)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class Main0%   (0/1)0%   (0/2)0%   (0/52)0%   (0/13)
Main (): void 0%   (0/1)0%   (0/3)0%   (0/1)
main (String []): void 0%   (0/1)0%   (0/49)0%   (0/12)

1/*
2 * @(#) $Id: Main.java 327113 2005-10-21 06:59:15Z trustin $
3 */
4package org.apache.mina.examples.tennis;
5 
6import org.apache.mina.common.TransportType;
7import org.apache.mina.protocol.ProtocolSession;
8import org.apache.mina.protocol.vmpipe.VmPipeAddress;
9import org.apache.mina.protocol.vmpipe.VmPipeConnector;
10import org.apache.mina.registry.Service;
11import org.apache.mina.registry.ServiceRegistry;
12import org.apache.mina.registry.SimpleServiceRegistry;
13 
14/**
15 * (<b>Entry point</b>) An 'in-VM pipe' example which simulates a tennis game
16 * between client and server.
17 * <ol>
18 *   <li>Client connects to server</li>
19 *   <li>At first, client sends {@link TennisBall} with TTL value '10'.</li>
20 *   <li>Received side (either server or client) decreases the TTL value of the
21 *     received ball, and returns it to remote peer.</li>
22 *   <li>Who gets the ball with 0 TTL loses.</li>
23 * </ol> 
24 * 
25 * @author The Apache Directory Project (dev@directory.apache.org)
26 * @version $Rev: 327113 $, $Date: 2005-10-21 15:59:15 +0900 $
27 */
28public class Main
29{
30 
31    public static void main( String[] args ) throws Exception
32    {
33        ServiceRegistry registry = new SimpleServiceRegistry();
34 
35        VmPipeAddress address = new VmPipeAddress( 8080 );
36 
37        // Set up server
38        Service service = new Service( "tennis", TransportType.VM_PIPE, address );
39        registry.bind( service, new TennisPlayer() );
40 
41        // Connect to the server.
42        VmPipeConnector connector = new VmPipeConnector();
43        ProtocolSession session = connector.connect( address,
44                                                     new TennisPlayer() );
45 
46        // Send the first ping message
47        session.write( new TennisBall( 10 ) );
48 
49        // Wait until the match ends.
50        while( session.isConnected() )
51        {
52            Thread.sleep( 100 );
53        }
54        
55        registry.unbind( service );
56    }
57}

[all classes][org.apache.mina.examples.tennis]
EMMA 2.0.4217 (C) Vladimir Roubtsov