SncpClient优化
This commit is contained in:
@@ -49,11 +49,11 @@ public class SncpClientCodecTest {
|
||||
SncpHeader header = new SncpHeader(sncpAddress, Uint128.ZERO, Uint128.ZERO);
|
||||
SncpClientRequest request = new SncpClientRequest();
|
||||
ByteArray writeArray = new ByteArray();
|
||||
request.prepare(header, 1, "", new ByteArray().putPlaceholder(20));
|
||||
request.prepare(header, 1, "", new byte[20]);
|
||||
System.out.println("request.1 = " + request);
|
||||
writeArray.put(new byte[SncpHeader.HEADER_SIZE]);
|
||||
request.writeTo(conn, writeArray);
|
||||
request.prepare(header, 2, "", new ByteArray().putPlaceholder(25));
|
||||
request.prepare(header, 2, "", new byte[25]);
|
||||
System.out.println("request.2 = " + request);
|
||||
writeArray.put(new byte[SncpHeader.HEADER_SIZE]);
|
||||
request.writeTo(conn, writeArray);
|
||||
|
||||
@@ -28,7 +28,7 @@ public class SncpTest {
|
||||
|
||||
private static int port2 = 4240;
|
||||
|
||||
private static final String protocol = "SNCP.UDP";
|
||||
private static final String protocol = "SNCP.TCP"; // TCP UDP
|
||||
|
||||
private static final int clientCapacity = protocol.endsWith(".UDP") ? AsyncGroup.UDP_BUFFER_CAPACITY : 8192;
|
||||
|
||||
@@ -91,7 +91,7 @@ public class SncpTest {
|
||||
System.out.println("bean: " + callbean);
|
||||
System.out.println("\r\n\r\n\r\n\r\n---------------------------------------------------");
|
||||
Thread.sleep(200);
|
||||
final int count = 10;
|
||||
final int count = 40;
|
||||
final CountDownLatch cld = new CountDownLatch(count);
|
||||
final AtomicInteger ai = new AtomicInteger();
|
||||
long s = System.currentTimeMillis();
|
||||
|
||||
@@ -33,7 +33,7 @@ public class SncpTestServiceImpl implements SncpTestIService {
|
||||
try {
|
||||
Thread.sleep(200);
|
||||
System.out.println(Thread.currentThread().getName() + " sleep 200ms后运行了异步方法-----------queryResultAsync方法");
|
||||
future.complete("异步result: " + bean);
|
||||
future.complete("异步 result: " + bean);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user