@Test
public void testGIOP_1_1_IllegalMessageType()
{
List<byte[]> messages = new Vector<byte[]>();
LocateRequestOutputStream r_out =
new LocateRequestOutputStream(
getORB(),
new byte[1], //object key
0, //request id
1 // giop minor
);
r_out.insertMsgSize();
byte[] b = r_out.getBufferCopy();
b[6] |= 0x02; //set "more fragments follow"
messages.add( b );
// MessageOutputStream m_out =
// new MessageOutputStream();
DummyTransport transport =
new DummyTransport( messages );
DummyRequestListener request_listener =
new DummyRequestListener();
DummyReplyListener reply_listener =
new DummyReplyListener();
GIOPConnectionManager giopconn_mg =
new GIOPConnectionManager();
try
{
giopconn_mg.configure (config);
}
catch (Exception e)
{
}
GIOPConnection conn =
giopconn_mg.createServerGIOPConnection( null,
transport,
request_listener,
reply_listener );
try
{
//will not return until an IOException is thrown (by the
//DummyTransport)
conn.receiveMessages();
}
catch( IOException e )
{
//o.k., thrown by DummyTransport
}
//no request or reply must have been handed over
assertTrue( request_listener.getRequest() == null );
assertTrue( reply_listener.getReply() == null );
//instead, an error message have must been sent via the
//transport
assertTrue( transport.getWrittenMessage() != null );
byte[] result = transport.getWrittenMessage();
assertTrue( Messages.getMsgType( result ) == MsgType_1_1._MessageError );
r_out.close();
}