public static void DirectHandle( ProxyClient client, string clientConnectionAddress, ushort clientConnectionPort, byte[] firstResponse) { if (client.IsSmartForwarderEnable && client.Controller.SmartPear.ForwarderHttpsEnable && client.Controller.SmartPear.ForwarderSocksEnable) { // Is Forwarder is Enable and Client need to be forwarded by NoServer ServerType ac = new NoServer { NoDataTimeout = client.Controller.ActiveServer.NoDataTimeout }; if (client.Controller.SmartPear.DetectorTimeoutEnable) { // If we have Timeout Detector then let change timeout ac.NoDataTimeout = client.Controller.SmartPear.DetectorTimeout; } client.SmartDataSentCallbackForDirectConnections(firstResponse, true); ac.Establish( clientConnectionAddress, clientConnectionPort, client, firstResponse, (ref byte[] data, ServerType thisactiveServer, ProxyClient thisclient) => thisclient.SmartDataSentCallbackForDirectConnections(data, true), (ref byte[] data, ServerType thisactiveServer, ProxyClient thisclient) => thisclient.SmartDataReceivedCallbackForDirrectConnections(ref data, thisactiveServer, true), (success, thisactiveServer, thisclient) => thisclient.SmartStatusCallbackForDirectConnections(thisactiveServer, success, true)); } else { // Forwarder is Disable or Client is in proxy connection mode ServerType ac = client.Controller.ActiveServer.Clone(); if (client.Controller.SmartPear.ForwarderHttpsEnable && client.Controller.SmartPear.ForwarderSocksEnable) { // If we have forwarding enable then we need to have the receive callback ac.Establish( clientConnectionAddress, clientConnectionPort, client, firstResponse, null, (ref byte[] data, ServerType thisactiveServer, ProxyClient thisclient) => thisclient.SmartDataReceivedCallbackForDirrectConnections(ref data, thisactiveServer, true)); } else { // If we don't so SmartPear is disabled ac.Establish(clientConnectionAddress, clientConnectionPort, client, firstResponse); } } }