@@ -510,16 +510,18 @@ public WindowFuture<Integer,PduRequest,PduResponse> sendRequestPdu(PduRequest pd
510510 // write the pdu out & wait timeout amount of time
511511 ChannelFuture channelFuture = this .channel .writeAndFlush (buffer );
512512 if (configuration .getWriteTimeout () > 0 ){
513- channelFuture .await (configuration .getWriteTimeout ());
513+ if (!channelFuture .await (configuration .getWriteTimeout ()))
514+ throw new SmppChannelException (channelFuture .cause () != null ? channelFuture .cause ().getMessage ()
515+ : "ChannelFuture failed without cause." , channelFuture .cause ());
514516 } else {
515517 channelFuture .await ();
516518 }
517519
518520 // check if the write was a success
519521 if (!channelFuture .isSuccess ()) {
520522 // the write failed, make sure to throw an exception
521- if (channelFuture .cause () != null ) throw new SmppChannelException ( channelFuture .cause ().getMessage (), channelFuture . cause ());
522- else throw new SmppChannelException ( "ChannelFuture failed without cause." );
523+ throw new SmppChannelException (channelFuture .cause () != null ? channelFuture .getCause ().getMessage ()
524+ : "ChannelFuture failed without cause." , channelFuture . cause () );
523525 }
524526
525527 this .countSendRequestPdu (pdu );
@@ -562,15 +564,18 @@ public void sendResponsePdu(PduResponse pdu) throws RecoverablePduException, Unr
562564 // write the pdu out & wait timeout amount of time
563565 ChannelFuture channelFuture = this .channel .writeAndFlush (buffer );
564566 if (configuration .getWriteTimeout () > 0 ){
565- channelFuture .await (configuration .getWriteTimeout ());
567+ if (!channelFuture .await (configuration .getWriteTimeout ()))
568+ throw new SmppChannelException (channelFuture .cause () != null ? channelFuture .cause ().getMessage ()
569+ : "ChannelFuture failed without cause." , channelFuture .cause ());
566570 } else {
567571 channelFuture .await ();
568572 }
569573
570574 // check if the write was a success
571575 if (!channelFuture .isSuccess ()) {
572576 // the write failed, make sure to throw an exception
573- throw new SmppChannelException (channelFuture .cause ().getMessage (), channelFuture .cause ());
577+ throw new SmppChannelException (channelFuture .cause () != null ? channelFuture .cause ().getMessage ()
578+ : "ChannelFuture failed without cause." , channelFuture .cause ());
574579 }
575580 }
576581
0 commit comments