Skip to content

Commit

Permalink
2.0.23
Browse files Browse the repository at this point in the history
  • Loading branch information
noear committed Nov 28, 2023
1 parent 7f9ada4 commit 9dd0a13
Show file tree
Hide file tree
Showing 15 changed files with 137 additions and 13 deletions.
2 changes: 1 addition & 1 deletion _docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<dependency>
<groupId>org.noear</groupId>
<artifactId>socketd-transport-java-tcp</artifactId>
<version>2.0.22</version>
<version>2.0.23</version>
</dependency>
```

Expand Down
3 changes: 3 additions & 0 deletions java/LOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@

### 2.0.23
* 修复 用 bytes 传时自动分片失败的问题

### 2.0.22
* 优化 答复接收器管理策略(可:断连,不断流)
* 取消 原限流处理,交由用户层面控制
Expand Down
2 changes: 1 addition & 1 deletion java/socketd-examples/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>org.noear</groupId>
<artifactId>socketd-parent</artifactId>
<version>2.0.22</version>
<version>2.0.23</version>
<relativePath>../socketd-parent/pom.xml</relativePath>
</parent>

Expand Down
4 changes: 2 additions & 2 deletions java/socketd-parent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>org.noear</groupId>
<artifactId>socketd-parent</artifactId>
<version>2.0.22</version>
<version>2.0.23</version>
<packaging>pom</packaging>

<name>${project.artifactId}</name>
Expand All @@ -18,7 +18,7 @@
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>

<socketd.version>2.0.22</socketd.version>
<socketd.version>2.0.23</socketd.version>

<slf4j.version>2.0.9</slf4j.version>
<junit5.version>5.9.1</junit5.version>
Expand Down
2 changes: 1 addition & 1 deletion java/socketd-transport-test/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>org.noear</groupId>
<artifactId>socketd-parent</artifactId>
<version>2.0.22</version>
<version>2.0.23</version>
<relativePath>../socketd-parent/pom.xml</relativePath>
</parent>

Expand Down
21 changes: 21 additions & 0 deletions java/socketd-transport-test/src/test/java/features/CaseTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -243,4 +243,25 @@ public void TestCase24_bigFile_1g() throws Exception {
}
}
}

@Test
public void TestCase25_bigString() throws Exception {
for (int i = 0; i < schemas.length; i++) {
String s1 = schemas[i];

if("sd:udp-java".equals(s1)){
continue;
}

BaseTestCase testCase = new TestCase25_bigString(s1, 2400 + i);
try {
testCase.start();
testCase.stop();
} catch (Exception e) {
testCase.onError();
e.printStackTrace();
assert false;
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
package features.cases;

import org.junit.jupiter.api.Assertions;
import org.noear.socketd.SocketD;
import org.noear.socketd.transport.core.EntityMetas;
import org.noear.socketd.transport.core.Message;
import org.noear.socketd.transport.core.Session;
import org.noear.socketd.transport.core.entity.FileEntity;
import org.noear.socketd.transport.core.entity.StringEntity;
import org.noear.socketd.transport.core.listener.SimpleListener;
import org.noear.socketd.transport.server.Server;
import org.noear.socketd.utils.IoUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.atomic.AtomicInteger;

/**
* sendAndRequest() 超时
*
* @author noear
* @since 2.0
*/
public class TestCase25_bigString extends BaseTestCase {
private static Logger log = LoggerFactory.getLogger(TestCase25_bigString.class);

public TestCase25_bigString(String schema, int port) {
super(schema, port);
}

private Server server;
private Session clientSession;

private AtomicInteger messageCounter = new AtomicInteger();

@Override
public void start() throws Exception {
log.trace("...");

CountDownLatch countDownLatch = new CountDownLatch(1);

super.start();
//server
server = SocketD.createServer(getSchema())
.config(c -> c.port(getPort()))
.listen(new SimpleListener() {
@Override
public void onMessage(Session session, Message message) throws IOException {
System.out.println("::" + message);
messageCounter.incrementAndGet();

countDownLatch.countDown();
}
})
.start();

//休息下,启动可能要等会儿
Thread.sleep(1000);


//client
String serverUrl = getSchema() + "://127.0.0.1:" + getPort() + "/path?u=a&p=2";
clientSession = SocketD.createClient(serverUrl).open();

StringBuilder bigStr = new StringBuilder();
int bigSize = 1024*1024 * 30;
while (bigStr.length() < bigSize){
bigStr.append("qwertyuiopasdfghjklzxcvbnmlajofiadsf");
}

clientSession.send("/user/upload", new StringEntity(bigStr.toString()));


countDownLatch.await();

Thread.sleep(1000);

System.out.println("counter: " + messageCounter.get());
Assertions.assertEquals(messageCounter.get(), 1, getSchema() + ":server 收的消息数量对不上");

}

@Override
public void stop() throws Exception {
if (clientSession != null) {
clientSession.close();
}

if (server != null) {
server.stop();
}

super.stop();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public class DebugTest {
*/
public static void main(String[] args) throws Exception {
String s1 = schemas[2];
BaseTestCase testCase = new TestCase24_bigFile_1g(s1, 2100);
BaseTestCase testCase = new TestCase25_bigString(s1, 2100);
try {
testCase.start();
testCase.stop();
Expand Down
2 changes: 1 addition & 1 deletion java/socketd-transport/socketd-transport-aeron/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>org.noear</groupId>
<artifactId>socketd-parent</artifactId>
<version>2.0.22</version>
<version>2.0.23</version>
<relativePath>../../socketd-parent/pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion java/socketd-transport/socketd-transport-java-tcp/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>org.noear</groupId>
<artifactId>socketd-parent</artifactId>
<version>2.0.22</version>
<version>2.0.23</version>
<relativePath>../../socketd-parent/pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion java/socketd-transport/socketd-transport-java-udp/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.noear</groupId>
<artifactId>socketd-parent</artifactId>
<version>2.0.22</version>
<version>2.0.23</version>
<relativePath>../../socketd-parent/pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>org.noear</groupId>
<artifactId>socketd-parent</artifactId>
<version>2.0.22</version>
<version>2.0.23</version>
<relativePath>../../socketd-parent/pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion java/socketd-transport/socketd-transport-netty/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>org.noear</groupId>
<artifactId>socketd-parent</artifactId>
<version>2.0.22</version>
<version>2.0.23</version>
<relativePath>../../socketd-parent/pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>org.noear</groupId>
<artifactId>socketd-parent</artifactId>
<version>2.0.22</version>
<version>2.0.23</version>
<relativePath>../../socketd-parent/pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion java/socketd/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>org.noear</groupId>
<artifactId>socketd-parent</artifactId>
<version>2.0.22</version>
<version>2.0.23</version>
<relativePath>../socketd-parent/pom.xml</relativePath>
</parent>

Expand Down

0 comments on commit 9dd0a13

Please sign in to comment.