It sounds like a bug. Could you please post a JIRA issue here:
http://issues.apache.org/jira/browse/DIRMINA
It would be very nice if you can provide us a reproduceable JUnit test case.
Thank you in advance,
Trustin
On 9/30/06, Raman Gupta <[EMAIL PROTECTED]> wrote:
I have a client application using Mina that repeatedly tries to connect
(every 30 seconds or so) to a server. If the server is not running, I
get what I would expect:
[...]
Caused by: java.io.IOException: Failed to get the session.
at
org.apache.mina.common.ConnectFuture.getSession(ConnectFuture.java:73)
at
com.citi.lws.bindings.tcpip.TcpIpClientBinding.connect(
TcpIpClientBinding.java:137)
... 48 more
Caused by: java.net.ConnectException: Connection refused: no further
information
at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
at
sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:527)
at
org.apache.mina.transport.socket.nio.SocketConnector.processSessions(
SocketConnector.java:285)
at
org.apache.mina.transport.socket.nio.SocketConnector.access$800(
SocketConnector.java:48)
at
org.apache.mina.transport.socket.nio.SocketConnector$Worker.run(
SocketConnector.java:388)
However, after a few attempts the connection seems to succeed and my
IoHandler's sessionOpened event fires. The session.getRemoteAddress() ==
null and session.isConnected() == true.
Since my application now thinks there is a connection to some
non-existent server, it then attempts to send data through the link, and
I see this in my logs:
[WARN ][support.DefaultExceptionMonitor] Unexpected exception.
java.nio.channels.NotYetConnectedException
at
sun.nio.ch.SocketChannelImpl.ensureWriteOpen(SocketChannelImpl.java:129)
at sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:294)
at
org.apache.mina.transport.socket.nio.SocketIoProcessor.doFlush(
SocketIoProcessor.java:480)
at
org.apache.mina.transport.socket.nio.SocketIoProcessor.doFlush(
SocketIoProcessor.java:412)
at
org.apache.mina.transport.socket.nio.SocketIoProcessor.access$500(
SocketIoProcessor.java:41)
at
org.apache.mina.transport.socket.nio.SocketIoProcessor$Worker.run(
SocketIoProcessor.java:568)
Is this a bug or is my client doing something it shouldn't be doing?
The connect code is just:
ConnectFuture connectFuture = ioConnector.connect(socketAddress,
ioHandler);
connectFuture.join();
ioSession = connectFuture.getSession();
Thanks,
Raman
--
what we call human nature is actually human habit
--
http://gleamynode.net/
--
PGP key fingerprints:
* E167 E6AF E73A CBCE EE41 4A29 544D DE48 FE95 4E7E
* B693 628E 6047 4F8F CFA4 455E 1C62 A7DC 0255 ECA6