As I checked further ,

We use NioSocketAcceptor. It actually throws
java.lang.UnsupportedOperationException  from AbstractIoSession class as
the TransportMetaDataType is socket and

getTransportMetadata().isConnectionless() is false being
DefaultTransportMetadata
<http://mina.apache.org/report/trunk/xref/org/apache/mina/core/service/DefaultTransportMetadata.html>
in use.

One way to resolve that I see is - to have a class something like
NioSocketSession or DummySession and override write method. Then Use
this new class as processor while creating NioSocketAcceptor. However
also see that there are some methods private to nio package.

Would like to know the best possible way to resolve the write problem.

 On Fri, Aug 31, 2012 at 7:12 PM, Kanupriya Dadariya <
[email protected]> wrote:

> Hi,
>
> I am using Apache Mina sshd . Do not have my own encoder/decoder. Need to
> display the message to client terminal during authentication .
>
> Probably making some obvious mistake , Can somebody please help me out ?
>
> Here is the code snippet : I get the writeStatus as false always and don't
> get the message displayed .
>
> =============================
> IoBuffer buffer = IoBuffer.allocate(1024, true);
>     buffer.setAutoExpand(true);
>     try {
>       buffer.putString("small", Charset.forName("UTF-8").newEncoder());
>
>     } catch (CharacterCodingException e) {
>
>     }
>
>     WriteFuture future = ioSession.write(buffer,
> ioSession.getRemoteAddress());
>     IoFutureListener iof = new MinaIOFutureListener();
>     future.addListener(iof);
>
>     if(future.isWritten()){
>       writeStatus = true;
>     } else {
>       writeStatus = false;
>     }
>     future.removeListener(iof);
> =================================
> Appreciate any help .
>

Reply via email to