Skip to content

Commit ae9b399

Browse files
authored
Merge pull request #6759 from aspnet/pakrym/merge22
Merge 2.2 into master
2 parents 5a70f53 + 6eca6d2 commit ae9b399

File tree

3 files changed

+19
-3
lines changed

3 files changed

+19
-3
lines changed

eng/PatchConfig.props

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,11 @@ Later on, this will be checked using this condition:
2020
<PropertyGroup Condition=" '$(VersionPrefix)' == '2.2.2' ">
2121
<PackagesInPatch>
2222
@aspnet/signalr;
23+
Microsoft.AspNetCore.AspNetCoreModuleV2;
2324
Microsoft.AspNetCore.Authentication.Google;
2425
Microsoft.AspNetCore.Http;
26+
Microsoft.AspNetCore.Server.IIS;
27+
java:signalr;
2528
</PackagesInPatch>
2629
</PropertyGroup>
2730

src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/HubConnection.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,7 @@ private void stopConnection(String errorMessage) {
465465
*/
466466
public void send(String method, Object... args) {
467467
if (hubConnectionState != HubConnectionState.CONNECTED) {
468-
throw new RuntimeException("The 'send' method cannot be called if the connection is not active");
468+
throw new RuntimeException("The 'send' method cannot be called if the connection is not active.");
469469
}
470470

471471
InvocationMessage invocationMessage = new InvocationMessage(null, method, args);
@@ -483,6 +483,10 @@ public void send(String method, Object... args) {
483483
*/
484484
@SuppressWarnings("unchecked")
485485
public <T> Single<T> invoke(Class<T> returnType, String method, Object... args) {
486+
if (hubConnectionState != HubConnectionState.CONNECTED) {
487+
throw new RuntimeException("The 'invoke' method cannot be called if the connection is not active.");
488+
}
489+
486490
String id = connectionState.getNextInvocationId();
487491
InvocationMessage invocationMessage = new InvocationMessage(id, method, args);
488492

src/SignalR/clients/java/signalr/src/test/java/com/microsoft/signalr/HubConnectionTest.java

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1119,7 +1119,16 @@ public void cannotSendBeforeStart() {
11191119
assertEquals(HubConnectionState.DISCONNECTED, hubConnection.getConnectionState());
11201120

11211121
Throwable exception = assertThrows(RuntimeException.class, () -> hubConnection.send("inc"));
1122-
assertEquals("The 'send' method cannot be called if the connection is not active", exception.getMessage());
1122+
assertEquals("The 'send' method cannot be called if the connection is not active.", exception.getMessage());
1123+
}
1124+
1125+
@Test
1126+
public void cannotInvokeBeforeStart() {
1127+
HubConnection hubConnection = TestUtils.createHubConnection("http://example.com");
1128+
assertEquals(HubConnectionState.DISCONNECTED, hubConnection.getConnectionState());
1129+
1130+
Throwable exception = assertThrows(RuntimeException.class, () -> hubConnection.invoke(String.class, "inc", "arg1"));
1131+
assertEquals("The 'invoke' method cannot be called if the connection is not active.", exception.getMessage());
11231132
}
11241133

11251134
@Test
@@ -1423,4 +1432,4 @@ public void non200FromNegotiateThrowsError() {
14231432
() -> hubConnection.start().timeout(1, TimeUnit.SECONDS).blockingAwait());
14241433
assertEquals("Unexpected status code returned from negotiate: 500 Internal server error.", exception.getMessage());
14251434
}
1426-
}
1435+
}

0 commit comments

Comments
 (0)