package com.kmall.common.manager.websocket;

import org.java_websocket.client.WebSocketClient;

import java.io.UnsupportedEncodingException;
import java.net.URISyntaxException;
import java.nio.channels.NotYetConnectedException;

/**
 * Created by ken on 2018/12/20.
 */
@Deprecated
public class WebSocketClientTest {
    public static WebSocketClient client;

    public static void main(String[] args) throws URISyntaxException, NotYetConnectedException, UnsupportedEncodingException {

        String content = "{\"_method\":\"cus-sec_SpcSignDataAsPEM\",\"_id\":1,\"args\":{\"inData\":\"\\\"sessionID\\\":\\\"1dd44ea3-202a-43e7-87a5-6d82ca3fce4f\\\"||\\\"payExchangeInfoHead\\\":\\\"{\\\"guid\\\":\\\"9D55BA71-55DE-41F4-8B50-C36C83B3B419\\\",\\\"initalRequest\\\":\\\"https://openapi.alipay.com/gateway.do?timestamp=2013-01-0108:08:08&method=alipay.trade.pay&app_id=13580&sign_type=RSA2&sign=ERITJKEIJKJHKKKKKKKHJEREEEEEEEEEEE&version=1.0&charset=GBK\\\",\\\"initalResponse\\\":\\\"ok\\\",\\\"ebpCode\\\":\\\"xxxxxxxx\\\",\\\"payCode\\\":\\\"312226T001\\\",\\\"payTransactionId\\\":\\\"2018121222001354081010726129\\\",\\\"totalAmount\\\":100,\\\"currency\\\":\\\"142\\\",\\\"verDept\\\":\\\"3\\\",\\\"payType\\\":\\\"1\\\",\\\"tradingTime\\\":\\\"20181212041803\\\",\\\"note\\\":\\\"批量订单，测试订单优化,生成多个so订单\\\"}\\\"||\\\"payExchangeInfoLists\\\":\\\"[{\\\"orderNo\\\":\\\"SO1710301150602574003\\\",\\\"goodsInfo\\\":[{\\\"gname\\\":\\\"lhy-gnsku3\\\",\\\"itemLink\\\":\\\"http://m.yunjiweidian.com/yunjibuyer/static/vue-buyer/idc/index.html#/detail?itemId=999761&shopId=453\\\"},{\\\"gname\\\":\\\"lhy-gnsku2\\\",\\\"itemLink\\\":\\\"http://m.yunjiweidian.com/yunjibuyer/static/vue-buyer/idc/index.html#/detail?itemId=999760&shopId=453\\\"}],\\\"recpAccount\\\":\\\"OSA571908863132601\\\",\\\"recpCode\\\":\\\"\\\",\\\"recpName\\\":\\\"YUNJIHONGKONGLIMITED\\\"}]\\\"||\\\"serviceTime\\\":\\\"1544519952469\\\"\",\"passwd\":\"88888888\"}}";

        WebSocketClientHandle.send(
       "ws://127.0.0.1:61232",
            content,
            new Callback() {
                @Override
                public Object run(Object params) {
                    System.out.println(params);
                    return null;
                }
            },new Callback() {
                @Override
                public Object run(Object params) {
                    Exception e=(Exception) params;
                    e.printStackTrace();
                    return null;
                }
            });


    }

}
