/// <summary>
 ///     移除TCP调用服务端
 /// </summary>
 /// <param name="socket">TCP调用套接字</param>
 /// <param name="data">参数序列化数据</param>
 private void removeServer(TmphSocket socket, TmphSubArray<byte> data)
 {
     try
     {
         var host = new TmphHost();
         if (TmphDataDeSerializer.DeSerialize(data, ref host))
         {
             socket.SendStream(socket.Identity,
                 new TmphAsynchronousMethod.TmphReturnValue<bool>
                 {
                     IsReturn = true,
                     Value = server.removeServer(host)
                 });
             return;
         }
     }
     catch (Exception error)
     {
         TmphLog.Error.Add(error, null, true);
     }
     socket.SendStream(socket.Identity, new TmphAsynchronousMethod.TmphReturnValue { IsReturn = false });
 }
 /// <summary>
 ///     添加TCP调用服务端
 /// </summary>
 /// <param name="socket">TCP调用套接字</param>
 /// <param name="data">参数序列化数据</param>
 private void newServer(TmphSocket socket, TmphSubArray<byte> data)
 {
     try
     {
         var host = new TmphHost();
         if (TmphDataDeSerializer.DeSerialize(data, ref host))
         {
             TmphThreadPool.TinyPool.FastStart(server.newServerHandle,
                 new TmphServerInfo { Socket = socket, Identity = socket.Identity, Host = host }, null, null);
             return;
         }
     }
     catch (Exception error)
     {
         TmphLog.Error.Add(error, null, true);
     }
     socket.SendStream(socket.Identity, new TmphAsynchronousMethod.TmphReturnValue { IsReturn = false });
 }
 /// <summary>
 ///     停止客户端链接
 /// </summary>
 protected void dispose()
 {
     //if (tcpClient != null) tcpClient.Close();
     tcpClient.shutdown();
     tcpClient = null;
     netSocket = null;
 }
 /// <summary>
 ///     TCP调用服务端验证
 /// </summary>
 /// <param name="socket">TCP调用套接字</param>
 /// <param name="data">参数序列化数据</param>
 private void verify(TmphSocket socket, TmphSubArray<byte> data)
 {
     try
     {
         string inputParameter = null;
         if (TmphDataDeSerializer.DeSerialize(data, ref inputParameter))
         {
             var isVerify = false;
             if (this.isVerify == null)
             {
                 if (Config.TmphTcpRegister.Default.Verify == null && !Config.TmphPub.Default.IsDebug)
                 {
                     TmphLog.Error.Add("TCP服务注册验证数据不能为空", false, true);
                 }
                 else isVerify = Config.TmphTcpRegister.Default.Verify == inputParameter;
             }
             else isVerify = this.isVerify(data);
             socket.IsVerifyMethod = true;
             socket.SendStream(socket.Identity,
                 new TmphAsynchronousMethod.TmphReturnValue<bool> { IsReturn = true, Value = isVerify });
             return;
         }
     }
     catch (Exception error)
     {
         TmphLog.Error.Add(error, null, true);
     }
     socket.SendStream(socket.Identity, new TmphAsynchronousMethod.TmphReturnValue { IsReturn = false });
 }
 /// <summary>
 ///     HTTP转发代理
 /// </summary>
 /// <param name="socket">HTTP套接字</param>
 /// <param name="TmphClient">HTTP代理服务客户端</param>
 public TmphForwardProxy(TmphSocket socket, TmphClient TmphClient)
 {
     this.socket = socket;
     this.TmphClient = TmphClient;
     requestSocket = socket.Socket;
     proxySocket = TmphClient.NetSocket;
     requestBuffer = socket.HeaderReceiver.RequestHeader.TmphBuffer;
     responseBuffer = socket.Buffer;
     onReceiveRequestHandle = onReceiveRequest;
     onReceiveResponseHandle = onReceiveResponse;
     onSendResponseHandle = onSendResponse;
 }