public void handleMessage(Channel channel, MessageInputStream messageInputStream) { DataInputStream dis = new DataInputStream(messageInputStream); try { log.tracef("Bytes Available %d", dis.available()); byte[] firstThree = new byte[3]; dis.read(firstThree); log.tracef("First Three %s", new String(firstThree)); if (Arrays.equals(firstThree, "JMX".getBytes()) == false) { throw new IOException("Invalid leading bytes in header."); } log.tracef("Bytes Available %d", dis.available()); String connectionId = dis.readUTF(); future.setResult(connectionId); } catch (IOException e) { future.setException(e); } finally { IoUtils.safeClose(dis); } }
future.setResult(response); } catch (ClassCastException e) { future.setException(new IOException(e));
public void handleMessage(Channel channel, MessageInputStream messageInputStream) { DataInputStream dis = new DataInputStream(messageInputStream); try { log.tracef("Bytes Available %d", dis.available()); byte[] firstThree = new byte[3]; dis.read(firstThree); log.tracef("First Three %s", new String(firstThree)); if (Arrays.equals(firstThree, "JMX".getBytes()) == false) { throw new IOException("Invalid leading bytes in header."); } log.tracef("Bytes Available %d", dis.available()); String connectionId = dis.readUTF(); future.setResult(connectionId); } catch (IOException e) { future.setException(e); } finally { IoUtils.safeClose(dis); } }
public void handleMessage(Channel channel, MessageInputStream messageInputStream) { DataInputStream dis = new DataInputStream(messageInputStream); try { log.tracef("Bytes Available %d", dis.available()); byte[] firstThree = new byte[3]; dis.read(firstThree); log.tracef("First Three %s", new String(firstThree)); if (Arrays.equals(firstThree, "JMX".getBytes()) == false) { throw new IOException("Invalid leading bytes in header."); } log.tracef("Bytes Available %d", dis.available()); String connectionId = dis.readUTF(); future.setResult(connectionId); } catch (IOException e) { future.setException(e); } finally { IoUtils.safeClose(dis); } }
future.setResult(response); } catch (ClassCastException e) { future.setException(new IOException(e));
future.setResult(response); } catch (ClassCastException e) { future.setException(new IOException(e));