public T CreatePeer <T>(IPeerConfig config) where T : class
        {
            // Client and server incomming
            var initRequest = config.GetConfig <InitRequest>();
            // When we get a response, we get the photon application it came in on.
            var applicationBase = config.GetConfig <PhotonApplication>();

            if (initRequest != null)
            {
                Log.DebugFormat("Connection request on port {0}", initRequest.LocalPort);
                if (initRequest.LocalPort == ParentPort)
                {
                    // If not sibling
                    var inboundPeer = new InboundPhotonPeer(initRequest);
                    inboundPeer.ServerPeer = ServerPeerFactory(inboundPeer, false);
                    return(inboundPeer as T);
                }
                else if (initRequest.LocalPort == SiblingPort)
                {
                    // if sibling
                    var inboundPeer = new InboundPhotonPeer(initRequest);
                    inboundPeer.ServerPeer = ServerPeerFactory(inboundPeer, true);
                    return(inboundPeer as T);
                }
                if (AllowPhysicalClients)
                {
                    return(ClientPeerFactory(initRequest) as T);
                }
                return(null);
            }
            else
            {
                return(SubServerClientPeerFactory() as T);
            }
        }
        /// <summary>
        /// Create new peer.
        /// </summary>
        /// <typeparam name="T">class.</typeparam>
        /// <param name="config">Peer configuration.</param>
        /// <returns>T peer class.</returns>
        public T CreatePeer <T>(IPeerConfig config) where T : class
        {
            var initRequest     = config.GetConfig <InitRequest>();
            var applicationBase = config.GetConfig <PhotonApplication>();

            if (initRequest != null)
            {
                Log.DebugFormat("Connection request on port {0}", initRequest.LocalPort);

                if (initRequest.LocalPort == ParentPort)
                {
                    var inboundPeer = new InboundPhotonPeer(initRequest);
                    inboundPeer.ServerPeer = ServerPeerFactory(inboundPeer, false);
                    return(inboundPeer as T);
                }
                else if (initRequest.LocalPort == SiblingPort)
                {
                    var inboundPeer = new InboundPhotonPeer(initRequest);
                    inboundPeer.ServerPeer = ServerPeerFactory(inboundPeer, true);
                    return(inboundPeer as T);
                }

                if (AllowPhysicalClients)
                {
                    return(ClientPeerFactory(initRequest) as T);
                }

                return(null);
            }
            else
            {
                return(SubServerClientPeerFactory() as T);
            }
        }