All Downloads are FREE. Search and download functionalities are using the official Maven repository.

cc.agentx.client.ClientTest Maven / Gradle / Ivy

The newest version!
/*
 * Copyright 2017 ZhangJiupeng
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package cc.agentx.client;

import cc.agentx.client.net.nio.XClient;
import cc.agentx.wrapper.FrameWrapper;
import cc.agentx.wrapper.RandomPaddingWrapper;

import java.util.Arrays;

public class ClientTest {
    public static void main(String[] args) throws Exception {
        Configuration.init();
        System.out.println(Configuration.INSTANCE);
        XClient.getInstance().start();
//
//        RandomPaddingWrapper zeroPaddingWrapper = new RandomPaddingWrapper(10, 10);
//        FrameWrapper frameWrapper = new FrameWrapper(16384, zeroPaddingWrapper);
//        byte[] src = "hello world".getBytes();
//        System.out.println("src: " + Arrays.toString(src));
//        byte[] des = zeroPaddingWrapper.wrap(src);
//        System.out.println("des: " + Arrays.toString(des));
//        byte[] dcd = zeroPaddingWrapper.unwrap(des);
//        System.out.println("dcd: " + Arrays.toString(dcd));
//        System.out.println("result: " + new String(dcd));
//
//
//        byte[] frame_des = frameWrapper.wrap(src);
//        System.out.println("frame_des: " + Arrays.toString(frame_des));
//        byte[] frame_dcd = frameWrapper.unwrap(Arrays.copyOfRange(frame_des, 0, 3));
//        System.out.println("frame_dcd" + Arrays.toString(frame_dcd));
//        frame_dcd = frameWrapper.unwrap(Arrays.copyOfRange(frame_des, 3, frame_des.length));
//        System.out.println("frame_dcd" + Arrays.toString(frame_dcd));
//        System.out.println(new String(frame_dcd));

    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy