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
import org.jboss.netty.channel.ChannelHandlerContext; | |
import org.jboss.netty.channel.ExceptionEvent; | |
import org.jboss.netty.channel.SimpleChannelUpstreamHandler; | |
public class Logger extends SimpleChannelUpstreamHandler{ | |
@Override | |
public void exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent e) throws Exception { | |
// HERE you need to add the logger |
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
public AsyncCommandImpl implements AsyncCommand { | |
public void onCommand(SMTPSession session, SMTPRequest req, SMTPServerResponseCallback callback) { | |
.... | |
.... | |
smtpClientSession.write(new SMTPRequest(...), new SMTPResponseCallback() { | |
public void onResponse(SMTPResponse resp) { | |
callback.onSMTPServerResponse(new SMTPResponse(resp)); | |
} |
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
public interface AsyncCommandHandler extends AsyncProtocolHandler { | |
public void onCommand(SMTPSession session, SMTPRequest request, SMTPResponseCallback callback); | |
} | |
public class AsyncCommandHandlerAdapter implements AsyncCommandHandler { | |
public AsyncCommandHandlerAdapter(CommandHandler handler) { | |
this.handler = handler; | |
} |
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
public class Gps103ProtocolEncoder extends OneToOneEncoder { | |
private static final Charset CHARSET = CharsetUtil.US_ASCII; | |
private static final byte[] TURN_ON_COMAND = ",K".getBytes(CHARSET); | |
private static final byte[] TURN_OFF_COMAND = ",J".getBytes(CHARSET); | |
private static final byte[] IMEI_PREFIX = "**,imei:".getBytes(CHARSET); | |
@Override | |
protected Object encode(ChannelHandlerContext ctx, Channel channel, |
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
package me.normanmaurer.niosmtp; | |
import java.io.ByteArrayInputStream; | |
import java.io.IOException; | |
import java.io.InputStream; | |
import java.net.InetSocketAddress; | |
import java.util.Arrays; | |
import java.util.concurrent.CountDownLatch; | |
import java.util.concurrent.ExecutionException; | |
import java.util.concurrent.Semaphore; |
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
public interface ChannelFuture extends Future<ChannelFutureResult>{ | |
/** | |
* Returns a channel where the I/O operation associated with this | |
* future takes place. | |
*/ | |
Channel getChannel(); | |
/** | |
* Returns {@code true} if and only if the I/O operation was completed |
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
public class SctpSocketAddress extends SocketAddress{ | |
public Set<InetSocketAddress> getAddresses() { | |
Set<InetSocketAddress> addresses = new HashSet<SocketAddress>(); | |
// add addresses on the fly | |
return addresses; | |
} | |
} |
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
diff --git a/src/main/java/org/vertx/java/core/http/impl/DefaultHttpServer.java b/src/main/java/org/vertx/java/core/http/impl/DefaultHttpServer.java | |
index 6806e19..204b126 100644 | |
--- a/src/main/java/org/vertx/java/core/http/impl/DefaultHttpServer.java | |
+++ b/src/main/java/org/vertx/java/core/http/impl/DefaultHttpServer.java | |
@@ -28,6 +28,7 @@ import org.jboss.netty.channel.ChannelState; | |
import org.jboss.netty.channel.ChannelStateEvent; | |
import org.jboss.netty.channel.Channels; | |
import org.jboss.netty.channel.ExceptionEvent; | |
+import org.jboss.netty.channel.FixedReceiveBufferSizePredictor; | |
import org.jboss.netty.channel.MessageEvent; |
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
package org.jboss.netty.example.local; | |
import java.util.concurrent.Executors; | |
import org.jboss.netty.bootstrap.ConnectionlessBootstrap; | |
import org.jboss.netty.channel.ChannelDownstreamHandler; | |
import org.jboss.netty.channel.ChannelEvent; | |
import org.jboss.netty.channel.ChannelHandlerContext; | |
import org.jboss.netty.channel.ChannelPipeline; | |
import org.jboss.netty.channel.ChannelPipelineFactory; |
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
import java.io.IOException; | |
import java.io.ObjectInputStream; | |
import java.net.InetSocketAddress; | |
import java.net.ServerSocket; | |
import java.net.Socket; | |
import java.util.concurrent.CountDownLatch; | |
public class Server { | |
final CountDownLatch latch = new CountDownLatch(1); |
OlderNewer