Move Java client into com.microsoft.aspnet.signalr (#2763)
This commit is contained in:
parent
2265acde78
commit
c9104d4932
|
|
@ -1,6 +1,8 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
// Copyright (c) .NET Foundation. All rights reserved.
|
||||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
|
package com.microsoft.aspnet.signalr;
|
||||||
|
|
||||||
public interface Action {
|
public interface Action {
|
||||||
void invoke();
|
void invoke();
|
||||||
}
|
}
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
// Copyright (c) .NET Foundation. All rights reserved.
|
||||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
|
package com.microsoft.aspnet.signalr;
|
||||||
|
|
||||||
public interface Action1<T1> {
|
public interface Action1<T1> {
|
||||||
void invoke(T1 param1);
|
void invoke(T1 param1);
|
||||||
}
|
}
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
// Copyright (c) .NET Foundation. All rights reserved.
|
||||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
|
package com.microsoft.aspnet.signalr;
|
||||||
|
|
||||||
public interface Action2<T1, T2> {
|
public interface Action2<T1, T2> {
|
||||||
void invoke(T1 param1, T2 param2);
|
void invoke(T1 param1, T2 param2);
|
||||||
}
|
}
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
// Copyright (c) .NET Foundation. All rights reserved.
|
||||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
|
package com.microsoft.aspnet.signalr;
|
||||||
|
|
||||||
public interface Action3<T1, T2, T3> {
|
public interface Action3<T1, T2, T3> {
|
||||||
void invoke(T1 param1, T2 param2, T3 param3);
|
void invoke(T1 param1, T2 param2, T3 param3);
|
||||||
}
|
}
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
// Copyright (c) .NET Foundation. All rights reserved.
|
||||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
|
package com.microsoft.aspnet.signalr;
|
||||||
|
|
||||||
public interface Action4<T1, T2, T3, T4> {
|
public interface Action4<T1, T2, T3, T4> {
|
||||||
void invoke(T1 param1, T2 param2, T3 param3, T4 param4);
|
void invoke(T1 param1, T2 param2, T3 param3, T4 param4);
|
||||||
}
|
}
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
// Copyright (c) .NET Foundation. All rights reserved.
|
||||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
|
package com.microsoft.aspnet.signalr;
|
||||||
|
|
||||||
public interface Action5<T1, T2, T3, T4, T5> {
|
public interface Action5<T1, T2, T3, T4, T5> {
|
||||||
void invoke(T1 param1, T2 param2, T3 param3, T4 param4, T5 param5);
|
void invoke(T1 param1, T2 param2, T3 param3, T4 param4, T5 param5);
|
||||||
}
|
}
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
// Copyright (c) .NET Foundation. All rights reserved.
|
||||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
|
package com.microsoft.aspnet.signalr;
|
||||||
|
|
||||||
public interface Action6<T1, T2, T3, T4, T5, T6> {
|
public interface Action6<T1, T2, T3, T4, T5, T6> {
|
||||||
void invoke(T1 param1, T2 param2, T3 param3, T4 param4, T5 param5, T6 param6);
|
void invoke(T1 param1, T2 param2, T3 param3, T4 param4, T5 param5, T6 param6);
|
||||||
}
|
}
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
// Copyright (c) .NET Foundation. All rights reserved.
|
||||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
|
package com.microsoft.aspnet.signalr;
|
||||||
|
|
||||||
public interface Action7<T1, T2, T3, T4, T5, T6, T7> {
|
public interface Action7<T1, T2, T3, T4, T5, T6, T7> {
|
||||||
void invoke(T1 param1, T2 param2, T3 param3, T4 param4, T5 param5, T6 param6, T7 param7);
|
void invoke(T1 param1, T2 param2, T3 param3, T4 param4, T5 param5, T6 param6, T7 param7);
|
||||||
}
|
}
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
// Copyright (c) .NET Foundation. All rights reserved.
|
||||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
|
package com.microsoft.aspnet.signalr;
|
||||||
|
|
||||||
public interface Action8<T1, T2, T3, T4, T5, T6, T7, T8> {
|
public interface Action8<T1, T2, T3, T4, T5, T6, T7, T8> {
|
||||||
void invoke(T1 param1, T2 param2, T3 param3, T4 param4, T5 param5, T6 param6, T7 param7, T8 param8);
|
void invoke(T1 param1, T2 param2, T3 param3, T4 param4, T5 param5, T6 param6, T7 param7, T8 param8);
|
||||||
}
|
}
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
// Copyright (c) .NET Foundation. All rights reserved.
|
||||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
|
package com.microsoft.aspnet.signalr;
|
||||||
|
|
||||||
public interface ActionBase {
|
public interface ActionBase {
|
||||||
void invoke(Object ... params);
|
void invoke(Object ... params);
|
||||||
}
|
}
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
// Copyright (c) .NET Foundation. All rights reserved.
|
||||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
|
package com.microsoft.aspnet.signalr;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
@ -1,6 +1,10 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
// Copyright (c) .NET Foundation. All rights reserved.
|
||||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
|
package com.microsoft.aspnet.signalr;
|
||||||
|
|
||||||
|
import com.microsoft.aspnet.signalr.HubConnection;
|
||||||
|
|
||||||
import java.util.Scanner;
|
import java.util.Scanner;
|
||||||
|
|
||||||
public class Chat {
|
public class Chat {
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
// Copyright (c) .NET Foundation. All rights reserved.
|
||||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
|
package com.microsoft.aspnet.signalr;
|
||||||
|
|
||||||
public class ConsoleLogger implements Logger {
|
public class ConsoleLogger implements Logger {
|
||||||
private LogLevel logLevel;
|
private LogLevel logLevel;
|
||||||
public ConsoleLogger(LogLevel logLevel) {
|
public ConsoleLogger(LogLevel logLevel) {
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
// Copyright (c) .NET Foundation. All rights reserved.
|
||||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
|
package com.microsoft.aspnet.signalr;
|
||||||
|
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
|
|
||||||
public class HandshakeProtocol {
|
public class HandshakeProtocol {
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
// Copyright (c) .NET Foundation. All rights reserved.
|
||||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
|
package com.microsoft.aspnet.signalr;
|
||||||
|
|
||||||
public class HandshakeRequestMessage {
|
public class HandshakeRequestMessage {
|
||||||
String protocol;
|
String protocol;
|
||||||
int version;
|
int version;
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
// Copyright (c) .NET Foundation. All rights reserved.
|
||||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
|
package com.microsoft.aspnet.signalr;
|
||||||
|
|
||||||
public class HandshakeResponseMessage {
|
public class HandshakeResponseMessage {
|
||||||
public String error;
|
public String error;
|
||||||
|
|
||||||
|
|
@ -1,9 +1,10 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
// Copyright (c) .NET Foundation. All rights reserved.
|
||||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
|
package com.microsoft.aspnet.signalr;
|
||||||
|
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.google.gson.JsonArray;
|
import com.google.gson.JsonArray;
|
||||||
|
|
||||||
import java.net.URISyntaxException;
|
import java.net.URISyntaxException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
// Copyright (c) .NET Foundation. All rights reserved.
|
||||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
|
package com.microsoft.aspnet.signalr;
|
||||||
|
|
||||||
public enum HubConnectionState {
|
public enum HubConnectionState {
|
||||||
CONNECTED,
|
CONNECTED,
|
||||||
DISCONNECTED,
|
DISCONNECTED,
|
||||||
|
|
@ -1,9 +1,11 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
// Copyright (c) .NET Foundation. All rights reserved.
|
||||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
|
package com.microsoft.aspnet.signalr;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A base class for hub messages.
|
* A base class for hub messages.
|
||||||
*/
|
*/
|
||||||
public abstract class HubMessage {
|
public abstract class HubMessage {
|
||||||
abstract HubMessageType getMessageType();
|
public abstract HubMessageType getMessageType();
|
||||||
}
|
}
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
// Copyright (c) .NET Foundation. All rights reserved.
|
||||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
|
package com.microsoft.aspnet.signalr;
|
||||||
|
|
||||||
public enum HubMessageType {
|
public enum HubMessageType {
|
||||||
INVOCATION(1),
|
INVOCATION(1),
|
||||||
STREAM_ITEM(2),
|
STREAM_ITEM(2),
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
// Copyright (c) .NET Foundation. All rights reserved.
|
||||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
|
package com.microsoft.aspnet.signalr;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A protocol abstraction for communicating with SignalR hubs.
|
* A protocol abstraction for communicating with SignalR hubs.
|
||||||
*/
|
*/
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
// Copyright (c) .NET Foundation. All rights reserved.
|
||||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
|
package com.microsoft.aspnet.signalr;
|
||||||
|
|
||||||
public class InvocationMessage extends HubMessage {
|
public class InvocationMessage extends HubMessage {
|
||||||
int type = HubMessageType.INVOCATION.value;
|
int type = HubMessageType.INVOCATION.value;
|
||||||
String invocationId;
|
String invocationId;
|
||||||
|
|
@ -37,7 +39,7 @@ public class InvocationMessage extends HubMessage {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
HubMessageType getMessageType() {
|
public HubMessageType getMessageType() {
|
||||||
return HubMessageType.INVOCATION;
|
return HubMessageType.INVOCATION;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
// Copyright (c) .NET Foundation. All rights reserved.
|
||||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
|
package com.microsoft.aspnet.signalr;
|
||||||
|
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.google.gson.JsonElement;
|
import com.google.gson.JsonElement;
|
||||||
import com.google.gson.JsonObject;
|
import com.google.gson.JsonObject;
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
// Copyright (c) .NET Foundation. All rights reserved.
|
||||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
|
package com.microsoft.aspnet.signalr;
|
||||||
|
|
||||||
public enum LogLevel {
|
public enum LogLevel {
|
||||||
Trace(0),
|
Trace(0),
|
||||||
Debug(1),
|
Debug(1),
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
// Copyright (c) .NET Foundation. All rights reserved.
|
||||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
|
package com.microsoft.aspnet.signalr;
|
||||||
|
|
||||||
public interface Logger {
|
public interface Logger {
|
||||||
void log(LogLevel logLevel, String message);
|
void log(LogLevel logLevel, String message);
|
||||||
void log(LogLevel logLevel, String formattedMessage, Object ... args);
|
void log(LogLevel logLevel, String formattedMessage, Object ... args);
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
// Copyright (c) .NET Foundation. All rights reserved.
|
||||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
|
package com.microsoft.aspnet.signalr;
|
||||||
|
|
||||||
public class NullLogger implements Logger {
|
public class NullLogger implements Logger {
|
||||||
@Override
|
@Override
|
||||||
public void log(LogLevel logLevel, String message) { }
|
public void log(LogLevel logLevel, String message) { }
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
// Copyright (c) .NET Foundation. All rights reserved.
|
||||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
import com.google.gson.JsonObject;
|
package com.microsoft.aspnet.signalr;
|
||||||
|
|
||||||
public interface OnReceiveCallBack {
|
public interface OnReceiveCallBack {
|
||||||
void invoke(String message) throws Exception;
|
void invoke(String message) throws Exception;
|
||||||
|
|
@ -1,12 +1,14 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
// Copyright (c) .NET Foundation. All rights reserved.
|
||||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
|
package com.microsoft.aspnet.signalr;
|
||||||
|
|
||||||
public class PingMessage extends HubMessage {
|
public class PingMessage extends HubMessage {
|
||||||
|
|
||||||
int type = HubMessageType.PING.value;
|
int type = HubMessageType.PING.value;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
HubMessageType getMessageType() {
|
public HubMessageType getMessageType() {
|
||||||
return HubMessageType.PING;
|
return HubMessageType.PING;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,12 +1,15 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
// Copyright (c) .NET Foundation. All rights reserved.
|
||||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
|
package com.microsoft.aspnet.signalr;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class Subscription {
|
public class Subscription {
|
||||||
private CallbackMap handlers;
|
private CallbackMap handlers;
|
||||||
private ActionBase action;
|
private ActionBase action;
|
||||||
private String target;
|
private String target;
|
||||||
|
|
||||||
public Subscription(CallbackMap handlers, ActionBase action, String target) {
|
public Subscription(CallbackMap handlers, ActionBase action, String target) {
|
||||||
this.handlers = handlers;
|
this.handlers = handlers;
|
||||||
this.action = action;
|
this.action = action;
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
// Copyright (c) .NET Foundation. All rights reserved.
|
||||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
|
package com.microsoft.aspnet.signalr;
|
||||||
|
|
||||||
public enum TransferFormat {
|
public enum TransferFormat {
|
||||||
Text,
|
Text,
|
||||||
Binary
|
Binary
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
// Copyright (c) .NET Foundation. All rights reserved.
|
||||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
|
package com.microsoft.aspnet.signalr;
|
||||||
|
|
||||||
public interface Transport {
|
public interface Transport {
|
||||||
void start() throws InterruptedException;
|
void start() throws InterruptedException;
|
||||||
void send(String message) throws Exception;
|
void send(String message) throws Exception;
|
||||||
|
|
@ -1,11 +1,12 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
// Copyright (c) .NET Foundation. All rights reserved.
|
||||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
import org.java_websocket.client.WebSocketClient;
|
package com.microsoft.aspnet.signalr;
|
||||||
import org.java_websocket.handshake.ServerHandshake;
|
|
||||||
|
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.net.URISyntaxException;
|
import java.net.URISyntaxException;
|
||||||
|
import org.java_websocket.client.WebSocketClient;
|
||||||
|
import org.java_websocket.handshake.ServerHandshake;
|
||||||
|
|
||||||
public class WebSocketTransport implements Transport {
|
public class WebSocketTransport implements Transport {
|
||||||
private WebSocketClient webSocketClient;
|
private WebSocketClient webSocketClient;
|
||||||
|
|
@ -1,6 +1,9 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
// Copyright (c) .NET Foundation. All rights reserved.
|
||||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
|
import com.microsoft.aspnet.signalr.HandshakeProtocol;
|
||||||
|
import com.microsoft.aspnet.signalr.HandshakeRequestMessage;
|
||||||
|
import com.microsoft.aspnet.signalr.HandshakeResponseMessage;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import static org.junit.Assert.*;
|
import static org.junit.Assert.*;
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
// Copyright (c) .NET Foundation. All rights reserved.
|
||||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
import org.junit.Test;
|
import com.microsoft.aspnet.signalr.*;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.concurrent.atomic.AtomicReference;
|
import java.util.concurrent.atomic.AtomicReference;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
import static org.junit.Assert.*;
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@
|
||||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
import com.google.gson.JsonArray;
|
import com.google.gson.JsonArray;
|
||||||
|
import com.microsoft.aspnet.signalr.*;
|
||||||
import org.junit.Rule;
|
import org.junit.Rule;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.rules.ExpectedException;
|
import org.junit.rules.ExpectedException;
|
||||||
|
|
@ -57,10 +58,10 @@ public class JsonHubProtocolTest {
|
||||||
//We can safely cast here because we know that it's an invocation message.
|
//We can safely cast here because we know that it's an invocation message.
|
||||||
InvocationMessage invocationMessage = (InvocationMessage) messages[0];
|
InvocationMessage invocationMessage = (InvocationMessage) messages[0];
|
||||||
|
|
||||||
assertEquals("test", invocationMessage.target);
|
assertEquals("test", invocationMessage.getTarget());
|
||||||
assertEquals(null, invocationMessage.invocationId);
|
assertEquals(null, invocationMessage.getInvocationId());
|
||||||
|
|
||||||
JsonArray messageResult = (JsonArray) invocationMessage.arguments[0];
|
JsonArray messageResult = (JsonArray) invocationMessage.getArguments()[0];
|
||||||
assertEquals(42, messageResult.getAsInt());
|
assertEquals(42, messageResult.getAsInt());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -95,9 +96,9 @@ public class JsonHubProtocolTest {
|
||||||
//Now that we know we have an invocation message we can cast the hubMessage.
|
//Now that we know we have an invocation message we can cast the hubMessage.
|
||||||
InvocationMessage invocationMessage = (InvocationMessage) messages[0];
|
InvocationMessage invocationMessage = (InvocationMessage) messages[0];
|
||||||
|
|
||||||
assertEquals("one", invocationMessage.target);
|
assertEquals("one", invocationMessage.getTarget());
|
||||||
assertEquals(null, invocationMessage.invocationId);
|
assertEquals(null, invocationMessage.getInvocationId());
|
||||||
JsonArray messageResult = (JsonArray) invocationMessage.arguments[0];
|
JsonArray messageResult = (JsonArray) invocationMessage.getArguments()[0];
|
||||||
assertEquals(42, messageResult.getAsInt());
|
assertEquals(42, messageResult.getAsInt());
|
||||||
|
|
||||||
// Check the second message
|
// Check the second message
|
||||||
|
|
@ -106,9 +107,9 @@ public class JsonHubProtocolTest {
|
||||||
//Now that we know we have an invocation message we can cast the hubMessage.
|
//Now that we know we have an invocation message we can cast the hubMessage.
|
||||||
InvocationMessage invocationMessage2 = (InvocationMessage) messages[1];
|
InvocationMessage invocationMessage2 = (InvocationMessage) messages[1];
|
||||||
|
|
||||||
assertEquals("two", invocationMessage2.target);
|
assertEquals("two", invocationMessage2.getTarget());
|
||||||
assertEquals(null, invocationMessage2.invocationId);
|
assertEquals(null, invocationMessage2.getInvocationId());
|
||||||
JsonArray secondMessageResult = (JsonArray) invocationMessage2.arguments[0];
|
JsonArray secondMessageResult = (JsonArray) invocationMessage2.getArguments()[0];
|
||||||
assertEquals(43, secondMessageResult.getAsInt());
|
assertEquals(43, secondMessageResult.getAsInt());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -121,9 +122,9 @@ public class JsonHubProtocolTest {
|
||||||
assertEquals(HubMessageType.INVOCATION, messages[0].getMessageType());
|
assertEquals(HubMessageType.INVOCATION, messages[0].getMessageType());
|
||||||
|
|
||||||
InvocationMessage message = (InvocationMessage)messages[0];
|
InvocationMessage message = (InvocationMessage)messages[0];
|
||||||
assertEquals("test", message.target);
|
assertEquals("test", message.getTarget());
|
||||||
assertEquals(null, message.invocationId);
|
assertEquals(null, message.getInvocationId());
|
||||||
JsonArray messageResult = ((JsonArray) message.arguments[0]);
|
JsonArray messageResult = ((JsonArray) message.getArguments()[0]);
|
||||||
assertEquals(42, messageResult.get(0).getAsInt());
|
assertEquals(42, messageResult.get(0).getAsInt());
|
||||||
assertEquals(24, messageResult.get(1).getAsInt());
|
assertEquals(24, messageResult.get(1).getAsInt());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,14 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
// Copyright (c) .NET Foundation. All rights reserved.
|
||||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
import org.junit.Test;
|
import com.microsoft.aspnet.signalr.NullLogger;
|
||||||
import org.junit.runner.RunWith;
|
import com.microsoft.aspnet.signalr.WebSocketTransport;
|
||||||
import org.junit.runners.Parameterized;
|
|
||||||
|
|
||||||
import java.net.URISyntaxException;
|
import java.net.URISyntaxException;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import org.junit.runners.Parameterized;
|
||||||
|
|
||||||
import static org.junit.Assert.*;
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue