📄 connectanddisconnect.java
字号:
/* $Id: ConnectAndDisconnect.java,v 1.1 2004/02/09 21:06:42 giuli Exp $*/
/*
* The contents of this file are subject to the OAA Community Research
* License Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License
* at http://www.ai.sri.com/~oaa/. Software distributed under the License
* is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either
* express or implied. See the License for the specific language governing
* rights and limitations under the License. Portions of the software are
* Copyright (c) SRI International, 1999. All rights reserved.
* "OAA" is a registered trademark, and "Open Agent Architecture" is a
* trademark, of SRI International, a California nonprofit public benefit
* corporation.
*/
package com.sri.oaa2.test.lib;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
import com.sri.oaa2.lib.LibOaa;
import com.sri.oaa2.com.LibCom;
import com.sri.oaa2.com.LibComTcpProtocol;
import com.sri.oaa2.icl.IclList;
/**
*
*/
public class ConnectAndDisconnect extends TestCase {
public ConnectAndDisconnect(String name) {
super(name);
}
private void debug(String msg) {
System.out.println("ConnectAndDisconnect: " + msg);
}
public static void main(String[] args) {
junit.textui.TestRunner.run(suite());
}
public static Test suite() {
return new TestSuite(ConnectAndDisconnect.class);
}
private static int id = 0;
private void connectAndDisconnect() throws Exception {
id++;
LibOaa libOaa = new LibOaa(new LibCom(new LibComTcpProtocol(), new String[] {}));
debug("Setting up communication for testAgent" + id);
libOaa.oaaSetupCommunication("testAgent" + id);
debug("Finished setting up communication for testAgent" + id);
debug("Registering testAgent " + id);
libOaa.oaaRegister("parent", "testAgent" + id, new IclList(), null);
debug("Finished registering testAgent" + id);
libOaa.oaaReady(true);
libOaa.oaaDisconnect("parent", new IclList());
}
public void testConnectDisconnect() throws Exception {
for (int i = 0; i < 30; i++) {
connectAndDisconnect();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -