Merge commit '852d890' into pakrym/merge22
This commit is contained in:
commit
f08f2af8bc
|
|
@ -23,6 +23,7 @@ Later on, this will be checked using this condition:
|
||||||
Microsoft.AspNetCore.Authentication.Google;
|
Microsoft.AspNetCore.Authentication.Google;
|
||||||
Microsoft.AspNetCore.Http;
|
Microsoft.AspNetCore.Http;
|
||||||
Microsoft.AspNetCore.Server.IIS;
|
Microsoft.AspNetCore.Server.IIS;
|
||||||
|
java:signalr;
|
||||||
</PackagesInPatch>
|
</PackagesInPatch>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -465,7 +465,7 @@ public class HubConnection {
|
||||||
*/
|
*/
|
||||||
public void send(String method, Object... args) {
|
public void send(String method, Object... args) {
|
||||||
if (hubConnectionState != HubConnectionState.CONNECTED) {
|
if (hubConnectionState != HubConnectionState.CONNECTED) {
|
||||||
throw new RuntimeException("The 'send' method cannot be called if the connection is not active");
|
throw new RuntimeException("The 'send' method cannot be called if the connection is not active.");
|
||||||
}
|
}
|
||||||
|
|
||||||
InvocationMessage invocationMessage = new InvocationMessage(null, method, args);
|
InvocationMessage invocationMessage = new InvocationMessage(null, method, args);
|
||||||
|
|
@ -483,6 +483,10 @@ public class HubConnection {
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public <T> Single<T> invoke(Class<T> returnType, String method, Object... args) {
|
public <T> Single<T> invoke(Class<T> returnType, String method, Object... args) {
|
||||||
|
if (hubConnectionState != HubConnectionState.CONNECTED) {
|
||||||
|
throw new RuntimeException("The 'invoke' method cannot be called if the connection is not active.");
|
||||||
|
}
|
||||||
|
|
||||||
String id = connectionState.getNextInvocationId();
|
String id = connectionState.getNextInvocationId();
|
||||||
InvocationMessage invocationMessage = new InvocationMessage(id, method, args);
|
InvocationMessage invocationMessage = new InvocationMessage(id, method, args);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1119,7 +1119,16 @@ class HubConnectionTest {
|
||||||
assertEquals(HubConnectionState.DISCONNECTED, hubConnection.getConnectionState());
|
assertEquals(HubConnectionState.DISCONNECTED, hubConnection.getConnectionState());
|
||||||
|
|
||||||
Throwable exception = assertThrows(RuntimeException.class, () -> hubConnection.send("inc"));
|
Throwable exception = assertThrows(RuntimeException.class, () -> hubConnection.send("inc"));
|
||||||
assertEquals("The 'send' method cannot be called if the connection is not active", exception.getMessage());
|
assertEquals("The 'send' method cannot be called if the connection is not active.", exception.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void cannotInvokeBeforeStart() {
|
||||||
|
HubConnection hubConnection = TestUtils.createHubConnection("http://example.com");
|
||||||
|
assertEquals(HubConnectionState.DISCONNECTED, hubConnection.getConnectionState());
|
||||||
|
|
||||||
|
Throwable exception = assertThrows(RuntimeException.class, () -> hubConnection.invoke(String.class, "inc", "arg1"));
|
||||||
|
assertEquals("The 'invoke' method cannot be called if the connection is not active.", exception.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
@ -1423,4 +1432,4 @@ class HubConnectionTest {
|
||||||
() -> hubConnection.start().timeout(1, TimeUnit.SECONDS).blockingAwait());
|
() -> hubConnection.start().timeout(1, TimeUnit.SECONDS).blockingAwait());
|
||||||
assertEquals("Unexpected status code returned from negotiate: 500 Internal server error.", exception.getMessage());
|
assertEquals("Unexpected status code returned from negotiate: 500 Internal server error.", exception.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue