@Test public void testStreamReceive() throws Throwable { LogChannel logChannel = new LogChannel("testLogChannelHost", 100, new EuroPackager()); byte[] result = logChannel.streamReceive(); assertEquals(0, result.length, "result.length"); }
protected byte[] streamReceive() throws IOException { StringBuilder sb = new StringBuilder(); String realm = null; String at= null; int inMsg = 0; while (reader != null) { String s = reader.readLine(); if (s == null) throw new EOFException(); if ((timestampField > 0 || realmField > 0) && s.contains("<log") && s.contains("at=")) { Matcher matcher = logPattern.matcher(s); if (matcher.find() && matcher.groupCount() > 1) { if (realmField > 0) realm = matcher.group(1); if (timestampField > 0) at = matcher.group(2); } } if (s.contains("<isomsg")) { inMsg++; } if (s.contains("</isomsg>") && --inMsg == 0) { if (at != null || realm != null && inMsg == 0) { if (realm != null) { sb.append(" <field id=\"" + realmField + "\" value=\"" + realm + "\" />"); realm = null; } if (at != null) { sb.append(" <field id=\"" + timestampField + "\" value=\"" + at + "\" />"); } } sb.append (s); break; } if (inMsg > 0) sb.append (s); } return sb.toString().getBytes(); }
LogChannel extends BaseChannel { protected byte[] streamReceive() throws IOException { StringBuilder sb = new StringBuilder(); String realm = null; String at= null; int inMsg = 0; while (reader != null) { String s = reader.readLine(); if (s == null) throw new EOFException(); if ((timestampField > 0 || realmField > 0) && s.contains("<log") && s.contains("at=")) { Matcher matcher = logPattern.matcher(s); if (matcher.find() && matcher.groupCount() > 1) { if (realmField > 0) realm = matcher.group(1); if (timestampField > 0) at = matcher.group(2); } } if (s.contains("<isomsg")) { inMsg++; } if (s.contains("</isomsg>") && --inMsg == 0) { if (at != null || realm != null && inMsg == 0) { if (realm != null) { sb.append(" <field id=\"" + realmField + "\" value=\"" + realm + "\" />"); realm = null; } if (at != null) { sb.append(" <field id=\"" + timestampField + "\" value=\"" + at + "\" />"); } } sb.append (s); break; } if (inMsg > 0) sb.append (s); } return sb.toString().getBytes(); } }
LogChannel extends BaseChannel { protected byte[] streamReceive() throws IOException { StringBuilder sb = new StringBuilder(); String realm = null; String at= null; int inMsg = 0; while (reader != null) { String s = reader.readLine(); if (s == null) throw new EOFException(); if ((timestampField > 0 || realmField > 0) && s.contains("<log") && s.contains("at=")) { Matcher matcher = logPattern.matcher(s); if (matcher.find() && matcher.groupCount() > 1) { if (realmField > 0) realm = matcher.group(1); if (timestampField > 0) at = matcher.group(2); } } if (s.contains("<isomsg")) { inMsg++; } if (s.contains("</isomsg>") && --inMsg == 0) { if (at != null || realm != null && inMsg == 0) { if (realm != null) { sb.append(" <field id=\"" + realmField + "\" value=\"" + realm + "\" />"); realm = null; } if (at != null) { sb.append(" <field id=\"" + timestampField + "\" value=\"" + at + "\" />"); } } sb.append (s); break; } if (inMsg > 0) sb.append (s); } return sb.toString().getBytes(); } LogChannel();  LogChannel(String host, int port, ISOPackager p);  LogChannel(ISOPackager p);  LogChannel(ISOPackager p, ServerSocket serverSocket); }
LogChannel extends BaseChannel { protected byte[] streamReceive() throws IOException { StringBuilder sb = new StringBuilder(); String realm = null; String at= null; int inMsg = 0; while (reader != null) { String s = reader.readLine(); if (s == null) throw new EOFException(); if ((timestampField > 0 || realmField > 0) && s.contains("<log") && s.contains("at=")) { Matcher matcher = logPattern.matcher(s); if (matcher.find() && matcher.groupCount() > 1) { if (realmField > 0) realm = matcher.group(1); if (timestampField > 0) at = matcher.group(2); } } if (s.contains("<isomsg")) { inMsg++; } if (s.contains("</isomsg>") && --inMsg == 0) { if (at != null || realm != null && inMsg == 0) { if (realm != null) { sb.append(" <field id=\"" + realmField + "\" value=\"" + realm + "\" />"); realm = null; } if (at != null) { sb.append(" <field id=\"" + timestampField + "\" value=\"" + at + "\" />"); } } sb.append (s); break; } if (inMsg > 0) sb.append (s); } return sb.toString().getBytes(); } LogChannel();  LogChannel(String host, int port, ISOPackager p);  LogChannel(ISOPackager p);  LogChannel(ISOPackager p, ServerSocket serverSocket); void disconnect(); @Override void setConfiguration(Configuration cfg); }
LogChannel extends BaseChannel { protected byte[] streamReceive() throws IOException { StringBuilder sb = new StringBuilder(); String realm = null; String at= null; int inMsg = 0; while (reader != null) { String s = reader.readLine(); if (s == null) throw new EOFException(); if ((timestampField > 0 || realmField > 0) && s.contains("<log") && s.contains("at=")) { Matcher matcher = logPattern.matcher(s); if (matcher.find() && matcher.groupCount() > 1) { if (realmField > 0) realm = matcher.group(1); if (timestampField > 0) at = matcher.group(2); } } if (s.contains("<isomsg")) { inMsg++; } if (s.contains("</isomsg>") && --inMsg == 0) { if (at != null || realm != null && inMsg == 0) { if (realm != null) { sb.append(" <field id=\"" + realmField + "\" value=\"" + realm + "\" />"); realm = null; } if (at != null) { sb.append(" <field id=\"" + timestampField + "\" value=\"" + at + "\" />"); } } sb.append (s); break; } if (inMsg > 0) sb.append (s); } return sb.toString().getBytes(); } LogChannel();  LogChannel(String host, int port, ISOPackager p);  LogChannel(ISOPackager p);  LogChannel(ISOPackager p, ServerSocket serverSocket); void disconnect(); @Override void setConfiguration(Configuration cfg);  }