Java getConnectionId()在android中的信号器中返回null

Java getConnectionId()在android中的信号器中返回null,java,android,signalr,Java,Android,Signalr,我使用的是signarjava客户端,我使用这种方法连接主机 但是获取协商异常和connectionid returs null connection = new HubConnection(host); hub = connection.createHubProxy("Chat"); hub.subscribe(MainActivity.this); hub.on("addChatMessage", new Subscripti

我使用的是signarjava客户端,我使用这种方法连接主机 但是获取协商异常和connectionid returs null

connection = new HubConnection(host);
        hub = connection.createHubProxy("Chat");
                hub.subscribe(MainActivity.this);

        hub.on("addChatMessage", new SubscriptionHandler() {

            @Override
            public void run() {
                // TODO Auto-generated method stub
                Log.e("test", "entered in hub.on method");
            }
        });



        // connection.start();
        SignalRFuture<Void> awaitConnection = connection.start();
        try {
            awaitConnection.get();
        } catch (InterruptedException e) {
            Log.e("<<<Exception>>>",  ""+ e.toString() + "<<<>>>"
                    + e.getMessage());
        } catch (ExecutionException e) {
            Log.e("<<<Exception>>>", "" + e.toString() + "<<<>>>"
                    + e.getMessage());
        }
        Log.e("", "connectionId : "+ connection.getConnectionId());
connection=新的HUB连接(主机);
hub=connection.createhubbroxy(“聊天”);
hub.subscribe(MainActivity.this);
on(“addChatMessage”,newsubscriptionhandler()){
@凌驾
公开募捐{
//TODO自动生成的方法存根
Log.e(“测试”,“输入hub.on方法”);
}
});
//connection.start();
SignalRFuture awaitConnection=connection.start();
试一试{
等待连接。get();
}捕捉(中断异常e){
Log.e(“,”+e.toString()
+e.getMessage());
}捕获(执行例外){
Log.e(“,”+e.toString()
+e.getMessage());
}
Log.e(“,”connectionId:“+connection.getConnectionId());

你好,daniel和asd,谢谢你的回复,但是你给了我我正在使用的相同代码,你能解释一下吗?或者你能给我一些代码吗?我在谷歌搜索了一下之后成功地集成了Signaler java客户端
hub = connection.createHubProxy("wallpostChat");
hub.subscribe(MainActivity.this);

hub.on("addChatMessage", new SubscriptionHandler() {

    @Override
    public void run() {
        // TODO Auto-generated method stub
        Log.e("test", "entered in hub.on method");
    }
});