Hi Sebastien,
the IOException is not returned because connection is getting executed
asynchronously.
You can provide callback handler with following onConnect
implementation:
new CallbackHandler<Context>(){
public void onConnect(IOEvent<Context> ioEvent) {
SelectionKey key =
ioEvent.attachment().getSelectionKey();
try{
tcpConnector.finishConnect(key);
} catch (IOException ex){
// Exceotion here!!!
}
ioEvent.attachment().getSelectorHandler().register(key,
SelectionKey.OP_READ);
}
You can take a look at unit test TCPConnectorHandlerTest.
WBR,
Alexey.
On Dec 22, 2008, at 22:01 , Survivant 00 wrote:
> I'm trying to do a little test. A simple client that connect to a
> server and send data.. I try to connect to a server that isn't up..
> and I didn't receive a exception.. the program continue like
> everything is fine..
>
> try {
>
> f_controller = new Controller();
> f_tcpConnectorHandler = new TCPConnectorHandler();
>
> f_tcpConnectorHandler.connect(new
> InetSocketAddress("localhost", 7803));
>
> .....
>
> log4j:WARN No appenders could be found for logger
> (com.gfbn.quotegw.client.QuoteClientGrizzly).
> log4j:WARN Please initialize the log4j system properly.
> 2008-12-22 15:58:10 com.sun.grizzly.DefaultCallbackHandler onConnect
> GRAVE: Connection refused: no further information
>
>
> ....
>
> I was expecting a Exception at the line :
> f_tcpConnectorHandler.connect(new InetSocketAddress("localhost",
> 7803));
>
>
>