Facing below hand shake issues daily 4 to 5 times in market timings


  • Hi Team, Bellow issues I am facing daily around 4 to 5 times in market timings , these issues have become blocker for me to continue , let me know whether I need to take any latest piece of code

    Issue 1:
    com.neovisionaries.ws.client.WebSocketException: Failed to send an opening handshake request to the server: Remote host closed connection during handshake
    at com.neovisionaries.ws.client.WebSocket.writeHandshake(WebSocket.java:3430)
    at com.neovisionaries.ws.client.WebSocket.shakeHands(WebSocket.java:3316)
    at com.neovisionaries.ws.client.WebSocket.connect(WebSocket.java:2354)
    at com.angelbroking.smartapi.ticker.SmartAPITicker.connect(SmartAPITicker.java:288)
    at com.angelbroking.smartapi.ticker.SmartAPITicker$1.onDisconnected(SmartAPITicker.java:188)
    at com.neovisionaries.ws.client.ListenerManager.callOnDisconnected(ListenerManager.java:224)
    at com.neovisionaries.ws.client.WebSocket.finish(WebSocket.java:3758)
    at com.neovisionaries.ws.client.WebSocket.onThreadsFinished(WebSocket.java:3724)
    at com.neovisionaries.ws.client.WebSocket.onWritingThreadFinished(WebSocket.java:3713)
    at com.neovisionaries.ws.client.WritingThread.notifyFinished(WritingThread.java:539)
    at com.neovisionaries.ws.client.WritingThread.runMain(WritingThread.java:78)
    at com.neovisionaries.ws.client.WebSocketThread.run(WebSocketThread.java:45)
    Caused by: javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake
    at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1009)
    at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1388)
    at sun.security.ssl.SSLSocketImpl.writeRecord(SSLSocketImpl.java:765)
    at sun.security.ssl.AppOutputStream.write(AppOutputStream.java:123)
    at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:82)
    at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:140)
    at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:141)
    at com.neovisionaries.ws.client.WebSocket.writeHandshake(WebSocket.java:3423)
    ... 11 more
    Caused by: java.io.EOFException: SSL peer shut down incorrectly
    at sun.security.ssl.InputRecord.read(InputRecord.java:505)
    at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:990)
    ... 18 more

    Issue 2:
    com.neovisionaries.ws.client.WebSocketException: The status line of the opening handshake response is badly formatted. The status line is: <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
    at com.neovisionaries.ws.client.HandshakeReader.readStatusLine(HandshakeReader.java:112)
    at com.neovisionaries.ws.client.HandshakeReader.readHandshake(HandshakeReader.java:48)
    at com.neovisionaries.ws.client.WebSocket.readHandshake(WebSocket.java:3440)
    at com.neovisionaries.ws.client.WebSocket.shakeHands(WebSocket.java:3319)
    at com.neovisionaries.ws.client.WebSocket.connect(WebSocket.java:2354)
    at com.angelbroking.smartapi.ticker.SmartAPITicker.connect(SmartAPITicker.java:288)
    at com.trading.angel.TestAngelWebSocketApi.tickerUsage(TestAngelWebSocketApi.java:201)
    at com.trading.angel.TestAngelWebSocketApi.main(TestAngelWebSocketApi.java:84)


  • Hi @c_harish , Yes I faced , daily I used to capture ticker data for backtesting and today it was many times (10+ times) I faced, finally stopped my server.


  • @ckatangelapi did you by chance face any issues around 13:21 to 13:45?


  • HI @ckatangelapi We have reported this issue we will test it and update you.


  • HI @admin , Today also I faced these issues around 7 to 8 times between 09:15 to 11:35, Fix these issues as early as possible.


  • Hi @admin , Any update on above issues.


  • @ckatangelapi

    Issue 3:

    com.neovisionaries.ws.client.OpeningHandshakeException: The status code of the opening handshake response is not '101 Switching Protocols'. The status line is: HTTP/1.1 503 Service Unavailable
    at com.neovisionaries.ws.client.HandshakeReader.validateStatusLine(HandshakeReader.java:232)
    at com.neovisionaries.ws.client.HandshakeReader.readHandshake(HandshakeReader.java:54)
    at com.neovisionaries.ws.client.WebSocket.readHandshake(WebSocket.java:3440)
    at com.neovisionaries.ws.client.WebSocket.shakeHands(WebSocket.java:3319)
    at com.neovisionaries.ws.client.WebSocket.connect(WebSocket.java:2354)
    at com.angelbroking.smartapi.ticker.SmartAPITicker.connect(SmartAPITicker.java:288)
    at com.angelbroking.smartapi.ticker.SmartAPITicker$1.onDisconnected(SmartAPITicker.java:188)
    at com.neovisionaries.ws.client.ListenerManager.callOnDisconnected(ListenerManager.java:224)
    at com.neovisionaries.ws.client.WebSocket.finish(WebSocket.java:3758)
    at com.neovisionaries.ws.client.WebSocket.onThreadsFinished(WebSocket.java:3724)
    at com.neovisionaries.ws.client.WebSocket.onReadingThreadFinished(WebSocket.java:3691)
    at com.neovisionaries.ws.client.ReadingThread.notifyFinished(ReadingThread.java:1138)
    at com.neovisionaries.ws.client.ReadingThread.runMain(ReadingThread.java:80)
    at com.neovisionaries.ws.client.WebSocketThread.run(WebSocketThread.java:45)

    Queries/Concerns:

    1. If these issues start occurring daily how we need to run our Alogs/backtest with live market.
    2. Whether this smart api code is tested properly in your dev/qa environments for handling multiple clients/connections.
    3. Because of these issues I am missing some important entries and exits.