package com.pig4cloud.pig.statistics.socket;

import java.net.Socket;

/**
 * 客户端处理器工厂，负责创建ClientHandler实例
 * 解耦TcpServer与ClientHandler的依赖关系
 */
public class ClientHandlerFactory {
    /**
     * 创建客户端处理器实例
     */
    public ClientHandler createClientHandler(Socket clientSocket) {
        // 创建所需的依赖组件
        ProtocolHandler protocolHandler = new ProtocolHandler();
        DataProcessor dataProcessor = new DataProcessor();
        
        // 创建并返回ClientHandler实例
        return new ClientHandler(clientSocket, protocolHandler, dataProcessor);
    }
}
    