// Path: src/main/java/com/reachcall/pretty/config/Match.java
// public class Match {
//     public final Configuration rootConfiguration;
//     public final Path path;
//     public final String finalPath;
//     public Destination destination;
//     public String affinityId;
//   
//     public Match(final String affinityId, final Path path,
//         final String finalPath, final Configuration rootConfiguration) {
//         this.affinityId = affinityId;
//         this.path = path;
//         this.finalPath = finalPath;
//         this.rootConfiguration = rootConfiguration;
//     }
// 
//     @Override
//     public boolean equals(Object obj) {
//         if (obj == null) {
//             return false;
//         }
// 
//         if (getClass() != obj.getClass()) {
//             return false;
//         }
// 
//         final Match other = (Match) obj;
// 
//         if ((this.finalPath == null) ? (other.finalPath != null)
//                                          : (!this.finalPath.equals(
//                     other.finalPath))) {
//             return false;
//         }
// 
//         if ((this.destination != other.destination)
//                 && ((this.destination == null)
//                 || !this.destination.equals(other.destination))) {
//             return false;
//         }
// 
//         if ((this.affinityId == null) ? (other.affinityId != null)
//                                           : (!this.affinityId.equals(
//                     other.affinityId))) {
//             return false;
//         }
// 
//         return true;
//     }
// 
//     @Override
//     public int hashCode() {
//         int hash = 3;
//         hash = (13 * hash)
//             + ((this.finalPath != null) ? this.finalPath.hashCode() : 0);
//         hash = (13 * hash)
//             + ((this.destination != null) ? this.destination.hashCode() : 0);
//         hash = (13 * hash)
//             + ((this.affinityId != null) ? this.affinityId.hashCode() : 0);
// 
//         return hash;
//     }
//     
//     public String toURL(){
//         return "http://"+this.destination.getHost()+":"+this.destination.getPort()+ (finalPath.startsWith("/") ? finalPath : "/"+finalPath);
//     }
// }


import com.google.common.collect.ArrayListMultimap;
import com.google.common.collect.Multimap;
import com.reachcall.pretty.config.Match;
import org.eclipse.jetty.websocket.WebSocket;
import java.util.Enumeration;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.servlet.http.HttpServletRequest;
/**
 * Copyright 2013, Robert Cooper, Reach Health
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 */
package com.reachcall.pretty.websocket;








/**
 *
 */
public class ProxyWebSocket implements WebSocket, WebSocket.OnFrame {
    private static final Logger LOG = Logger.getLogger(ProxyWebSocket.class.getCanonicalName());
    private Connection connection;
// Path: src/main/java/com/reachcall/pretty/config/Match.java
// public class Match {
//     public final Configuration rootConfiguration;
//     public final Path path;
//     public final String finalPath;
//     public Destination destination;
//     public String affinityId;
//   
//     public Match(final String affinityId, final Path path,
//         final String finalPath, final Configuration rootConfiguration) {
//         this.affinityId = affinityId;
//         this.path = path;
//         this.finalPath = finalPath;
//         this.rootConfiguration = rootConfiguration;
//     }
// 
//     @Override
//     public boolean equals(Object obj) {
//         if (obj == null) {
//             return false;
//         }
// 
//         if (getClass() != obj.getClass()) {
//             return false;
//         }
// 
//         final Match other = (Match) obj;
// 
//         if ((this.finalPath == null) ? (other.finalPath != null)
//                                          : (!this.finalPath.equals(
//                     other.finalPath))) {
//             return false;
//         }
// 
//         if ((this.destination != other.destination)
//                 && ((this.destination == null)
//                 || !this.destination.equals(other.destination))) {
//             return false;
//         }
// 
//         if ((this.affinityId == null) ? (other.affinityId != null)
//                                           : (!this.affinityId.equals(
//                     other.affinityId))) {
//             return false;
//         }
// 
//         return true;
//     }
// 
//     @Override
//     public int hashCode() {
//         int hash = 3;
//         hash = (13 * hash)
//             + ((this.finalPath != null) ? this.finalPath.hashCode() : 0);
//         hash = (13 * hash)
//             + ((this.destination != null) ? this.destination.hashCode() : 0);
//         hash = (13 * hash)
//             + ((this.affinityId != null) ? this.affinityId.hashCode() : 0);
// 
//         return hash;
//     }
//     
//     public String toURL(){
//         return "http://"+this.destination.getHost()+":"+this.destination.getPort()+ (finalPath.startsWith("/") ? finalPath : "/"+finalPath);
//     }
// }


// Path: src/main/java/com/reachcall/pretty/websocket/ProxyWebSocket.java
import com.google.common.collect.ArrayListMultimap;
import com.google.common.collect.Multimap;
import com.reachcall.pretty.config.Match;
import org.eclipse.jetty.websocket.WebSocket;
import java.util.Enumeration;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.servlet.http.HttpServletRequest;

/**
 * Copyright 2013, Robert Cooper, Reach Health
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 */
package com.reachcall.pretty.websocket;








/**
 *
 */
public class ProxyWebSocket implements WebSocket, WebSocket.OnFrame {
    private static final Logger LOG = Logger.getLogger(ProxyWebSocket.class.getCanonicalName());
    private Connection connection;
    private final Match destination;