一个客户端与服务器之间的接口测试的工具

<?xml version="1.0" encoding="utf-8"?>
<!--- - - - - - - - - - - - - - - - - - - - - - - - -
* @author:Frost.Yen
* @E-mail:871979853@qq.com
* @create:2016-7-13上午12:10:20
- - - - - - - - - - - - - - - - - - - - - - - - - - -->
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600" width="800" height="600" applicationComplete="application1_applicationCompleteHandler(event)">
<fx:Script>
<![CDATA[
import mx.controls.Alert;
import mx.events.FlexEvent;
private var _netConnection:NetConnection;
protected function button1_clickHandler(event:MouseEvent):void
{
if(request.text == ""){
Alert.show("请输入请求地址","温馨提示");
return;
}
if(action.text == ""){
Alert.show("请输入请求方法","温馨提示");
return;
}
resultText.text = "connecting...";
initNetConnection();
_netConnection.connect( request.text as String);
_netConnection.call(action.text,new Responder(function(result:Object):void{
if (result) {
trace("onResult: ",JSON.stringify(result));
resultText.text = "onResult:\n\n"+"ation:"+action.text+"\narguments:"+param.text+"\n\nresult:\n"+JSON.stringify(result);
}
}),param.text);
} private function initNetConnection():void
{
if (!_netConnection) {
trace("initConnection");
_netConnection = new NetConnection();
NetConnection.defaultObjectEncoding = ObjectEncoding.AMF3;
_netConnection.addEventListener(NetStatusEvent.NET_STATUS,onStatus);
}
}
public function onStatus(e:NetStatusEvent):void
{
trace("e.info.code", e.info.code);
resultText.text = e.info.code;
switch (e.info.code) {
case "NetConnection.Connect.Success":
case "NetConnection.Connect.Rejected":
case "NetConnection.Connect.NetworkChange":
case "NetConnection.Connect.Closed":
break;
case "NetConnection.Call.Failed":
case "NetConnection.Connect.Failed":
//case "NetConnection.Call.BadVersion"://以不能识别的格式编码的数据包。
trace("onReConnect");
if (_netConnection) {
_netConnection.removeEventListener(NetStatusEvent.NET_STATUS,onStatus);
_netConnection.close();
_netConnection = null;
}
break;
}
}
private function test(...arg):void
{
trace(arg);
} protected function application1_applicationCompleteHandler(event:FlexEvent):void
{
test("1",2,3);
} ]]>
</fx:Script> <s:HGroup gap="4" top="10" left="5" >
<s:Label text="RequestURL:" paddingTop="6"/>
<s:TextInput id="request" width="180" text="http://45.63.127.27/web/"/>
<s:Label text="action:" paddingTop="6"/>
<s:TextInput id="action" width="150" text="LoginAction.index"/>
<s:Label text="params:" paddingTop="6"/>
<s:TextInput id="param" width="200" text="login,apple,tomyuang"/>
<s:Button label="send" click="button1_clickHandler(event)"/>
</s:HGroup>
<s:TextArea id="resultText" width="790" height="500" left ="5" top="50" selectable="true" />
</s:Application>

[ActionScript 3.0] NetConnection建立客户端与服务器的双向连接的更多相关文章

  1. 微信小程序IOS真机调试发生了SSL 错误,无法建立与该服务器的安全连接

    小程序 真机调试 IOS request:fail 发生了SSL 错误,无法建立与该服务器的安全连接,解决方法服务器中打开Powerhell,执行以下代码,然后重启服务器 # Enables TLS ...

  2. socket编程:客户端与服务器间的连接以及各函数的用法

    在认真的看UNP之前,一直被socket编程说的云里雾里,今天我要让大家从整天上认识socket编程,让我们知道socket编程的整个流程和各个函数的用法.这样:我们在写一些简单的socket编程时就 ...

  3. 微信小程序 "request:fail 发生了 SSL 错误无法建立与该服务器的安全连接。"

    android机子可以真机预览,ios机子报这个错误 检测域名 苹果ATS检测 https://cloud.tencent.com/product/ssl#userDefined10 以上都通过 ht ...

  4. SignalR一个集成的客户端与服务器库。内部的两个对象类:PersistentConnection和Hub

    SignalR 将整个交换信息的行为封装得非常漂亮,客户端和服务器全部都使用 JSON 来沟通,在服务器端声明的所有 hub 的信息,都会一般生成 JavaScript 输出到客户端. 它是基于浏览器 ...

  5. Java实验四 TCP客户端和服务器的应用

    实验内容 1.掌握Socket程序的编写: 2.掌握密码技术的使用: 3.设计安全 4.对通信内容进行摘要计算并验证 实验步骤 1.信息安全传送: 发送方A——————>接收方B A加密时,用B ...

  6. Socket 通信原理(Android客户端和服务器以TCP&&UDP方式互通)

    转载地址:http://blog.csdn.net/mad1989/article/details/9147661 ZERO.前言 有关通信原理内容是在网上或百科整理得到,代码部分为本人所写,如果不当 ...

  7. 开源的C#实现WebSocket协议客户端和服务器websocket-sharp组件解析

    很久没有写博客了(至少自己感觉很长时间没有写了),没办法啊,楼主也是需要生活的人啊,这段一直都在找工作什么的.(整天催我代码的人,还望多多谅解啊,我会坚持写我们的项目的,还是需要相信我的,毕竟这是一个 ...

  8. UNIX网络编程——使用select函数编写客户端和服务器

    首先看原先<UNIX网络编程--并发服务器(TCP)>的代码,服务器代码serv.c: #include<stdio.h> #include<sys/types.h> ...

  9. ActionScript 3.0 API 中的 Video 类

    注:这个类在Flash流媒体开发中使用的很频繁,在此记录一下它的使用方法. 包 flash.media 类 public class Video 继承 Video  DisplayObject  Ev ...

随机推荐

  1. Git切换分支出现提示'SSL端口:44301'及解决方案

    切换分支出现如下提示,并且自动签出了项目文件csproj. 修改项目文件csproj 修改前: <UseIISExpress>true</UseIISExpress> < ...

  2. Gridview布局界面练习Simple Adapter

    aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAZcAAAJcCAIAAAC6w36wAAAgAElEQVR4nOy953YbS5KuvVsiTFWlz6

  3. Swift学习

    Swift 中文教程(一)基础数据类型 基础类型 虽然Swift是一个为开发iOS和OS X app设计的全新编程语言,但是Swift的很多特性还是跟和Objective-C相似. Swift也提供了 ...

  4. sql like in 语句获取以逗号分割的字段内的数据

    From:http://www.cnblogs.com/goody9807/archive/2011/07/27/2118107.html sql中的某个字段用“,”分隔数据,需要获取数据的时候直接把 ...

  5. ubuntu 配置JDK环境

    /etc/profile中加入以下代码 JAVA_HOME为JDK包解压的路径export JAVA_HOME=/home/exayong/jvm/jdk1.8.0_111 export JRE_HO ...

  6. (转)iOS图片拉伸技巧

    ( 原文博客地址:  http://blog.csdn.net/q199109106q/article/details/8615661) 纵观移动市场,一款移动app,要想长期在移动市场立足,最起码要 ...

  7. jQueryMobile控件之按钮

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  8. JAVA环境安装

    CATALINA_HOME  D:\apache-tomcat-7.0.52CLASSPATH  .;%JAVA_HOME%\lib\dt.jar;%JAVA_HOME%\lib\tools.jarJ ...

  9. HDU 2176

    http://acm.hdu.edu.cn/showproblem.php?pid=2176 nim博弈的模型.要输出先手第一次取的情况,考虑角度是留给对手必败态 #include <iostr ...

  10. Intent 四个重要属性

    Intent作为联系各Activity之间的纽带,其作用并不仅仅只限于简单的数据传递.通过其自带的属性,其实可以方便的完成很多较为复杂的操作.例如直接调用拨号功能.直接自动调用合适的程序打开不同类型的 ...