jnidzwetzki / bitfinex-v2-wss-api-java

This project provides a Java client library for the Bitfinex WebSocket API (v2). Public and private channels (candles, ticks, executed trades, (raw) orderbooks, orders, and wallets) are implemented.
Apache License 2.0
91 stars 55 forks source link

Connection failed #52

Closed CheremisinVlad closed 6 years ago

CheremisinVlad commented 6 years ago

Hello. Can anyone help pls. I 've tried to run simple example

BitfinexApiBroker bitfinexApiBroker = new BitfinexApiBroker();
        try {
            System.out.println("create connection");
            bitfinexApiBroker.connect();
        } catch (APIException e) {
            LOG.error("getBitfinexResultMap",e);
        }

But i get this error:

ERROR Bitfinex [Bitfinex.java:27] getBitfinexResultMap com.github.jnidzwetzki.bitfinex.v2.entity.APIException: javax.websocket.DeploymentException: Connection failed. at com.github.jnidzwetzki.bitfinex.v2.BitfinexApiBroker.connect(BitfinexApiBroker.java:338) at exchange.bitfinex.Bitfinex.getBitfinexResultMap(Bitfinex.java:25) at exchange.Exchange.main(Exchange.java:46) Caused by: javax.websocket.DeploymentException: Connection failed. at org.glassfish.tyrus.container.jdk.client.JdkClientContainer$1.call(JdkClientContainer.java:200) at org.glassfish.tyrus.container.jdk.client.JdkClientContainer$1.call(JdkClientContainer.java:126) at org.glassfish.tyrus.container.jdk.client.JdkClientContainer.openClientSocket(JdkClientContainer.java:205) at org.glassfish.tyrus.client.ClientManager$3$1.run(ClientManager.java:668) at org.glassfish.tyrus.client.ClientManager$3.run(ClientManager.java:717) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at org.glassfish.tyrus.client.ClientManager$SameThreadExecutorService.execute(ClientManager.java:871) at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:112) at org.glassfish.tyrus.client.ClientManager.connectToServer(ClientManager.java:516) at org.glassfish.tyrus.client.ClientManager.connectToServer(ClientManager.java:378) at com.github.jnidzwetzki.bitfinex.v2.WebsocketClientEndpoint.connect(WebsocketClientEndpoint.java:87) at com.github.jnidzwetzki.bitfinex.v2.BitfinexApiBroker.connect(BitfinexApiBroker.java:329) ... 2 common frames omitted Caused by: javax.net.ssl.SSLHandshakeException: General SSLEngine problem at sun.security.ssl.Handshaker.checkThrown(Handshaker.java:1529) at sun.security.ssl.SSLEngineImpl.checkTaskThrown(SSLEngineImpl.java:535) at sun.security.ssl.SSLEngineImpl.writeAppRecord(SSLEngineImpl.java:1214) at sun.security.ssl.SSLEngineImpl.wrap(SSLEngineImpl.java:1186) at javax.net.ssl.SSLEngine.wrap(SSLEngine.java:469) at org.glassfish.tyrus.container.jdk.client.SslFilter.doHandshakeStep(SslFilter.java:478) at org.glassfish.tyrus.container.jdk.client.SslFilter.processRead(SslFilter.java:363) at org.glassfish.tyrus.container.jdk.client.Filter.onRead(Filter.java:134) at org.glassfish.tyrus.container.jdk.client.Filter.onRead(Filter.java:136) at org.glassfish.tyrus.container.jdk.client.TransportFilter$4.completed(TransportFilter.java:299) at org.glassfish.tyrus.container.jdk.client.TransportFilter$4.completed(TransportFilter.java:283) at sun.nio.ch.Invoker.invokeUnchecked(Invoker.java:126) at sun.nio.ch.Invoker.invokeUnchecked(Invoker.java:281) at sun.nio.ch.WindowsAsynchronousSocketChannelImpl$ReadTask.completed(WindowsAsynchronousSocketChannelImpl.java:579) at sun.nio.ch.Iocp$EventHandlerTask.run(Iocp.java:397) at sun.nio.ch.AsynchronousChannelGroupImpl$1.run(AsynchronousChannelGroupImpl.java:112) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) Caused by: javax.net.ssl.SSLHandshakeException: General SSLEngine problem at sun.security.ssl.Alerts.getSSLException(Alerts.java:192) at sun.security.ssl.SSLEngineImpl.fatal(SSLEngineImpl.java:1728) at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:330) at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:322) at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1614) at sun.security.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:216) at sun.security.ssl.Handshaker.processLoop(Handshaker.java:1052) at sun.security.ssl.Handshaker$1.run(Handshaker.java:992) at sun.security.ssl.Handshaker$1.run(Handshaker.java:989) at java.security.AccessController.doPrivileged(Native Method) at sun.security.ssl.Handshaker$DelegatedTask.run(Handshaker.java:1467) at org.glassfish.tyrus.container.jdk.client.SslFilter.doHandshakeStep(SslFilter.java:553) ... 13 common frames omitted Caused by: java.security.cert.CertificateException: No name matching api.bitfinex.com found at sun.security.util.HostnameChecker.matchDNS(HostnameChecker.java:231) at sun.security.util.HostnameChecker.match(HostnameChecker.java:96) at sun.security.ssl.X509TrustManagerImpl.checkIdentity(X509TrustManagerImpl.java:455) at sun.security.ssl.X509TrustManagerImpl.checkIdentity(X509TrustManagerImpl.java:436) at sun.security.ssl.X509TrustManagerImpl.checkTrusted(X509TrustManagerImpl.java:252) at sun.security.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:136) at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1601) ... 20 common frames omitted ERROR BitfinexApiBroker [WebsocketClientEndpoint.java:122] Unable to send message, user session is null

What i did wrong?

jnidzwetzki commented 6 years ago

Hi,

It looks like an SSL problem with your Internet connection. The driver cannot establish a secure connection to Bitfinex. Do you use a proxy? If yes, please deactivate it for a test. Can you open the URL "https://api.bitfinex.com/" in your browser or are there also problems here?

Best Regards Jan

CheremisinVlad commented 6 years ago

Thanks for your answer.Issue have been solved.