package org.kne.cloud.network.minecraft;

import java.io.IOException;
import java.net.Socket;

import org.kne.cloud.network.SocketBridge;
import org.kne.cloud.network.StreamBridge;

public class MinecraftSocketBridge extends SocketBridge{
	private MinecraftProtocolContext mpca;
	private MinecraftProtocolContext mpcb;
	public MinecraftSocketBridge(Socket a, Socket b) throws IOException {
		super(a, b);
	}

	@Override
	protected void createStreamBridge() throws IOException {
		if(mpca==null)
			mpca=new MinecraftProtocolContext(true);
		if(mpcb==null)
			mpcb=new MinecraftProtocolContext(false);
		bridgeAB = new MinecraftStreamBridge(a.getInputStream(),mpca, b.getOutputStream(),mpcb,true);
		bridgeBA = new MinecraftStreamBridge(b.getInputStream(),mpcb, a.getOutputStream(),mpca,false);
	}

	public MinecraftProtocolContext getMpca() {
		return mpca;
	}

	public MinecraftProtocolContext getMpcb() {
		return mpcb;
	}

	@Override
	public MinecraftStreamBridge getBridgeAB() {
		// TODO 自动生成的方法存根
		return (MinecraftStreamBridge) super.getBridgeAB();
	}

	@Override
	public MinecraftStreamBridge getBridgeBA() {
		// TODO 自动生成的方法存根
		return (MinecraftStreamBridge) super.getBridgeBA();
	}
	
	
}
