[rabbitmq-discuss] Problem: erlang ssl handshake_recv_unexpected_message
anton prokofiev
a.d.prokofiev at gmail.com
Thu Jul 12 09:56:56 BST 2012
Hello, All!
I try to connect to the external RabbitMQ server using SSL connection.
I use the following code:
=======================================
-module(test).
-include_lib("amqp_client/include/amqp_client.hrl").
-export([test/0]).
test()->
UserName = <<"user>>,
Password = <<"password">>,
Port = 50000,
HostName = "test2.connect.xxx.com",
VirtualHost = <<"/">>,
HeartBit = 10,
ConnectionTimeout = 20000 ,
CertPath ="/cert/new/",
CertSuffix = "TEST.pem",
ClientCertFile = CertPath ++ "client." ++ CertSuffix,
ClientKeyFile = CertPath ++ "clientkey." ++ CertSuffix,
CACertFile = CertPath ++ "cacert." ++ CertSuffix,
ClientCertPassword = "test",
SSLOptions = [{certfile,ClientCertFile}
,{keyfile,ClientKeyFile}
,{password,ClientCertPassword}
,{cacertfile,CACertFile}
% ,{verify, verify_peer}
,{fail_if_no_peer_cert, true}
],
Connection = #amqp_params_network{username = UserName,
password = Password,
virtual_host = VirtualHost,
host = HostName,
port = Port,
heartbeat = HeartBit,
connection_timeout = ConnectionTimeout,
ssl_options = SSLOptions ,
client_properties = []
},
{ok,Conn} = amqp_connection:start(Connection).
=======================================
And got following error:
=======================================
** exception exit:
{{bad_return_value,{handshake_recv_unexpected_message,{#Ref<0.0.0.169>,
{error,closed}}}},
{gen_server,call,[<0.77.0>,connect,infinity]}}
in function gen_server:call/3 (gen_server.erl, line 188)
in call from test:test/0 (src/test.erl, line 43)
=ERROR REPORT==== 12-Jul-2012::10:44:56 ===
** Generic server <0.77.0> terminating
** Last message in was connect
** When Server state == {state,amqp_network_connection,
{state,undefined,undefined,undefined,undefined,
undefined,false},
<0.76.0>,undefined,
{amqp_params_network,<<"user">>,
<<"password">>,<<"/">>,
"test2.connect.xxx.com",50000,0,0,10,
20000,
[{certfile,
"/home/a/src/new/client.TEST.pem"},
{keyfile,
"/home/a/src//new/clientkey.TEST.pem"},
{password,"test"},
{cacertfile,
"/home/a/src/new/cacert.TEST.pem"},
{fail_if_no_peer_cert,true}],
[#Fun<amqp_auth_mechanisms.plain.3>,
#Fun<amqp_auth_mechanisms.amqplain.3>],
[],[]},
undefined,undefined,
#Fun<amqp_connection_sup.0.39273983>,
#Fun<amqp_connection_sup.2.54430129>,false}
** Reason for termination ==
** {bad_return_value,
{handshake_recv_unexpected_message,{#Ref<0.0.0.169>,{error,closed}}}}
====================================
I have checked execution with the debugger.
I receive *connection.start* from the server
Application crashed with *handshake_recv_unexpected_message* when it try to
tune the connection: (waiting for *connection.tune *message from the server)
.
Any idea?
I use Erlang Erlang R15B01
RabbitMQ client lib: 2.8.2
Thanks in advance.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20120712/ef75745d/attachment.htm>
More information about the rabbitmq-discuss
mailing list