After 4 days of struggling with the code, I've found the cause of the problem. First I discovered error message while debugging the producer.send() message on client side. It is throwing the following exception, while trying to connect socket
"cannot connect to Web Socket server at
http://localhost:8080/gravityTest/websocketamf/amf
(IoError: Error #2031: Socket Error. URL: localhost)"
but the thrown exception is not reaching to top level so I could not get any idea about the exception for a long time.
After googling the exception, I find out that it is caused by flash security policy. Then I debugged the PolicyFileServerListener and find out that localAddress of the policy server after binding is [/0:0:0:0:0:0:0:0:843]
because it is using InetSocketAddressIPv6. I guess this is the default behaviour of JDK 1.7. When I change the version of JDK to 1.6, localAddress became [/0.0.0.0:843]
. After this change, my application succesfully accessed the policy server, and messaging with websocket worked fine.