更改 AMFChannel 中端点的协议,如何解决?

change protocol of endpoint in AMFChannel, how to fix it?

我正在开发 Flex,我发现当我将 uri(https://jsonplaceholder.typicode.com/posts/1) 提供给 AMFChannel 时,内容 'HTTPS' 协议,但 calculateEndpoint() 通道的方法 class 从 "HTTPS" 更改 protocol至 "HTTP".

我还做了一个简单的项目来演示端点如何被 AMFChannel 改变。

<?xml version="1.0"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark">
<fx:Script><![CDATA[
    import mx.controls.Alert;
    import mx.messaging.ChannelSet;
    import mx.messaging.channels.AMFChannel;
    import mx.rpc.AbstractOperation;
    import mx.rpc.remoting.mxml.RemoteObject;


    private function button1_clickHandler(event:MouseEvent):void
    {
        var amfChannelWeb:AMFChannel = new AMFChannel("amfChannel", txtInput.text);

        var remoteObj:RemoteObject = new RemoteObject();
        remoteObj.showBusyCursor = true;
        remoteObj.requestTimeout = 0;

        var channelSet = new ChannelSet();
        channelSet.channels = [amfChannelWeb];


        remoteObj.destination = "amfphp";
        remoteObj.channelSet = channelSet;


        var op:AbstractOperation = remoteObj.getOperation("testAmfData");
        op.send();
        op.addEventListener("result", resultHandler);
        op.addEventListener("fault", resultFaultHandler);
        lblEndpoint.text = amfChannelWeb.endpoint;
    }

    private function resultHandler(e:Event):void
    {
        lblChannelError.text = e.toString();
    }

    private function resultFaultHandler(e:Event):void
    {
        lblChannelError.text = e.toString();
    }
    ]]></fx:Script>

<s:VGroup width="100%">

    <s:TextInput width="80%" id="txtInput" text="https://jsonplaceholder.typicode.com/posts/1"/>
    <s:Button click="button1_clickHandler(event)" label="Click"/>
    <s:Label id="lblEndpoint"/>
    <s:Label id="lblChannelError"/>

</s:VGroup>

是这个问题还是我做错了什么??

如下所示使用 SecureAMFChannel 而不是 AMFChannel

 var amfChannelWeb:SecureAMFChannel = new SecureAMFChannel("amfChannel", txtInput.text);