// Path: src/main/java/org/nextrtc/signalingserver/domain/Connection.java
// public interface Connection {
//     String getId();
// 
//     boolean isOpen();
// 
//     void sendObject(Object object);
// 
//     void close() throws IOException;
// }
// 
// Path: src/main/java/org/nextrtc/signalingserver/domain/Member.java
// @Getter
// @Component
// @Scope("prototype")
// public class Member implements NextRTCMember {
// 
//     private String id;
//     private Connection connection;
//     private Conversation conversation;
// 
//     private NextRTCEventBus eventBus;
// 
//     private ScheduledFuture<?> ping;
// 
//     public Member(Connection connection, ScheduledFuture<?> ping) {
//         this.id = connection.getId();
//         this.connection = connection;
//         this.ping = ping;
//     }
// 
//     public Optional<Conversation> getConversation() {
//         return Optional.ofNullable(conversation);
//     }
// 
//     public void markLeft() {
//         ping.cancel(true);
//     }
// 
//     void assign(Conversation conversation) {
//         this.conversation = conversation;
//         eventBus.post(MEMBER_JOINED.basedOn(
//                 builder()
//                         .conversation(conversation)
//                         .from(this)));
//     }
// 
//     public void unassignConversation(Conversation conversation) {
//         eventBus.post(MEMBER_LEFT.basedOn(
//                 builder()
//                         .conversation(conversation)
//                         .from(this)));
//         this.conversation = null;
//     }
// 
//     public boolean hasSameConversation(Member to) {
//         return to != null && conversation.equals(to.conversation);
//     }
// 
//     @Inject
//     public void setEventBus(NextRTCEventBus eventBus) {
//         this.eventBus = eventBus;
//     }
// 
//     @Override
//     public String toString() {
//         return String.format("%s", id);
//     }
// 
//     public synchronized Connection getConnection() {
//         return connection;
//     }
// 
//     @Override
//     public boolean equals(Object o) {
//         if (!(o instanceof Member)) {
//             return false;
//         }
//         Member m = (Member) o;
//         return new EqualsBuilder()//
//                 .append(m.id, id)//
//                 .isEquals();
//     }
// 
//     @Override
//     public int hashCode() {
//         return new HashCodeBuilder()//
//                 .append(id)//
//                 .build();
//     }
// }


import org.nextrtc.signalingserver.domain.Connection;
import org.nextrtc.signalingserver.domain.Member;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Component;
import java.util.concurrent.ScheduledFuture;
package org.nextrtc.signalingserver.factory;



@Component
public class SpringMemberFactory implements MemberFactory {

    @Autowired
    private ApplicationContext context;

    @Override
// Path: src/main/java/org/nextrtc/signalingserver/domain/Connection.java
// public interface Connection {
//     String getId();
// 
//     boolean isOpen();
// 
//     void sendObject(Object object);
// 
//     void close() throws IOException;
// }
// 
// Path: src/main/java/org/nextrtc/signalingserver/domain/Member.java
// @Getter
// @Component
// @Scope("prototype")
// public class Member implements NextRTCMember {
// 
//     private String id;
//     private Connection connection;
//     private Conversation conversation;
// 
//     private NextRTCEventBus eventBus;
// 
//     private ScheduledFuture<?> ping;
// 
//     public Member(Connection connection, ScheduledFuture<?> ping) {
//         this.id = connection.getId();
//         this.connection = connection;
//         this.ping = ping;
//     }
// 
//     public Optional<Conversation> getConversation() {
//         return Optional.ofNullable(conversation);
//     }
// 
//     public void markLeft() {
//         ping.cancel(true);
//     }
// 
//     void assign(Conversation conversation) {
//         this.conversation = conversation;
//         eventBus.post(MEMBER_JOINED.basedOn(
//                 builder()
//                         .conversation(conversation)
//                         .from(this)));
//     }
// 
//     public void unassignConversation(Conversation conversation) {
//         eventBus.post(MEMBER_LEFT.basedOn(
//                 builder()
//                         .conversation(conversation)
//                         .from(this)));
//         this.conversation = null;
//     }
// 
//     public boolean hasSameConversation(Member to) {
//         return to != null && conversation.equals(to.conversation);
//     }
// 
//     @Inject
//     public void setEventBus(NextRTCEventBus eventBus) {
//         this.eventBus = eventBus;
//     }
// 
//     @Override
//     public String toString() {
//         return String.format("%s", id);
//     }
// 
//     public synchronized Connection getConnection() {
//         return connection;
//     }
// 
//     @Override
//     public boolean equals(Object o) {
//         if (!(o instanceof Member)) {
//             return false;
//         }
//         Member m = (Member) o;
//         return new EqualsBuilder()//
//                 .append(m.id, id)//
//                 .isEquals();
//     }
// 
//     @Override
//     public int hashCode() {
//         return new HashCodeBuilder()//
//                 .append(id)//
//                 .build();
//     }
// }


// Path: src/main/java/org/nextrtc/signalingserver/factory/SpringMemberFactory.java
import org.nextrtc.signalingserver.domain.Connection;
import org.nextrtc.signalingserver.domain.Member;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Component;
import java.util.concurrent.ScheduledFuture;

package org.nextrtc.signalingserver.factory;



@Component
public class SpringMemberFactory implements MemberFactory {

    @Autowired
    private ApplicationContext context;

    @Override
    public Member create(Connection connection, ScheduledFuture<?> ping) {