use of org.apache.activemq.command.WireFormatInfo in project activemq-artemis by apache.
the class WireFormatInfoTest method populateObject.
@Override
protected void populateObject(Object object) throws Exception {
super.populateObject(object);
WireFormatInfo info = (WireFormatInfo) object;
info.setVersion(1);
{
byte[] data = "MarshalledProperties:1".getBytes();
info.setMarshalledProperties(new org.apache.activemq.util.ByteSequence(data, 0, data.length));
}
}
use of org.apache.activemq.command.WireFormatInfo in project activemq-artemis by apache.
the class WireFormatInfoData method createObject.
@Override
protected Object createObject() throws IOException {
WireFormatInfo rc = new WireFormatInfo();
rc.setResponseRequired(false);
rc.setCacheEnabled(true);
rc.setVersion(1);
return rc;
}
use of org.apache.activemq.command.WireFormatInfo in project activemq-artemis by apache.
the class OpenWireConnection method reconnect.
// raise the refCount of context
public void reconnect(AMQConnectionContext existingContext, ConnectionInfo info) {
this.context = existingContext;
WireFormatInfo wireFormatInfo = inWireFormat.getPreferedWireFormatInfo();
// they were not.
if (wireFormatInfo != null && wireFormatInfo.getVersion() <= 2) {
info.setClientMaster(true);
}
if (info.getClientIp() == null) {
info.setClientIp(getRemoteAddress());
}
state = new ConnectionState(info);
state.reset(info);
context.setConnection(this);
context.setConnectionState(state);
context.setClientMaster(info.isClientMaster());
context.setFaultTolerant(info.isFaultTolerant());
context.setReconnect(true);
context.incRefCount();
}
use of org.apache.activemq.command.WireFormatInfo in project activemq-artemis by apache.
the class WireFormatInfoTest method createObject.
@Override
public Object createObject() throws Exception {
WireFormatInfo info = new WireFormatInfo();
populateObject(info);
return info;
}
use of org.apache.activemq.command.WireFormatInfo in project activemq-artemis by apache.
the class WireformatNegociationTest method startServer.
/**
* @throws IOException
* @throws URISyntaxException
* @throws Exception
*/
private void startServer(String uri) throws IOException, URISyntaxException, Exception {
server = TransportFactory.bind(new URI(uri));
server.setAcceptListener(new TransportAcceptListener() {
@Override
public void onAccept(Transport transport) {
try {
LOG.info("[" + getName() + "] Server Accepted a Connection");
serverTransport = transport;
serverTransport.setTransportListener(new TransportListener() {
@Override
public void onCommand(Object command) {
if (command instanceof WireFormatInfo) {
serverWF.set((WireFormatInfo) command);
negotiationCounter.countDown();
}
}
@Override
public void onException(IOException error) {
if (!ignoreAsycError.get()) {
LOG.info("Server transport error: ", error);
asyncError.set(error);
negotiationCounter.countDown();
}
}
@Override
public void transportInterupted() {
}
@Override
public void transportResumed() {
}
});
serverTransport.start();
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
public void onAcceptError(Exception error) {
error.printStackTrace();
}
});
server.start();
}
Aggregations