Class ConnectionWrapper

java.lang.Object
com.binance.connector.client.common.websocket.adapter.ConnectionWrapper
All Implemented Interfaces:
ConnectionInterface, org.eclipse.jetty.websocket.api.WebSocketConnectionListener, org.eclipse.jetty.websocket.api.WebSocketListener
Direct Known Subclasses:
StreamConnectionWrapper

public class ConnectionWrapper extends Object implements org.eclipse.jetty.websocket.api.WebSocketListener, ConnectionInterface
  • Field Details

    • WAIT_TIME

      public static final int WAIT_TIME
      See Also:
    • pendingRequest

      protected Map<String,RequestWrapperDTO> pendingRequest
    • session

      protected org.eclipse.jetty.websocket.api.Session session
    • oldSession

      protected org.eclipse.jetty.websocket.api.Session oldSession
  • Constructor Details

  • Method Details

    • connect

      public void connect()
      Specified by:
      connect in interface ConnectionInterface
    • connect

      public void connect(Consumer<org.eclipse.jetty.websocket.api.Session> customCallback) throws IOException, URISyntaxException, InterruptedException
      Throws:
      IOException
      URISyntaxException
      InterruptedException
    • getLogonConsumer

      public Consumer<org.eclipse.jetty.websocket.api.Session> getLogonConsumer()
    • onWebSocketPing

      public void onWebSocketPing(ByteBuffer payload)
    • getPendingRequest

      public Map<String,RequestWrapperDTO> getPendingRequest()
    • isPendingReconnect

      public boolean isPendingReconnect()
    • setPendingReconnect

      public void setPendingReconnect(boolean pendingReconnect)
    • isReady

      public boolean isReady()
    • setReady

      public void setReady(boolean ready)
    • getUserAgent

      public String getUserAgent()
    • setUserAgent

      public void setUserAgent(String userAgent)
      Specified by:
      setUserAgent in interface ConnectionInterface
    • onWebSocketError

      public void onWebSocketError(Throwable cause)
      Specified by:
      onWebSocketError in interface org.eclipse.jetty.websocket.api.WebSocketConnectionListener
    • onWebSocketClose

      public void onWebSocketClose(int statusCode, String reason)
      Specified by:
      onWebSocketClose in interface org.eclipse.jetty.websocket.api.WebSocketConnectionListener
    • send

      public void send(RequestWrapperDTO request)
      Specified by:
      send in interface ConnectionInterface
    • send

      public void send(ApiRequestWrapperDTO request)
      Specified by:
      send in interface ConnectionInterface
    • sendForStream

      public BlockingQueue<String> sendForStream(ApiRequestWrapperDTO request) throws InterruptedException
      Specified by:
      sendForStream in interface ConnectionInterface
      Throws:
      InterruptedException
    • innerSend

      public void innerSend(RequestWrapperDTO requestWrapperDTO)
    • send

      public void send(RequestWrapperDTO request, org.eclipse.jetty.websocket.api.Session session)
    • getTimestamp

      public Long getTimestamp()
    • logOn

      public void logOn(org.eclipse.jetty.websocket.api.Session session) throws org.bouncycastle.crypto.CryptoException
      Throws:
      org.bouncycastle.crypto.CryptoException
    • onWebSocketConnect

      public void onWebSocketConnect(org.eclipse.jetty.websocket.api.Session session)
      Specified by:
      onWebSocketConnect in interface org.eclipse.jetty.websocket.api.WebSocketConnectionListener
    • onWebSocketText

      public void onWebSocketText(String message)
      Specified by:
      onWebSocketText in interface org.eclipse.jetty.websocket.api.WebSocketListener
    • canReconnect

      public boolean canReconnect()
    • beforeConnect

      protected void beforeConnect()
    • afterConnect

      protected void afterConnect(org.eclipse.jetty.websocket.api.Session session)
    • isConnected

      public boolean isConnected()
      Specified by:
      isConnected in interface ConnectionInterface
    • getUri

      public URI getUri(String uri) throws URISyntaxException
      Throws:
      URISyntaxException