<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE network-config SYSTEM "grizzly-config.dtd">
<network-config>
    <transports>
       <!-- Transport describes network transport and its properties.-->

       <!-- Optional. Those apply to all transport element-->
        <selection-key-handler name="defSelectionKeyHandler" 
	                       classname="com.my.MyTCPSelectionKeyHandler" 
		               idle-key-timeout="30"/> 
        
       <!-- Declare new my-tcp transport -->
        <transport name="my-tcp" classname="com.my.MyTCPSelectorHandler">
           <!-- Optional. In-place declaration of the SelectionKey handler -->
            <selection-key-handler classname="com.my.MyTCPSelectionKeyHandler"
	                           idle-key-timeout="30"/>
        </transport>

       <!-- Overwrite predefined TLS transport settings -->
        <transport name="tls" selection-key-handler="defSelectionKeyHandler">
           <!-- Optional list of properties -->
            <property name="keyStore" value="keyStorePath/"/>
            <property name="trustStore" value="trustStorePath/"/>
        </transport>
    </transports>
    <protocols>
        <protocol name="http" max-selectors="30" read-timeout="5000"
                  write-timeout="30000" oob-inline="true">
            <property name=
	              "com.sun.enterprise.web.connector.grizzly.enableSnoop"
	             value="true"/>
            <protocol-chain-instance-handler>
                <protocol-chain>
                    <protocol-filter 
                        classname="com.sun.grizzly.filter.HttpProtocolFilter" />
                </protocol-chain>
            </protocol-chain-instance-handler>
        </protocol>
        <protocol name="multi-protocols" byte-buffer-type="DIRECT">
            <property 
                    name="com.sun.enterprise.web.connector.grizzly.enableSnoop"
		    value="true"/>
            
           <!-- Optional -->
           <!-- Port Unification section describes high-level protocols 
                and there Finders.
                Several protocols can share the same listener using port
	       	unification mechanism.           
           -->
            <port-unification>
               <!-- Mandatory -->
                   <!-- The order is important here. If a Finder is 
		         successful The next Finder will not be invoked,
			 but instead the associated the protocol will be
			 called -->
                <finder classname="com.custom.MyHttpFinder" protocol="http">
                    <property name="someproperty" value="somevalue"/>
                </finder>
                <finder classname="com.custom.MyIIOPFinder">
                    <property name="someproperty" value="somevalue"/>
                    <protocol name="iiop">
                        <protocol-chain-instance-handler>
                            <protocol-chain>
                                <protocol-filter 
                        classname="com.sun.grizzly.filter.IiopProtocolFilter" />
                            </protocol-chain>
                        </protocol-chain-instance-handler>
                    </protocol>
                </finder>
            </port-unification>
        </protocol>
        <protocol name="https">
            <property name="-Dcom.sun....maxSelector" value="30"/>
            <ssl cert-nickname="s1as" client-auth-enabled="false" 
	         ssl2-enabled="false" ssl3-enabled="true" tls-enabled="true"
		 tls-rollback-enabled="true">
                <!-- Override the properties of the transport "tls" -->
                <property name="keyStore" value="keyStorePath/"/>
                <property name="trustStore" value="trustStorePath/"/>
            </ssl>
            <protocol-chain-instance-handler>
                <protocol-chain>
                    <protocol-filter classname=
			      "com.sun.grizzly.filter.HttpsProtocolFilter" />
                </protocol-chain>
            </protocol-chain-instance-handler>
        </protocol>
    </protocols>
    <listeners>
        <!-- Listener binds Transport  to the specific port and declares 
	     Protocol(s), listener -->
        <thread-pool name="defaultThreadPool" classname="mypool" 
	             min-threads="2" max-threads="5" max-tasks="4096"/>
        <listener name="http-listener" host="localhost" port="8080" transport="my-tcp"
                  protocol="http" thread-pool="defaultThreadPool">
           <!-- Mandatory -->
            <property name="reuseAddress" value="true"/>
        </listener>
        <listener name="https-listener" port="8181" transport="tls" protocol="https"
                  thread-pool="defaultThreadPool">
           <!-- Optional list of properties -->
            <property name="root" value="${user.home}/"/>
        </listener>
        <listener name="multi-listener" host="localhost" port="8080" transport="my-tcp" 
                  protocol="multi-protocols" thread-pool="defaultThreadPool">
            <property name="reuseAddress" value="true"/>
        </listener>
    </listeners>
</network-config>

