Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
876a540
fix jmockit version
NeatGuyCoding Aug 14, 2025
aa6c020
add test containers based tests for store associated services
NeatGuyCoding Aug 14, 2025
6a82299
enable unit tests
NeatGuyCoding Aug 14, 2025
a7eb945
Merge remote-tracking branch 'mine/fix-maven-agent-version' into add-…
NeatGuyCoding Aug 14, 2025
43e982d
fix module export
NeatGuyCoding Aug 14, 2025
6776297
fix module export within store
NeatGuyCoding Aug 14, 2025
cd90cf3
fix unit tests for latest protocol v4
NeatGuyCoding Aug 14, 2025
e44099d
add more tests unit tests for latest protocol v4
NeatGuyCoding Aug 15, 2025
11ab9f3
add native client packet decoding test
NeatGuyCoding Aug 17, 2025
070fe7b
fix and improve native client packet decoding test
NeatGuyCoding Aug 20, 2025
de571e7
upgrade to junit 5
NeatGuyCoding Aug 20, 2025
4bd4aeb
fix license
NeatGuyCoding Aug 23, 2025
0103d99
enable and fix checkstyle problems
NeatGuyCoding Aug 23, 2025
59be594
enable and fix checkstyle problems
NeatGuyCoding Aug 23, 2025
caee9b0
add import order within checkstyle and fix
NeatGuyCoding Aug 23, 2025
f8dea71
fix unit tests after checkstyle improvement
NeatGuyCoding Aug 23, 2025
77b5c26
add unit tests for annotation related
NeatGuyCoding Aug 23, 2025
4b388a4
add unit tests for namespace related
NeatGuyCoding Aug 23, 2025
290c4c1
add unit tests for namespace related (license)
NeatGuyCoding Aug 23, 2025
5dc1b8e
Merge branch 'add-tests-for-annotation-0823' into add-tests-for-names…
NeatGuyCoding Aug 23, 2025
5c1caf9
add unit tests for namespace related (license)
NeatGuyCoding Aug 23, 2025
6d4e412
add unit tests for ScannerEngine
NeatGuyCoding Aug 23, 2025
138f809
add unit tests for AuthorizeHandler and debug logs
NeatGuyCoding Aug 24, 2025
6f1fcd9
improve unit tests for AuthorizeHandler
NeatGuyCoding Aug 24, 2025
2242f5d
add license header, fix checkstyle, and use awaitility for unit tests…
NeatGuyCoding Aug 24, 2025
d760b23
add unit tests for EncoderHandler
NeatGuyCoding Aug 24, 2025
6389198
add debug logs for EncoderHandler
NeatGuyCoding Aug 24, 2025
e396784
add debug logs for EncoderHandler
NeatGuyCoding Aug 24, 2025
bb5f0fc
add license header, fix checkstyle, and use awaitility for unit tests…
NeatGuyCoding Aug 24, 2025
2dd46f0
add license header, fix checkstyle, and use awaitility for unit tests…
NeatGuyCoding Aug 25, 2025
770be3f
add unit tests for PacketListenerTest
NeatGuyCoding Aug 27, 2025
567f8fc
add unit tests for schedulers
NeatGuyCoding Aug 27, 2025
b5e6a3e
add integration tests for netty-socketio based on native socketio client
NeatGuyCoding Sep 1, 2025
ead123c
reformat integration tests for netty-socketio, add tests for Ack Call…
NeatGuyCoding Sep 3, 2025
4e9b12b
reformat integration tests for netty-socketio, add tests for Ack Call…
NeatGuyCoding Sep 3, 2025
0492881
reformat integration tests for netty-socketio, and use java faker for…
NeatGuyCoding Sep 13, 2025
7fdba70
remove deprecated init of mocks and change log level
NeatGuyCoding Sep 13, 2025
99bdc37
upgrade bytebuddy and disable forks
NeatGuyCoding Sep 13, 2025
5821662
Update src/test/java/com/corundumstudio/socketio/store/pubsub/Abstrac…
NeatGuyCoding Sep 13, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions checkstyle.xml
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,19 @@

<!-- Checks for imports -->
<!-- See http://checkstyle.sf.net/config_import.html -->
<!--module name="AvoidStarImport"/-->
<module name="AvoidStarImport"/>
<module name="IllegalImport"/>
<!-- defaults to sun.* packages -->
<module name="RedundantImport"/>
<module name="UnusedImports"/>

<module name="ImportOrder">
<property name="groups" value="java,javax,org,com"/>
<property name="ordered" value="true"/>
<property name="separated" value="true"/>
<property name="caseSensitive" value="true"/>
<!-- 支持静态导入排序 -->
<property name="option" value="bottom"/>
<property name="sortStaticImportsAlphabetically" value="true"/>
</module>

<!-- Checks for Size Violations. -->
<!-- See http://checkstyle.sf.net/config_sizes.html -->
Expand Down
2 changes: 1 addition & 1 deletion header.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2012-2023 Nikita Koksharov
Copyright (c) 2012-2025 Nikita Koksharov

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
104 changes: 95 additions & 9 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,10 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<skipTests>true</skipTests>
<skipTests>false</skipTests>
<netty.version>4.1.119.Final</netty.version>
<jmockit.version>1.49</jmockit.version>
<byte-buddy.version>1.14.13</byte-buddy.version>
</properties>

<profiles>
Expand Down Expand Up @@ -174,13 +176,30 @@
<dependency>
<groupId>org.jmockit</groupId>
<artifactId>jmockit</artifactId>
<version>1.49</version>
<version>${jmockit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.2</version>
<groupId>net.bytebuddy</groupId>
<artifactId>byte-buddy-agent</artifactId>
<version>${byte-buddy.version}</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>5.10.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<version>5.10.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-launcher</artifactId>
<version>1.10.1</version>
<scope>test</scope>
</dependency>

Expand Down Expand Up @@ -234,8 +253,66 @@
<version>3.12.12</version>
<scope>provided</scope>
</dependency>

<!-- Test dependencies -->
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>testcontainers</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.awaitility</groupId>
<artifactId>awaitility</artifactId>
<version>4.2.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>3.24.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>5.7.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.4.11</version>
<scope>test</scope>
</dependency>

<!-- Socket.IO client for testing -->
<dependency>
<groupId>io.socket</groupId>
<artifactId>socket.io-client</artifactId>
<version>2.1.0</version>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/com.github.javafaker/javafaker -->
<dependency>
<groupId>com.github.javafaker</groupId>
<artifactId>javafaker</artifactId>
<version>1.0.2</version>
<scope>test</scope>
</dependency>
</dependencies>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>testcontainers-bom</artifactId>
<version>1.21.3</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>


<build>
<plugins>
Expand Down Expand Up @@ -320,12 +397,11 @@
<configuration>
<linkXref>true</linkXref>
<minimumTokens>100</minimumTokens>
<targetJdk>1.6</targetJdk>
<targetJdk>1.8</targetJdk>
<verbose>true</verbose>
</configuration>
</plugin>

<!--
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
Expand All @@ -345,7 +421,6 @@
<excludes>**/module-info.java</excludes>
</configuration>
</plugin>
-->

<plugin>
<!-- this trick double-compiles everything so we can have a module-info.class
Expand Down Expand Up @@ -411,8 +486,19 @@
<version>3.2.5</version>
<configuration>
<argLine>
-javaagent:"${settings.localRepository}"/org/jmockit/jmockit/1.46/jmockit-1.46.jar
-javaagent:"${settings.localRepository}"/org/jmockit/jmockit/${jmockit.version}/jmockit-${jmockit.version}.jar
-javaagent:"${settings.localRepository}"/net/bytebuddy/byte-buddy-agent/${byte-buddy.version}/byte-buddy-agent-${byte-buddy.version}.jar
--add-opens netty.socketio/com.corundumstudio.socketio.store.pubsub=ALL-UNNAMED
--add-opens netty.socketio/com.corundumstudio.socketio.store=ALL-UNNAMED
--add-opens netty.socketio/com.corundumstudio.socketio.store.pubsub=redisson
--add-opens netty.socketio/com.corundumstudio.socketio.store=redisson
</argLine>
<includes>
<include>**/*Test.java</include>
<include>**/*Tests.java</include>
</includes>
<forkCount>1</forkCount>
<reuseForks>false</reuseForks>
</configuration>
</plugin>

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/corundumstudio/socketio/AckCallback.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2012-2023 Nikita Koksharov
* Copyright (c) 2012-2025 Nikita Koksharov
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/corundumstudio/socketio/AckMode.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2012-2023 Nikita Koksharov
* Copyright (c) 2012-2025 Nikita Koksharov
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/corundumstudio/socketio/AckRequest.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2012-2023 Nikita Koksharov
* Copyright (c) 2012-2025 Nikita Koksharov
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -64,7 +64,7 @@ public boolean isAckRequested() {
*
* @param objs - ack data objects
*/
public void sendAckData(Object ... objs) {
public void sendAckData(Object... objs) {
List<Object> args = Arrays.asList(objs);
sendAckData(args);
}
Expand Down
15 changes: 15 additions & 0 deletions src/main/java/com/corundumstudio/socketio/AuthTokenListener.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
/**
* Copyright (c) 2012-2025 Nikita Koksharov
*
* 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.corundumstudio.socketio;

/**
Expand Down
17 changes: 16 additions & 1 deletion src/main/java/com/corundumstudio/socketio/AuthTokenResult.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
/**
* Copyright (c) 2012-2025 Nikita Koksharov
*
* 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.corundumstudio.socketio;

/**
Expand All @@ -18,7 +33,7 @@

public class AuthTokenResult {

public final static AuthTokenResult AuthTokenResultSuccess = new AuthTokenResult(true, null);
public static final AuthTokenResult AUTH_TOKEN_RESULT_SUCCESS = new AuthTokenResult(true, null);
private final boolean success;
private final Object errorData;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2012-2023 Nikita Koksharov
* Copyright (c) 2012-2025 Nikita Koksharov
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -19,7 +19,7 @@ public interface AuthorizationListener {

/**
* Checks whether a client with handshake data is authorized on connection
* Optionally returns storeParams that will be added to {@link SocketIOClient} store
* Optionally returns storeParams that will be added to {@link SocketIOClient} store
*
* @param data handshake data
* @return - {@link AuthorizationResult}
Expand Down
57 changes: 30 additions & 27 deletions src/main/java/com/corundumstudio/socketio/AuthorizationResult.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2012-2023 Nikita Koksharov
* Copyright (c) 2012-2025 Nikita Koksharov
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -20,34 +20,37 @@

public class AuthorizationResult {

public static final AuthorizationResult SUCCESSFUL_AUTHORIZATION = new AuthorizationResult(true);
public static final AuthorizationResult FAILED_AUTHORIZATION = new AuthorizationResult(false);
private final boolean isAuthorized;
private final Map<String, Object> storeParams;
public static final AuthorizationResult SUCCESSFUL_AUTHORIZATION = new AuthorizationResult(true);
public static final AuthorizationResult FAILED_AUTHORIZATION = new AuthorizationResult(false);
private final boolean isAuthorized;
private final Map<String, Object> storeParams;

public AuthorizationResult(boolean isAuthorized) {
this.isAuthorized = isAuthorized;
this.storeParams = Collections.emptyMap();
}
public AuthorizationResult(boolean isAuthorized) {
this.isAuthorized = isAuthorized;
this.storeParams = Collections.emptyMap();
}

public AuthorizationResult(boolean isAuthorized, Map<String, Object> storeParams) {
this.isAuthorized = isAuthorized;
this.storeParams = isAuthorized && storeParams != null ?
Collections.unmodifiableMap(storeParams) : Collections.emptyMap();
}
public AuthorizationResult(boolean isAuthorized, Map<String, Object> storeParams) {
this.isAuthorized = isAuthorized;
if (isAuthorized && storeParams != null) {
this.storeParams = Collections.unmodifiableMap(storeParams);
} else {
this.storeParams = Collections.emptyMap();
}
}

/**
* @return <b>true</b> if a client is authorized, otherwise - <b>false</b>
* */
public boolean isAuthorized() {
return isAuthorized;
}
/**
* @return <b>true</b> if a client is authorized, otherwise - <b>false</b>
* */
public boolean isAuthorized() {
return isAuthorized;
}

/**
* @return key-value pairs (unmodifiable) that will be added to {@link SocketIOClient } store.
* If a client is not authorized, storeParams will always be ignored (empty map)
* */
public Map<String, Object> getStoreParams() {
return storeParams;
}
/**
* @return key-value pairs (unmodifiable) that will be added to {@link SocketIOClient } store.
* If a client is not authorized, storeParams will always be ignored (empty map)
* */
public Map<String, Object> getStoreParams() {
return storeParams;
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2012-2023 Nikita Koksharov
* Copyright (c) 2012-2025 Nikita Koksharov
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2012-2023 Nikita Koksharov
* Copyright (c) 2012-2025 Nikita Koksharov
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -15,11 +15,11 @@
*/
package com.corundumstudio.socketio;

import com.corundumstudio.socketio.protocol.Packet;

import java.util.Collection;
import java.util.function.Predicate;

import com.corundumstudio.socketio.protocol.Packet;

/**
* broadcast interface
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2012-2023 Nikita Koksharov
* Copyright (c) 2012-2025 Nikita Koksharov
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -44,6 +44,6 @@ public interface ClientOperations {
* @param name - event name
* @param data - event data
*/
void sendEvent(String name, Object ... data);
void sendEvent(String name, Object... data);

}
Loading