EMMA Coverage Report (generated Sat Sep 03 11:42:34 KST 2005)
[all classes][org.apache.mina.examples.echoserver]

COVERAGE SUMMARY FOR SOURCE FILE [Main.java]

nameclass, %method, %block, %line, %
Main.java0%   (0/1)0%   (0/4)0%   (0/60)0%   (0/16)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class Main0%   (0/1)0%   (0/4)0%   (0/60)0%   (0/16)
Main (): void 0%   (0/1)0%   (0/3)0%   (0/1)
addLogger (ServiceRegistry): void 0%   (0/1)0%   (0/15)0%   (0/4)
addSSLSupport (ServiceRegistry): void 0%   (0/1)0%   (0/19)0%   (0/5)
main (String []): void 0%   (0/1)0%   (0/23)0%   (0/6)

1/*
2 *   @(#) $Id: Main.java 264677 2005-08-30 02:44:35Z trustin $
3 *
4 *   Copyright 2004 The Apache Software Foundation
5 *
6 *   Licensed under the Apache License, Version 2.0 (the "License");
7 *   you may not use this file except in compliance with the License.
8 *   You may obtain a copy of the License at
9 *
10 *       http://www.apache.org/licenses/LICENSE-2.0
11 *
12 *   Unless required by applicable law or agreed to in writing, software
13 *   distributed under the License is distributed on an "AS IS" BASIS,
14 *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 *   See the License for the specific language governing permissions and
16 *   limitations under the License.
17 *
18 */
19package org.apache.mina.examples.echoserver;
20 
21import org.apache.mina.common.TransportType;
22import org.apache.mina.examples.echoserver.ssl.BogusSSLContextFactory;
23import org.apache.mina.io.IoAcceptor;
24import org.apache.mina.io.filter.IoLoggingFilter;
25import org.apache.mina.io.filter.SSLFilter;
26import org.apache.mina.registry.Service;
27import org.apache.mina.registry.ServiceRegistry;
28import org.apache.mina.registry.SimpleServiceRegistry;
29 
30/**
31 * (<b>Entry point</b>) Echo server
32 * 
33 * @author Trustin Lee (trustin@apache.org)
34 * @version $Rev: 264677 $, $Date: 2005-08-30 11:44:35 +0900 $
35 */
36public class Main
37{
38    /** Choose your favorite port number. */
39    private static final int PORT = 8080;
40    
41    /** Set this to true if you want to make the server SSL */
42    private static final boolean USE_SSL = false;
43 
44    public static void main( String[] args ) throws Exception
45    {
46        ServiceRegistry registry = new SimpleServiceRegistry();
47        
48        // Add SSL filter if SSL is enabled.
49        if( USE_SSL )
50        {
51            addSSLSupport( registry );
52        }
53        
54        addLogger( registry );
55        
56        // Bind
57        Service service = new Service( "echo", TransportType.SOCKET, PORT );
58        registry.bind( service, new EchoProtocolHandler() );
59 
60        System.out.println( "Listening on port " + PORT );
61    }
62 
63    private static void addSSLSupport( ServiceRegistry registry )
64        throws Exception
65    {
66        SSLFilter sslFilter =
67            new SSLFilter( BogusSSLContextFactory.getInstance( true ) );
68        IoAcceptor acceptor = registry.getIoAcceptor( TransportType.SOCKET );
69        acceptor.getFilterChain().addLast( "sslFilter", sslFilter );
70        System.out.println( "SSL ON" );
71    }
72    
73    private static void addLogger( ServiceRegistry registry )
74    {
75        IoAcceptor acceptor = registry.getIoAcceptor( TransportType.SOCKET );
76        acceptor.getFilterChain().addLast( "logger", new IoLoggingFilter() );
77        System.out.println( "Logging ON" );
78    }
79}

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