private void processFirstPacket(PhysicalConnection connection,int uCommand, IncomingPacket packet,int serviceBytes)
	{
	    Pointer<OutgoingPacket> pOutPacket = new Pointer<OutgoingPacket>();
	    //
	    Pointer<LogicalConnection> pClient = new Pointer<LogicalConnection>();
	    ConnectionEventListener.Result iResult = server.getConnectionEventListener().onFirstRequest(packet, connection.getConnectionContext(), pClient, pOutPacket);

	    LogicalConnection client = pClient.getValue();
	    //packet and lpContext are not good.
	    if (iResult == ConnectionEventListener.Result.RefuseAndClose)
	    {
	        if (pOutPacket.notNull())
	        {
	            connection.pushPacket(pOutPacket.getValue());
	            server.disposeOutgoingPacket(pOutPacket.getValue());
	        }
	        connection.close(false);
	        return;
	    }
	    //
	    if (iResult == ConnectionEventListener.Result.RefuseRequest)
	    {
	        if (pOutPacket.notNull())
	        {
	            connection.pushPacket(pOutPacket.getValue());
	            server.disposeOutgoingPacket(pOutPacket.getValue());
	        }
	        return;
	    }

	    String clientKey = client.getKey();


	    //iResult >= CClientFactory.CreateClient
//	    if (!channelFactory.RemoveFromUnattachedList(pChannel))
	    if (!server.getChannelFactory().removeFromUnattachedList(connection))
	    {
//	        delete pClient;
	        connection.decrementIoWorkersReferenceCounter();
	        return;
	    }


	    //Bind the two structures.
	    client.physicalConnection = connection;
	    connection.attachToClient(client); //status is attached.

//	    stats.addToCumul(ServerStats.VisitorsHitsIn, 1);
	    server.getServerStats().addToCumul(ServerStats.Measures.VisitorsHitsIn, 1);

//	    LogicalConnection pRet = clientFactoryImpl.AddLogicalConnection(pClient);
	    LogicalConnection pRet = server.getClientFactory().addLogicalConnection(client);
	    if (pRet != client)
	    {
	        //Copy data from existing to new instance.
	    	server.getConnectionEventListener().copyLogicalConnection(pRet, client);

	        //Silent disconnect :
//	        clientFactoryImpl.SilentDisconnect(pRet);
	    	server.getClientFactory().silentDisconnect(pRet);

	        //Now add ours :
//	        clientFactoryImpl.AddLogicalConnection(pClient);
	    	server.getClientFactory().addLogicalConnection(client);

	        //Fire Reconnect event.
	        server.getConnectionEventListener().onConnectionReconnected(client);

	        //Add client to a streamer :
//	        broadcastStreamerManager.AddClient(pClient);
	        server.getBroadcastStreamerManager().addConnection(client);

	        client.decrementUsage();
	        return;
	    }

	    //Fire connect event.
	    server.getConnectionEventListener().onConnectionConnected(client);
	    //Add client to a streamer :
//	    broadcastStreamerManager.AddClient(pClient);
	    server.getBroadcastStreamerManager().addConnection(client);

	    //Statistics :
	    NotifyObserversClientIN(clientKey, connection.getPeerIP(), connection.getPeerPort());
//	    stats.addToCumul(ServerStats.VisitorsOnline, 1);
	    server.getServerStats().addToCumul(ServerStats.Measures.VisitorsOnline, 1);


	    if (iResult == ConnectionEventListener.Result.CreateAndRouteRequest)
	    {
	        dispatchRequest(uCommand, client, packet, serviceBytes);
	    }
	    else
	    {
	        if (pOutPacket.notNull())
	        {
	            connection.pushPacket(pOutPacket.getValue());
	            server.disposeOutgoingPacket(pOutPacket.getValue());
	        }
	    }

	    client.decrementUsage();
	}