Yes, that's the case. Thanks a lot. On 8/2/06, Niklas Therning <[EMAIL PROTECTED]> wrote:
Paul Chen wrote: > I'm modifying the mina proxy example, by moving the code > of connecting to server from sessionOpened() into messageReceived(). > Because > I want to determine which server to > connect to based on the mesg received in messageReceived(). > > Attached is the modified ClientToProxyIoHandler.java > > The proxy server started ok w/ following dump to screen: > > ## ClientToProxyIoHandler> > Listening on port 8081 > > When hitting the server w/ a http request, it hangs here: > > ## ClientToProxyIoHandler.sessionCreated> > Aug 2, 2006 1:29:51 AM org.slf4j.impl.JCLLoggerAdapter info > INFO: [/127.0.0.1:3973] OPENED > ## ClientToProxyIoHandler.sessionOpened> > > If the code of server connecting is moved up to sessionOpened(), > everything works fine. > > Thanks >> >> >> > You need to remove the line session.setTrafficMask( TrafficMask.NONE ); from sessionCreated(). In the original example it's needed to prevent messageReceived() from being called before we have established the proxy to server connection. We could do without it but then we would need to buffer any data received before the connection has been established. You won't need the setTrafficMask() calls at all I think since you have changed the code which connects to join on the ConnectFuture. Please note that this may be less efficient since it blocks the thread until the connection is established or fails. HTH -- Niklas Therning Software Architect www.spamdrain.net
