Package com.jitlogic.zorka.core.integ

Examples of com.jitlogic.zorka.core.integ.NrpePacket.encode()


    @Test
    public void testEncodeAndDecodePacket() throws Exception{
        NrpePacket pkt = NrpePacket.newInstance((short)2, (short)1, (short)1, "oja!");
        ByteArrayOutputStream os = new ByteArrayOutputStream(1036);

        pkt.encode(os);
        byte[] buf = os.toByteArray();
        assertEquals(1036, buf.length);

        NrpePacket pkt2 = NrpePacket.fromStream(new ByteArrayInputStream(buf));
View Full Code Here


    public void testEncodeAndDecodeWithNegativeCrc() throws Exception {
        NrpePacket pkt = NrpePacket.newInstance(2, NrpePacket.QUERY_PACKET, 3, "zorka.version[]");

        ByteArrayOutputStream os = new ByteArrayOutputStream(1036);

        pkt.encode(os);
        byte[] buf = os.toByteArray();
        assertEquals(1036, buf.length);

        NrpePacket pkt2 = NrpePacket.fromStream(new ByteArrayInputStream(buf));
View Full Code Here

    private String query(String query) throws Exception{
        Socket client = new Socket("127.0.0.1", 5669);

        NrpePacket request = NrpePacket.newInstance(2, NrpePacket.QUERY_PACKET, 3, "zorka.version[]");
        request.encode(client.getOutputStream());
        client.getOutputStream().flush();

        NrpePacket response = NrpePacket.fromStream(client.getInputStream());

        return response.getData();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.