mirror of
https://github.com/tiennm99/zfoo.git
synced 2026-05-23 12:26:00 +00:00
fix[protocol]: remove char test
This commit is contained in:
@@ -1,37 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2020 The zfoo Authors
|
||||
*
|
||||
* 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 com.zfoo.net.core.csharp;
|
||||
|
||||
import com.zfoo.net.NetContext;
|
||||
import com.zfoo.net.packet.csharp.CM_CSharpRequest;
|
||||
import com.zfoo.net.anno.PacketReceiver;
|
||||
import com.zfoo.net.session.Session;
|
||||
import com.zfoo.protocol.util.JsonUtils;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @author godotg
|
||||
*/
|
||||
@Component
|
||||
public class ServerPacketController {
|
||||
|
||||
@PacketReceiver
|
||||
public void atCM_CSharpRequest(Session session, CM_CSharpRequest cm) {
|
||||
System.out.println("receive packet from client:");
|
||||
System.out.println(JsonUtils.object2String(cm));
|
||||
|
||||
NetContext.getRouter().send(session, cm);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2020 The zfoo Authors
|
||||
*
|
||||
* 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 com.zfoo.net.core.csharp;
|
||||
|
||||
import com.zfoo.net.core.HostAndPort;
|
||||
import com.zfoo.net.core.tcp.TcpServer;
|
||||
import com.zfoo.net.session.SessionUtils;
|
||||
import com.zfoo.protocol.util.ThreadUtils;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
|
||||
/**
|
||||
* @author godotg
|
||||
*/
|
||||
@Ignore
|
||||
public class ServerTest {
|
||||
|
||||
private static final ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("config.xml");
|
||||
|
||||
@Test
|
||||
public void startServer() {
|
||||
SessionUtils.printSessionInfo();
|
||||
// startClient1();
|
||||
|
||||
var server = new TcpServer(HostAndPort.valueOf("127.0.0.1:9000"));
|
||||
server.start();
|
||||
ThreadUtils.sleep(Long.MAX_VALUE);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -35,7 +35,7 @@ public class TcpServerTest {
|
||||
public void startServer() {
|
||||
var context = new ClassPathXmlApplicationContext("config.xml");
|
||||
|
||||
var server = new TcpServer(HostAndPort.valueOf("127.0.0.1:9000"));
|
||||
var server = new TcpServer(HostAndPort.valueOf("0.0.0.0:9000"));
|
||||
server.start();
|
||||
ThreadUtils.sleep(Long.MAX_VALUE);
|
||||
}
|
||||
|
||||
@@ -33,7 +33,6 @@ public class CM_Int {
|
||||
|
||||
private long d;
|
||||
|
||||
private char e;
|
||||
|
||||
private String f;
|
||||
|
||||
@@ -57,14 +56,6 @@ public class CM_Int {
|
||||
return a;
|
||||
}
|
||||
|
||||
public char getE() {
|
||||
return e;
|
||||
}
|
||||
|
||||
public void setE(char e) {
|
||||
this.e = e;
|
||||
}
|
||||
|
||||
public void setA(byte a) {
|
||||
this.a = a;
|
||||
}
|
||||
@@ -104,12 +95,11 @@ public class CM_Int {
|
||||
b == cm_int.b &&
|
||||
c == cm_int.c &&
|
||||
d == cm_int.d &&
|
||||
e == cm_int.e &&
|
||||
f.equals(cm_int.f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(flag, a, b, c, d, e, f);
|
||||
return Objects.hash(flag, a, b, c, d, f);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,8 +33,6 @@ public class SM_Int {
|
||||
|
||||
private Long d;
|
||||
|
||||
private char e;
|
||||
|
||||
private String f;
|
||||
|
||||
public Boolean getFlag() {
|
||||
@@ -77,14 +75,6 @@ public class SM_Int {
|
||||
this.d = d;
|
||||
}
|
||||
|
||||
public char getE() {
|
||||
return e;
|
||||
}
|
||||
|
||||
public void setE(char e) {
|
||||
this.e = e;
|
||||
}
|
||||
|
||||
public String getF() {
|
||||
return f;
|
||||
}
|
||||
@@ -98,8 +88,7 @@ public class SM_Int {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
SM_Int sm_int = (SM_Int) o;
|
||||
return e == sm_int.e &&
|
||||
flag.equals(sm_int.flag) &&
|
||||
return flag.equals(sm_int.flag) &&
|
||||
a.equals(sm_int.a) &&
|
||||
b.equals(sm_int.b) &&
|
||||
c.equals(sm_int.c) &&
|
||||
@@ -109,7 +98,7 @@ public class SM_Int {
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(flag, a, b, c, d, e, f);
|
||||
return Objects.hash(flag, a, b, c, d, f);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,101 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2020 The zfoo Authors
|
||||
*
|
||||
* 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 com.zfoo.net.packet.csharp;
|
||||
|
||||
import com.zfoo.protocol.anno.Protocol;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author godotg
|
||||
*/
|
||||
@Protocol(id = 1165)
|
||||
public class CM_CSharpRequest {
|
||||
|
||||
// 注释1
|
||||
public byte a;
|
||||
/**
|
||||
* 注释2
|
||||
* 附加注释
|
||||
*/
|
||||
public Byte aa;
|
||||
public byte[] aaa;
|
||||
public Byte[] aaaa;
|
||||
|
||||
public short b;
|
||||
public Short bb;
|
||||
public short[] bbb;
|
||||
public Short[] bbbb;
|
||||
|
||||
public int c;
|
||||
public Integer cc;
|
||||
public int[] ccc;
|
||||
public Integer[] cccc;
|
||||
|
||||
public long d;
|
||||
public Long dd;
|
||||
public long[] ddd;
|
||||
public Long[] dddd;
|
||||
|
||||
public float e;
|
||||
public Float ee;
|
||||
public float[] eee;
|
||||
public Float[] eeee;
|
||||
|
||||
public double f;
|
||||
public Double ff;
|
||||
public double[] fff;
|
||||
public Double[] ffff;
|
||||
|
||||
public boolean g;
|
||||
public Boolean gg;
|
||||
public boolean[] ggg;
|
||||
public Boolean[] gggg;
|
||||
|
||||
// 注释行
|
||||
public char h;
|
||||
public Character hh;
|
||||
public char[] hhh;
|
||||
public Character[] hhhh;
|
||||
|
||||
public String jj;
|
||||
public String[] jjj;
|
||||
|
||||
public CSharpObjectA objectA;
|
||||
public CSharpObjectA[] objectArray;
|
||||
|
||||
public List<Integer> l;
|
||||
public List<List<List<Integer>>> ll;
|
||||
public List<List<CSharpObjectA>> lll;
|
||||
public List<String> llll;
|
||||
public List<Map<Integer, String>> lllll;
|
||||
|
||||
public Map<Integer, String> m;
|
||||
public Map<Integer, CSharpObjectA> mm;
|
||||
public Map<CSharpObjectA, List<Integer>> mmm;
|
||||
public Map<List<List<CSharpObjectA>>, List<List<List<Integer>>>> mmmm;
|
||||
|
||||
public Set<Integer> s;
|
||||
public Set<Set<List<Integer>>> ss;
|
||||
public Set<Set<CSharpObjectA>> sss;
|
||||
public Set<String> ssss;
|
||||
/**
|
||||
* 注释z
|
||||
* 附加注释
|
||||
*/
|
||||
public Set<Map<Integer, String>> sssss;
|
||||
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2020 The zfoo Authors
|
||||
*
|
||||
* 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 com.zfoo.net.packet.csharp;
|
||||
|
||||
import com.zfoo.protocol.anno.Protocol;
|
||||
|
||||
/**
|
||||
* @author godotg
|
||||
*/
|
||||
@Protocol(id = 1166)
|
||||
public class CSharpObjectA {
|
||||
|
||||
public int value;
|
||||
public CSharpObjectB objectB;
|
||||
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2020 The zfoo Authors
|
||||
*
|
||||
* 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 com.zfoo.net.packet.csharp;
|
||||
|
||||
import com.zfoo.protocol.anno.Protocol;
|
||||
|
||||
/**
|
||||
* @author godotg
|
||||
*/
|
||||
@Protocol(id = 1167)
|
||||
public class CSharpObjectB {
|
||||
|
||||
public boolean flag;
|
||||
|
||||
}
|
||||
@@ -53,9 +53,6 @@ public class WebSocketPacketRequest {
|
||||
private double[] fff;
|
||||
private Double[] ffff;
|
||||
|
||||
private char g;
|
||||
private char[] gg;
|
||||
private List<Character> ggg;
|
||||
|
||||
private String jj;
|
||||
private String[] jjj;
|
||||
@@ -256,30 +253,6 @@ public class WebSocketPacketRequest {
|
||||
this.ffff = ffff;
|
||||
}
|
||||
|
||||
public char getG() {
|
||||
return g;
|
||||
}
|
||||
|
||||
public void setG(char g) {
|
||||
this.g = g;
|
||||
}
|
||||
|
||||
public char[] getGg() {
|
||||
return gg;
|
||||
}
|
||||
|
||||
public void setGg(char[] gg) {
|
||||
this.gg = gg;
|
||||
}
|
||||
|
||||
public List<Character> getGgg() {
|
||||
return ggg;
|
||||
}
|
||||
|
||||
public void setGgg(List<Character> ggg) {
|
||||
this.ggg = ggg;
|
||||
}
|
||||
|
||||
public String getJj() {
|
||||
return jj;
|
||||
}
|
||||
|
||||
@@ -56,10 +56,6 @@
|
||||
<protocol id="1152" location="com.zfoo.net.packet.tcp.AsyncMessAsk" enhance="false"/>
|
||||
<protocol id="1153" location="com.zfoo.net.packet.tcp.AsyncMessAnswer" enhance="false"/>
|
||||
|
||||
<protocol id="1165" location="com.zfoo.net.packet.csharp.CM_CSharpRequest" enhance="false"/>
|
||||
<protocol id="1166" location="com.zfoo.net.packet.csharp.CSharpObjectA" enhance="false"/>
|
||||
<protocol id="1167" location="com.zfoo.net.packet.csharp.CSharpObjectB" enhance="false"/>
|
||||
|
||||
<protocol id="1200" location="com.zfoo.net.packet.udp.UdpHelloRequest"/>
|
||||
<protocol id="1201" location="com.zfoo.net.packet.udp.UdpHelloResponse"/>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user