use of com.cloudhopper.smpp.type.RecoverablePduException in project load-balancer by RestComm.
the class ClientConnectionImpl method sendUnbindRequest.
@Override
public void sendUnbindRequest(Pdu packet) {
Integer currSequence = lastSequenceNumberSent.incrementAndGet();
sequenceMap.put(currSequence, packet.getSequenceNumber());
packet.setSequenceNumber(currSequence);
ChannelBuffer buffer = null;
try {
buffer = transcoder.encode(packet);
} catch (UnrecoverablePduException e) {
logger.error("Encode error: ", e);
} catch (RecoverablePduException e) {
logger.error("Encode error: ", e);
}
clientState = ClientState.UNBINDING;
if (logger.isDebugEnabled())
logger.debug("LB sent unbind request (" + packet + ") to " + channel.getRemoteAddress().toString() + ". sessionId : " + sessionId);
channel.write(buffer);
}
use of com.cloudhopper.smpp.type.RecoverablePduException in project load-balancer by RestComm.
the class ClientConnectionImpl method sendUnbindResponse.
@Override
public void sendUnbindResponse(Pdu packet) {
if (packetMap.containsKey(packet.getSequenceNumber())) {
TimerData data = packetMap.remove(packet.getSequenceNumber());
if (data != null) {
data.getRunnable().cancel();
data.getScheduledFuture().cancel(false);
}
}
ChannelBuffer buffer = null;
try {
buffer = transcoder.encode(packet);
} catch (UnrecoverablePduException e) {
logger.error("Encode error: ", e);
} catch (RecoverablePduException e) {
logger.error("Encode error: ", e);
}
clientState = ClientState.CLOSED;
sequenceMap.clear();
packetMap.clear();
if (logger.isDebugEnabled())
logger.debug("LB sent unbind response (" + packet + ") to " + channel.getRemoteAddress().toString() + ". sessionId : " + sessionId);
channel.write(buffer);
closeChannel();
}
use of com.cloudhopper.smpp.type.RecoverablePduException in project load-balancer by RestComm.
the class ClientConnectionImpl method sendSmppRequest.
@Override
public void sendSmppRequest(Pdu packet) {
Integer currSequence = lastSequenceNumberSent.incrementAndGet();
sequenceMap.put(currSequence, packet.getSequenceNumber());
packet.setSequenceNumber(currSequence);
ChannelBuffer buffer = null;
try {
buffer = transcoder.encode(packet);
} catch (UnrecoverablePduException e) {
logger.error("Encode error: ", e);
} catch (RecoverablePduException e) {
logger.error("Encode error: ", e);
}
if (logger.isDebugEnabled())
logger.debug("LB sent SMPP request (" + packet + ") to " + channel.getRemoteAddress().toString() + ". session ID : " + sessionId);
channel.write(buffer);
}
use of com.cloudhopper.smpp.type.RecoverablePduException in project load-balancer by RestComm.
the class ClientConnectionImpl method bind.
@SuppressWarnings("rawtypes")
@Override
public void bind() {
BaseBind packet = null;
if (config.getType() == SmppBindType.TRANSCEIVER)
packet = new BindTransceiver();
else if (config.getType() == SmppBindType.RECEIVER)
packet = new BindReceiver();
else if (config.getType() == SmppBindType.TRANSMITTER)
packet = new BindTransmitter();
packet.setSystemId(config.getSystemId());
packet.setPassword(config.getPassword());
packet.setSystemType(config.getSystemType());
packet.setInterfaceVersion(config.getInterfaceVersion());
packet.setAddressRange(config.getAddressRange());
packet.setSequenceNumber(lastSequenceNumberSent.incrementAndGet());
ChannelBuffer buffer = null;
try {
buffer = transcoder.encode(packet);
} catch (UnrecoverablePduException e) {
logger.error("Encode error: ", e);
} catch (RecoverablePduException e) {
logger.error("Encode error: ", e);
}
if (clientState != ClientState.REBINDING)
clientState = ClientState.BINDING;
if (logger.isDebugEnabled())
logger.debug("LB trying to bind to server " + config.getHost() + " " + config.getPort() + ": client state " + clientState);
channel.write(buffer);
}
use of com.cloudhopper.smpp.type.RecoverablePduException in project load-balancer by RestComm.
the class ClientConnectionImpl method sendSmppResponse.
@Override
public void sendSmppResponse(Pdu packet) {
if (packetMap.containsKey(packet.getSequenceNumber())) {
TimerData data = packetMap.remove(packet.getSequenceNumber());
if (data != null) {
data.getRunnable().cancel();
data.getScheduledFuture().cancel(false);
}
}
ChannelBuffer buffer = null;
try {
buffer = transcoder.encode(packet);
} catch (UnrecoverablePduException e) {
logger.error("Encode error: ", e);
} catch (RecoverablePduException e) {
logger.error("Encode error: ", e);
}
if (logger.isDebugEnabled())
logger.debug("LB sent SMPP response (" + packet + ") to " + channel.getRemoteAddress().toString() + ". sessionId : " + sessionId);
channel.write(buffer);
}
Aggregations