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

COVERAGE SUMMARY FOR SOURCE FILE [Main.java]

nameclass, %method, %block, %line, %
Main.java0%   (0/1)0%   (0/3)0%   (0/45)0%   (0/12)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class Main0%   (0/1)0%   (0/3)0%   (0/45)0%   (0/12)
Main (): void 0%   (0/1)0%   (0/3)0%   (0/1)
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.httpserver;
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.SSLFilter;
25import org.apache.mina.registry.Service;
26import org.apache.mina.registry.ServiceRegistry;
27import org.apache.mina.registry.SimpleServiceRegistry;
28 
29/**
30 * (<b>Entry point</b>) HTTP server
31 * 
32 * @author Trustin Lee (trustin@apache.org)
33 * @version $Rev: 264677 $, $Date: 2005-08-30 11:44:35 +0900 $
34 */
35public class Main
36{
37    /** Choose your favorite port number. */
38    private static final int PORT = 8081;
39    
40    private static final boolean USE_SSL = true;
41 
42    public static void main( String[] args ) throws Exception
43    {
44        ServiceRegistry registry = new SimpleServiceRegistry();
45        
46        // Add SSL filter if SSL is enabled.
47        if( USE_SSL )
48        {
49            addSSLSupport( registry );
50        }
51 
52        // Bind
53        Service service = new Service( "http", TransportType.SOCKET, PORT );
54        registry.bind( service, new HttpProtocolHandler() );
55 
56        System.out.println( "Listening on port " + PORT );
57    }
58 
59 
60    private static void addSSLSupport( ServiceRegistry registry )
61        throws Exception
62    {
63        System.out.println( "SSL is enabled." );
64        SSLFilter sslFilter =
65            new SSLFilter( BogusSSLContextFactory.getInstance( true ) );
66        IoAcceptor acceptor = registry.getIoAcceptor( TransportType.SOCKET );
67        acceptor.getFilterChain().addLast( "sslFilter", sslFilter );
68    }
69}

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