资源简介
这个源码的要求安卓studio3.0的版本,gradle-4.1,源码直接下载导入配置一下gradle基本上就可以运行了。需要的小伙伴可以下载
代码片段和文件信息
///////////////////////////////////////////////////////////////////////////////
//
// AutobahnJava - http://crossbar.io/autobahn
//
// Copyright (c) Crossbar.io Technologies GmbH and contributors
//
// Licensed under the MIT License.
// http://www.opensource.org/licenses/mit-license.php
//
///////////////////////////////////////////////////////////////////////////////
package io.crossbar.autobahn.wamp;
import java.util.List;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CompletionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.ForkJoinPool;
import java.util.logging.Logger;
import io.crossbar.autobahn.wamp.interfaces.ITransport;
import io.crossbar.autobahn.wamp.interfaces.IAuthenticator;
import io.crossbar.autobahn.wamp.types.ExitInfo;
public class Client {
private static final Logger LOGGER = Logger.getLogger(Client.class.getName());
private final List mTransports;
private Session mSession;
private String mRealm;
private List mAuthenticators;
private ExecutorService mExecutor;
public Client(List transports) {
mTransports = transports;
}
public Client(List transports ExecutorService executor) {
this(transports);
mExecutor = executor;
}
private ExecutorService getExecutor() {
return mExecutor == null ? ForkJoinPool.commonPool() : mExecutor;
}
public void add(Session session String realm List authenticators) {
if (mSession != null) {
throw new IllegalStateException(“Addition of multiple sessions not implemented“);
}
mSession = session;
mRealm = realm;
mAuthenticators = authenticators;
}
public CompletableFuture connect() {
CompletableFuture exitFuture = new CompletableFuture<>();
mSession.addOnConnectListener((session) ->
mSession.join(mRealm null).thenAccept(details ->
LOGGER.info(String.format(“JOINED session=%s realm=%s“ details.sessionID
details.realm))));
mSession.addOnDisconnectListener((session wasClean) -> exitFuture.complete(new ExitInfo(wasClean)));
CompletableFuture.runAsync(() -> {
try {
mTransports.get(0).connect(mSession);
} catch (Exception e) {
throw new CompletionException(e);
}
} getExecutor());
return exitFuture;
}
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2017-09-18 14:50 autobahn-java-master\
文件 460 2017-09-18 14:50 autobahn-java-master\.gitignore
文件 612 2017-09-18 14:50 autobahn-java-master\.travis.yml
文件 1091 2017-09-18 14:50 autobahn-java-master\LICENSE
文件 1893 2017-09-18 14:50 autobahn-java-master\Makefile
文件 5877 2017-09-18 14:50 autobahn-java-master\README.md
目录 0 2017-09-18 14:50 autobahn-java-master\autobahn\
文件 512 2017-09-18 14:50 autobahn-java-master\autobahn\.classpath
文件 68 2017-09-18 14:50 autobahn-java-master\autobahn\.gitignore
文件 811 2017-09-18 14:50 autobahn-java-master\autobahn\.project
目录 0 2017-09-18 14:50 autobahn-java-master\autobahn\.settings\
文件 204 2017-09-18 14:50 autobahn-java-master\autobahn\.settings\org.eclipse.jdt.core.prefs
文件 101112 2017-09-18 14:50 autobahn-java-master\autobahn\Doxyfile
文件 855 2017-09-18 14:50 autobahn-java-master\autobahn\README.md
文件 2211 2017-09-18 14:50 autobahn-java-master\autobahn\build.gradle
目录 0 2017-09-18 14:50 autobahn-java-master\autobahn\src\
目录 0 2017-09-18 14:50 autobahn-java-master\autobahn\src\main\
文件 306 2017-09-18 14:50 autobahn-java-master\autobahn\src\main\AndroidManifest.xm
目录 0 2017-09-18 14:50 autobahn-java-master\autobahn\src\main\java\
目录 0 2017-09-18 14:50 autobahn-java-master\autobahn\src\main\java\io\
目录 0 2017-09-18 14:50 autobahn-java-master\autobahn\src\main\java\io\crossbar\
目录 0 2017-09-18 14:50 autobahn-java-master\autobahn\src\main\java\io\crossbar\autobahn\
目录 0 2017-09-18 14:50 autobahn-java-master\autobahn\src\main\java\io\crossbar\autobahn\wamp\
文件 2586 2017-09-18 14:50 autobahn-java-master\autobahn\src\main\java\io\crossbar\autobahn\wamp\Client.java
文件 42851 2017-09-18 14:50 autobahn-java-master\autobahn\src\main\java\io\crossbar\autobahn\wamp\Session.java
目录 0 2017-09-18 14:50 autobahn-java-master\autobahn\src\main\java\io\crossbar\autobahn\wamp\auth\
文件 1148 2017-09-18 14:50 autobahn-java-master\autobahn\src\main\java\io\crossbar\autobahn\wamp\auth\AnonymousAuth.java
文件 1315 2017-09-18 14:50 autobahn-java-master\autobahn\src\main\java\io\crossbar\autobahn\wamp\auth\TicketAuth.java
目录 0 2017-09-18 14:50 autobahn-java-master\autobahn\src\main\java\io\crossbar\autobahn\wamp\exceptions\
文件 628 2017-09-18 14:50 autobahn-java-master\autobahn\src\main\java\io\crossbar\autobahn\wamp\exceptions\Application
文件 550 2017-09-18 14:50 autobahn-java-master\autobahn\src\main\java\io\crossbar\autobahn\wamp\exceptions\Error.java
............此处省略153个文件信息
评论
共有 条评论