HessianEchoListener implements WebSocketListener
import com.caucho.websocket.*;
import com.caucho.hessian.io.*;
public class HessianEchoListener extends AbstractWebSocketListener {
Hessian2Input _hIn;
Hessian2Output _hOut;
HessianEchoListener(HessianFactory factory)
{
_hIn = factory.createHessian2Input(null);
_hOut = factory.createHessian2Output(null);
}
@Override
public void onReadBinary(WebSocketContext context, InputStream is)
throws IOException
{
_hIn.initPacket(is);
Object obj = _hIn.readObject();
OutputStream os = context.beginBinaryMessage();
_hOut.initPacket(os);
_hOut.writeObject(obj);
_hOut.close();
}
}