Package org.jtestserver.common.protocol

Examples of org.jtestserver.common.protocol.ReceivedMessage


    /* (non-Javadoc)
     * @see org.jtestserver.common.protocol.Server#receive(org.jtestserver.common.protocol.MessageProcessor)
     */
    @Override
    public synchronized void receive(MessageProcessor processor) throws ProtocolException, TimeoutException {
        ReceivedMessage receivedMessage = protocol.receiveMessage(socket);
        String reply = processor.process(receivedMessage.getMessage());
       
        if (reply != MessageProcessor.NO_RESPONSE) {
            protocol.sendMessage(socket, reply, receivedMessage.getRemoteAddress());
        }
    }
View Full Code Here


            // receive actual data
            data = new byte[size];
            packet = new DatagramPacket(data, data.length);
            socket.receive(packet);
           
            return new ReceivedMessage(new String(packet.getData()), packet.getSocketAddress());
           
//            ByteBuffer bb = ByteBuffer.allocate(INT_SIZE);
//            socket.getChannel().read(bb);
//            int size = bb.getInt();
//            bb = ByteBuffer.allocate(size);
View Full Code Here

            this.message = message;
        }
       
        @Override
        public ReceivedMessage receiveMessage(Object socket) throws ProtocolException, TimeoutException {
            return new ReceivedMessage(message, null);
        }
View Full Code Here

TOP

Related Classes of org.jtestserver.common.protocol.ReceivedMessage

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.