-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
137 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
|
||
### 2.0.23 | ||
* 修复 用 bytes 传时自动分片失败的问题 | ||
|
||
### 2.0.22 | ||
* 优化 答复接收器管理策略(可:断连,不断流) | ||
* 取消 原限流处理,交由用户层面控制 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
100 changes: 100 additions & 0 deletions
100
java/socketd-transport-test/src/test/java/features/cases/TestCase25_bigString.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters