Skip to content

Fix null request ID when unsubscribing from streams - #248

Open
anshitraj wants to merge 1 commit into
binance:masterfrom
anshitraj:fix/unsubscribe-null-id-247
Open

anshitraj wants to merge 1 commit into
binance:masterfrom
anshitraj:fix/unsubscribe-null-id-247

Conversation

@anshitraj

Copy link
Copy Markdown

Summary

  • assign a unique request ID to stream UNSUBSCRIBE messages
  • add a regression test covering the acknowledgement path and pending-request cleanup

Problem

StreamConnectionWrapper.unsubscribe currently sends the request without an ID. Binance echoes that as "id": null, and onWebSocketText then calls getAsString() on JsonNull, raising UnsupportedOperationException.

Using a generated ID matches the other control messages in this class and lets the acknowledgement be correlated and removed from pendingRequest normally.

Fixes #247.

Testing

A focused unit test verifies that the unsubscribe payload contains a non-null ID, its acknowledgement does not throw, and the pending request is removed. GitHub Actions will run the repository's Maven verification.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

unsubscribe java.lang.UnsupportedOperationException: JsonNull

1 participant