Ported library to Netty 4.1.4 (Netty 5 has been discontinued) by modifying TcpSession.java and pom.xml. Fixed a bug in Server.java where isListening() would throw a NullPointerException if called before bind(). Removed unused imports of java.net.InetAddress in Session.java and TcpSession.java. Updated Maven plugin versions in pom.xml.

This commit is contained in:
Kevin Rossouw 2017-01-25 16:47:00 +02:00
parent b5bfe24517
commit cc4d9869bb
4 changed files with 13 additions and 13 deletions

20
pom.xml
View file

@ -65,7 +65,7 @@
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-all</artifactId>
<version>5.0.0.Alpha2</version>
<version>4.1.4.Final</version>
</dependency>
</dependencies>
@ -76,20 +76,21 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.5.1</version>
<version>3.6.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.6</version>
<version>3.0.2</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<artifactId>maven-source-plugin</artifactId>
<version>3.0.1</version>
<executions>
<execution>
<id>attach-sources</id>
@ -100,8 +101,9 @@
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.10.4</version>
<executions>
<execution>
<id>attach-javadocs</id>
@ -114,7 +116,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.4.1</version>
<version>2.4.3</version>
<executions>
<execution>
<phase>package</phase>

View file

@ -242,7 +242,7 @@ public class Server {
* @return Whether the server is listening.
*/
public boolean isListening() {
return this.listener.isListening();
return this.listener != null && this.listener.isListening();
}
/**

View file

@ -5,7 +5,6 @@ import org.spacehq.packetlib.event.session.SessionListener;
import org.spacehq.packetlib.packet.Packet;
import org.spacehq.packetlib.packet.PacketProtocol;
import java.net.InetAddress;
import java.net.SocketAddress;
import java.util.List;
import java.util.Map;

View file

@ -22,7 +22,6 @@ import org.spacehq.packetlib.packet.Packet;
import org.spacehq.packetlib.packet.PacketProtocol;
import java.net.ConnectException;
import java.net.InetAddress;
import java.net.SocketAddress;
import java.util.ArrayList;
import java.util.HashMap;
@ -371,7 +370,7 @@ public abstract class TcpSession extends SimpleChannelInboundHandler<Packet> imp
}
@Override
protected void messageReceived(ChannelHandlerContext ctx, Packet packet) throws Exception {
protected void channelRead0(ChannelHandlerContext ctx, Packet packet) throws Exception {
if(!packet.isPriority()) {
this.packets.add(packet);
}