"connection reset" in spot websocket

I use the demo in binance-exchange/binance-java-api, but all the websocket demo get “connect reset”, either in prd or test. But the spot rest-client works well, which I can always success send and receive http request. And the future test is always success too.

finally I solved the problem, the test and the prd websocket urls are different, so the lib should be modified a little.

If you want to use the lib in spot test enviroment, you should modify the getStreamApiBaseUrl method in class BinanceApiConfig.java :

	 * Streaming API base URL.
//	public static String getStreamApiBaseUrl() {
//		return String.format("wss://stream.%s:9443/ws", getBaseDomain());
//	}

    public static String getStreamApiBaseUrl(){
        return "wss://testnet.binance.vision/ws";

Below code works like a charm to me… (didn’t change a bit)
If it fails on the connection, most likely it’s your network/dns problem.

public class AllMarketTickersExample {

  public static void main(String[] args) {
    BinanceApiClientFactory factory = BinanceApiClientFactory.newInstance();
    BinanceApiWebSocketClient client = factory.newWebSocketClient();

    client.onAllMarketTickersEvent(event -> {

And you can verify it by using https://blacksabbather.github.io/ws/wstool.htm from your end. If this doesn’t work, it definitely means your network has problem